LinuxShell-目录与文件浏览和管理

【版权申明】未经博主同意,谢绝转载!(请尊重原创,博主保留追究权) 

LinuxShell-目录与文件浏览和管理

LinuxShell目录传送门: https://blog.csdn.net/MACMACip/article/details/89890219

  1.ls
  2.pwd
  3.cd
  4.mkdir
  5.rmdir
  6.mv
  7.rm
  8.cp
  9.vim/vi
  10.touch
  11.ln
  12.file

1.ls

$ man ls
   list directory contents
   列出目录内容

-a, --all
   do not ignore entries starting with .
   所有文件

-l
   use a long listing format
   使用长列表格式
ls -l
在这里需要详细解释一下, ls -l中, 每个字段的意思: [传送门: ls -l中, 每个字段的意思]

-s, --size
   print the allocated size of each file, in blocks
   打印每个文件的块大小

-i, --inode
   print the index number of each file
   打印文件的index number, 即我们所说的inode号.

2.pwd

$ man pwd
   print name of current/working directory
   打印当前/工作的目录路径

3.cd

$ 无man cd指令
   change directory
   改变当前工作目录

使用cd命令时常遇见的符号:
   ~: 当前用户目录
   / : 根目录
   - : 上一次cd时, 所在的目录
   . : 当前目录

4.mkdir

$ man mkdir
   make directories
   创建文件夹, 可以一次创建多个文件夹

-p, --parents
   no error if existing, make parent directories as needed
   递归创建所有的文件夹(如果需要的话).

5.rmdir

$ man rmdir
   remove empty directories
   移除空的文件夹(注意: 非空文件夹无法移除)

-p, --parents
   remove DIRECTORY and its ancestors; e.g., ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b a’
   移除给定的全路径. 如 ‘rmdir -p a/b/c’, 相当于 rmdir a/b/c a/b a

6.mv

$ man mv
   move (rename) files
   移动/重命名文件

-f, --force
   do not prompt before overwriting
   重写前不进行提示

使用rm/mv命令时常遇见的符号:
   * : 表示所有
   ? : 代表着一个字符

7.rm

$ man rm
   remove files or directories
   移除文件或文件夹

-f, --force
   ignore nonexistent files and arguments, never prompt
   忽略不存在的文件和参数, 从不提示.

-r, -R, --recursive
   remove directories and their contents recursively
   移除文件/文件夹/递归移除它的子文件夹与文件

8.cp

$ man cp
   copy files and directories
   拷贝文件或文件夹

9.vim/vi

$ man vi
   Vi IMproved, a programmers text editor
   Linux中常见的一种文本编辑器

经验之谈:
   在刚装好的Linux系统中, 有些人会发现使用vi进行文本编辑时, 键盘上某几个按键是与键盘上标识的是不一样的. 此时, 安装vim即可以解决问题.(仅用在Ubuntu系统, 命令: sudo apt-get install vim), 再次使用vi编辑器也是不会出现这个问题的.

10.touch

$ man touch
   change file timestamps
   改变文件的时间戳(如果不存在这个文件, 则创建)

-a
   change only the access time
   仅改变该文件的访问时间

-c, --no-create
   do not create any files
   不创建任何文件

-m
   change only the modification time
   仅改变该文件的修改时间

11.ln

$ man ln
   make links between files
   在文件之间建立链接

-s, --symbolic
   make symbolic links instead of hard links
   制作一个软连接去替代一个硬连接.

12.file

$ man file
   determine file type
   探知文件类型

在日常的开发中, 我们常用这个命令去探知一个文件是做什么的(可执行文件? 动态静态库文件? 目标文件? 还是一个普通的文本?), 或者是探知这个文件运行在哪个平台(32位?64位? 常见于嵌入式的交叉编译差错中).

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

安河桥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值