linux常用命令之目录处理

来源:互联网 时间:2026-02-26 12:05:01 作者:

系统大全为您提供
目录处理命令 : ls 所在路径 /bin/ls 执行权限:所有用户   ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 [root@localhost ~]# ls anaconda-ks.cfg  install.log.syslog  VMwareTools-9.6.2-1688356.tar.gz Desktop          test2.txt           vmware-tools-distrib install.log      test.txt [root@localhost ~]# ls -alh 总计 59M drwxr-x--- 19 root root 4.0K 11-30 20:33 . drwxr-xr-x 24 root root 4.0K 11-30 19:11 .. -rw-------  1 root root 1.3K 11-30 20:59 anaconda-ks.cfg -rw-------  1 root root 4.8K 11-30 20:33 .bash_history -rw-r--r--  1 root root   24 2006-07-13 .bash_logout -rw-r--r--  1 root root  191 11-30 19:25 .bash_profile -rw-r--r--  1 root root  176 2006-07-13 .bashrc drwx------  2 root root 4.0K 11-30 21:42 .chewing drwx------  3 root root 4.0K 11-30 17:50 .config -rw-r--r--  1 root root  100 2006-07-13 .cshrc drwxr-xr-x  3 root root 4.0K 11-30 13:52 Desktop -rw-------  1 root root   26 11-30 21:42 .dmrc drwxr-x---  2 root root 4.0K 11-30 21:43 .eggcups drwx------  4 root root 4.0K 11-30 19:15 .gconf drwx------  2 root root 4.0K 12-01 12:11 .gconfd drwxr-xr-x  3 root root 4.0K 11-30 21:42 .gnome drwx------  6 root root 4.0K 11-30 21:42 .gnome2 drwx------  2 root root 4.0K 11-30 21:42 .gnome2_private drwxr-xr-x  2 root root 4.0K 11-30 21:43 .gstreamer-0.10 -rw-r--r--  1 root root   81 11-30 21:42 .gtkrc-1.2-gnome2 -rw-------  1 root root  567 11-30 19:15 .ICEauthority -rw-r--r--  1 root root  27K 11-30 20:58 install.log -rw-r--r--  1 root root 3.6K 11-30 20:57 install.log.syslog drwx------  3 root root 4.0K 11-30 21:43 .metacity drwx------  4 root root 4.0K 11-30 13:52 .mozilla -rw-------  1 root root   40 11-30 20:20 .mysql_history drwxr-xr-x  3 root root 4.0K 11-30 21:42 .nautilus drwxr-xr-x  3 root root 4.0K 11-30 21:42 .redhat drwx------  4 root root 4.0K 11-30 13:49 .scim -rw-r--r--  1 root root  129 2006-07-13 .tcshrc -rw-r--r--  1 root root 4.2K 11-30 20:27 test2.txt -rw-r--r--  1 root root  16K 11-30 20:27 .test2.txt.swp -rw-r--r--  1 root root  779 11-30 16:28 test.txt drwx------  2 root root 4.0K 11-30 21:43 .Trash -rw-------  1 root root 5.4K 11-30 20:33 .viminfo -r--r--r--  1 root root  59M 11-30 21:44 VMwareTools-9.6.2-1688356.tar.gz drwxr-xr-x  7 root root 4.0K 2014-03-22 vmware-tools-distrib -rw-r--r--  1 root root 9.6K 11-30 20:33 .xsession-errors [root@localhost ~]# ls -i 425993 anaconda-ks.cfg     426072 test2.txt 426023 Desktop             426065 test.txt 425986 install.log         426054 VMwareTools-9.6.2-1688356.tar.gz425987 install.log.syslog  458753 vmware-tools-distrib
 命令名称: mkdir
 
所在路径:/bin/mkdir
权限:所有用户
 
?
1
2
3
[root@localhost ~]# mkdir /tmp

ina/test
mkdir: 无法创建目录 “/tmp

ina/test”: 没有那个文件或目录
[root@localhost ~]# mkdir -p /tmp

ina/test

命令名称:cd
 
所在路径:shell 内置命令
执行权限:所有用户
命令名称:pwd
所在路径:/bin/pwd
执行权限:所有用户
 
