Linux
  • Introduction
  • 和文件打交道
    • Linux 基本指令 ls 和 cd
    • Linux 基本指令 touch, cp 和 mv
    • Linux 基本指令 mkdir, rmdir 和 rm
    • Linux 基本指令 nano 和 cat
  • Linux 文件权限
  • 远程操控
    • 怎么样从 MacOS 或 Linux 通过 SSH 远程 Linux
    • 怎么样从 Windows 通过 SSH 远程 Linux
  • 云端机器学习
    • 自己的云计算, 把 Linux 当成你的云计算平台
Powered by GitBook
On this page
  • nano
  • cat

Was this helpful?

  1. 和文件打交道

Linux 基本指令 nano 和 cat

PreviousLinux 基本指令 mkdir, rmdir 和 rmNextLinux 文件权限

Last updated 6 years ago

Was this helpful?

nano

nano是 linux 的一款文字编辑工具.

用nano执行t.py文件.

$ nano t.py

然后按 “Ctrl + x” 来保存和退出.

cat

cat(catenate) 可以用来显示文件内容, 或者是将某个文件里的内容写入到其他文件里.

1 查看文件内容

$ cat t.py
print("This is a Python script!")

2 > 将文件的内容放到另一个文件里

$ cat t.py > t1.py
$ cat t1.py
print("This is a Python script!")

3 > 将多个文件的内容打包一起放入另一个文件

$ cat t.py t1.py > t2.py
$ cat t2.py
print("This is a Python script!")
print("This is a Python script!")

4 >> 将内容添加在一个文件末尾

$ cat t3 >> t2.py
$ cat t2.py
print("This is a Python script!")
print("This is a Python script!")
This is t3.
Linux 基本指令 nano 和 cat