Linux中对一些常用命令的使用测试(后续会添,没添就是忘记了。。)

本文介绍了Linux系统中常用的文件管理命令,如`cd`用于切换目录,`ls`显示目录内容,`ls-l`和`ls-lh`分别显示详细信息和人性化大小的目录内容。通过目录名或完整路径可以定位到具体目录进行操作。这些基本命令是Linux用户日常操作的基础。
摘要由CSDN通过智能技术生成

Linux的常用命令传送

注:
在这里插入图片描述
下面的测试中提到的0331,0401,0312等都是目录名

cd

cd 目录名

root@jsetc-virtual-machine:/# cd 0331
root@jsetc-virtual-machine:/0331# 

cd 目录路径

root@jsetc-virtual-machine:/0331# cd /0312/make
root@jsetc-virtual-machine:/0312/make# 

cd /

root@jsetc-virtual-machine:/0331# cd /
root@jsetc-virtual-machine:/# 

cd ..

root@jsetc-virtual-machine:/0312/make# cd ..
root@jsetc-virtual-machine:/0312# 

cd -

root@jsetc-virtual-machine:/0312/make# cd ..
root@jsetc-virtual-machine:/0312# cd -
/0312/make
root@jsetc-virtual-machine:/0312/make# 

ls

ls:

root@jsetc-virtual-machine:/0331# ls
fifo  r1.c  read.c  si.c      w1    write
r1    read  si      test.txt  w1.c  write.c

ls /目录名

root@jsetc-virtual-machine:/0331# ls /0401
dx  dx.c  jn  jn.c  sh  sh.c

ls -a

root@jsetc-virtual-machine:/0331# ls -a
.   fifo  r1.c  read.c  si.c      w1    write
..  r1    read  si      test.txt  w1.c  write.c

ls -A

root@jsetc-virtual-machine:/0331# ls -A
fifo  r1.c  read.c  si.c      w1    write
r1    read  si      test.txt  w1.c  write.c

ls -c

root@jsetc-virtual-machine:/# ls -c
tmp   0327   0322  0311    sbin         var
run   0314   0318  home    snap         srv
root  0326   0317  etc     boot         opt
0402  0319   0315  c       initrd.img   initrd.img.old
0401  0325   dev   libx32  vmlinuz      swapfile
0331  0316   sys   usr     vmlinuz.old  lost+found
0330  zuoye  proc  lib     media
0329  0324   0312  lib32   mnt
0328  0323   bin   lib64   cdrom

ls -C

root@jsetc-virtual-machine:/# ls -C
0311  0323  0401   initrd.img      opt       tmp
0312  0324  0402   initrd.img.old  proc      usr
0314  0325  bin    lib             root      var
0315  0326  boot   lib32           run       vmlinuz
0316  0327  c      lib64           sbin      vmlinuz.old
0317  0328  cdrom  libx32          snap      zuoye
0318  0329  dev    lost+found      srv
0319  0330  etc    media           swapfile
0322  0331  home   mnt             sys

ls -l

root@jsetc-virtual-machine:/0331# ls -l
total 80
prw-r--r-- 1 root root    0 3月  31 14:50 fifo
-rwxr-xr-x 1 root root 8656 3月  31 16:28 r1
-rw-r--r-- 1 root root  584 3月  31 16:33 r1.c
-rwxr-xr-x 1 root root 8480 3月  31 11:32 read
-rw-r--r-- 1 root root  303 3月  31 11:32 read.c
-rwxr-xr-x 1 root root 8416 3月  31 17:36 si
-rw-r--r-- 1 root root  245 3月  31 17:36 si.c
prw-r--r-- 1 root root    0 3月  31 16:34 test.txt
-rwxr-xr-x 1 root root 8664 3月  31 16:34 w1
-rw-r--r-- 1 root root  593 3月  31 16:34 w1.c
-rwxr-xr-x 1 root root 8536 3月  31 14:31 write
-rw-r--r-- 1 root root  329 3月  31 14:31 write.c

ls -lh

root@jsetc-virtual-machine:/0331# ls -lh
total 80K
prw-r--r-- 1 root root    0 3月  31 14:50 fifo
-rwxr-xr-x 1 root root 8.5K 3月  31 16:28 r1
-rw-r--r-- 1 root root  584 3月  31 16:33 r1.c
-rwxr-xr-x 1 root root 8.3K 3月  31 11:32 read
-rw-r--r-- 1 root root  303 3月  31 11:32 read.c
-rwxr-xr-x 1 root root 8.3K 3月  31 17:36 si
-rw-r--r-- 1 root root  245 3月  31 17:36 si.c
prw-r--r-- 1 root root    0 3月  31 16:34 test.txt
-rwxr-xr-x 1 root root 8.5K 3月  31 16:34 w1
-rw-r--r-- 1 root root  593 3月  31 16:34 w1.c
-rwxr-xr-x 1 root root 8.4K 3月  31 14:31 write
-rw-r--r-- 1 root root  329 3月  31 14:31 write.c

在以上命令后,缀上目录名的作用就是锁定要查看的目录,不在当前目录下的目录要查看则要缀上要查看的目录路径,不缀目录名就默认查看当前所在目录。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值