?
1
2
3
4
5
6
7
8
mkdir: 无法创建目录 “/tmp

ina/test”: 没有那个文件或目录
[root@localhost ~]# mkdir -p /tmp

ina/test
[root@localhost ~]#
[root@localhost ~]# cd /tmp

ina/test
[root@localhost test]# pwd
/tmp

ina/test
[root@localhost test]# cd ..
[root@localhost china]#


 
命令名称:rmdir (删除空目录)
所在路径:/bin/rmdir
 
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@localhost china]# rmdir /tmp

ina/test
[root@localhost china]# cd /tmp
[root@localhost tmp]# ll
总计 48
drwxr-xr-x 2 root root 4096 12-01 13:05 china
drwx------ 3 root root 4096 11-30 19:15 gconfd-root
drwx------ 2 root root 4096 11-30 19:15 keyring-n4KWUI
srwxr-xr-x 1 root root    0 11-30 19:15 mapping-root
drwx------ 2 root root 4096 12-01 12:10 orbit-root
-rw-r--r-- 1 root root    5 12-01 13:00 scim-bridge-0.3.0.lockfile-0@localhost:0.0
srwxr-xr-x 1 root root    0 11-30 20:10 scim-bridge-0.3.0.socket-0@localhost:0.0
srw------- 1 root root    0 11-30 19:16 scim-helper-manager-socket-root
srw------- 1 root root    0 11-30 19:16 scim-panel-socket:0-root
srw------- 1 root root    0 11-30 19:15 scim-socket-frontend-root
drwx------ 2 root root 4096 11-30 19:15 ssh-mibWGs4219
drwx------ 2 root root 4096 11-30 19:15 virtual-root.tyft1a
drwxr-xr-x 2 root root 4096 11-30 21:48 vmware-config0
drwxrwxrwt 4 root root 4096 11-30 18:13 VMwareDnD
drwxr-xr-x 2 root root 4096 11-30 19:13 vmware-root
drwx------ 2 root root 4096 11-30 19:15 vmware-root-2083992326
[root@localhost tmp]# rmdir /tmp
rmdir: /tmp: 目录非空

命令名称:cp
 
所在路径:/bin


权限:所有用户
 
?
1
2
[root@localhost tmp]# cp -pr /tmp/test /root # 复制目录 需要参数r 保持原有属性需要参数 p
[root@localhost tmp]#
命令名称:mv 剪切和改名 不需要参数-r -p
 
所在路径:/bin/mv
执行权限:所有用户
 
?
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost ~]# mv install.log install3.log
[root@localhost ~]# ll
总计 59964
-rw------- 1 root root     1265 11-30 20:59 anaconda-ks.cfg
drwxr-xr-x 3 root root     4096 11-30 13:52 Desktop
-rw-r--r-- 1 root root    27265 11-30 20:58 install3.log
-rw-r--r-- 1 root root     3671 11-30 20:57 install.log.syslog
drwxr-xr-x 2 root root     4096 12-01 13:09 test
-rw-r--r-- 1 root root     4207 11-30 20:27 test2.txt
-rw-r--r-- 1 root root      779 11-30 16:28 test.txt
-r--r--r-- 1 root root 61260572 11-30 21:44 VMwareTools-9.6.2-1688356.tar.gz
drwxr-xr-x 7 root root     4096 2014-03-22 vmware-tools-distrib[root@localhost ~]#
目录名称:rm   所在路径:/bin/rm 执行权限:所有用户   ? 1 2 3 4 5 6 7 8 [root@localhost tmp]# mkdir temp [root@localhost tmp]# cd [root@localhost ~]# cp /etc/grub.conf /tmp/temp [root@localhost ~]# rm -f /tmp/temp/grub.conf [root@localhost ~]# rm /tmp/temp rm: 无法删除目录“/tmp/temp”: 是一个目录 [root@localhost ~]# rm -r  /tmp/temprm:是否删除 目录 “/tmp/temp”? y 
 
  以上就是系统大全给大家介绍的如何使的方法都有一定的了解了吧,好了,如果大家还想了解更多的资讯,那就赶紧点击系统大全官网吧。
本文来自系统大全https://www.herecours.com/d/file/efpub/2026/26-26/20260226115329567462

相关推荐