0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Linux常用文件操作

Last updated at Posted at 2021-02-14

文件操作相关命令

命令 作用
$ vim [文件名] 使用vim打开文件 (文件不存在时则新建文件)
$ cat [-n] [文件名] 保存并关闭
$ more [文件名] 查看长文件
$ head [-x] [文件名] 查看文件前x行
$ tail [-x] [文件名] 查看文件后x行
$ [内容] > [文件名] 重定向
$ cp [-r] [文件名/目录名] 复制文件/目录(-r 递归复制)
$ rm [-r][-rf] [文件名/目录名] 删除文件/目录(-r 递归删除,-rf 强制递归删除)
$ find [目录] [-name] [查找内容] 查找文件

vim常用命令

命令模式

命令 作用
i 进入编辑模式
:q! 不保存强制关闭
:w! 保存
:wq! 保存并关闭
:set number 显示行号
:set nonumber 隐藏行号

编辑模式

命令 作用
esc 退出编辑模式
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?