Linux基础指令目录管理003

      今天我们讲一下目录的切换。

操作系统:

CentOS Stream 9

操作命令:

cd

改变当前工作目录

[root@localhost ~]# cd /usr/local/nginx/conf
[root@localhost conf]# cd ..
[root@localhost nginx]# cd ..
[root@localhost local]# 

操作命令:

ls

查看目录信息

[root@localhost ~]# ls
1.txt  2.txt  anaconda-ks.cfg  nginx-1.26.0  nginx-1.26.0.tar.gz
[root@localhost ~]# 

选项

-l 提供目录或文件详细信息

[root@localhost ~]# ls -l
总用量 1220
-rw-r--r--  1 root root        0  6月  1 00:41 1.txt
-rw-r--r--  1 root root        0  6月  1 00:44 2.txt
-rw-------. 1 root root     1231  5月  8 15:09 anaconda-ks.cfg
drwxr-xr-x  9  502 games     186  5月 25 20:12 nginx-1.26.0
-rw-r--r--  1 root root  1244118  4月 23 22:58 nginx-1.26.0.tar.gz
[root@localhost ~]# 

-t 按修改时间对文件目录进行排序

[root@localhost ~]# ls -t
2.txt  1.txt  nginx-1.26.0  anaconda-ks.cfg  nginx-1.26.0.tar.gz
[root@localhost ~]# 

-r 递归显示子目录内容

[root@localhost ~]# ls -r
nginx-1.26.0.tar.gz  nginx-1.26.0  anaconda-ks.cfg  2.txt  1.txt
[root@localhost ~]# 

-s 按文件大小排序

[root@localhost ~]# ls -s
总用量 1220
   0 1.txt     4 anaconda-ks.cfg  1216 nginx-1.26.0.tar.gz
   0 2.txt     0 nginx-1.26.0
[root@localhost ~]# 

-d只列出目录不显示文件

[root@localhost ~]# ls -d
.
[root@localhost ~]# 

-h显示文件大小

[root@localhost ~]# ls -h
1.txt  2.txt  anaconda-ks.cfg  nginx-1.26.0  nginx-1.26.0.tar.gz
[root@localhost ~]# 

常用选项

[root@localhost ~]# ls -lhrt /etc/passwd
-rw-r--r-- 1 root root 923  5月  8 15:45 /etc/passwd
[root@localhost ~]# 

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值