linux 常用命令 之目錄處理(一)

來源:互聯網
上載者:User

標籤:des   blog   io   ar   os   sp   檔案   on   2014   

目錄處理命令 : ls

所在路徑 /bin/ls

執行許可權:所有使用者

[[email protected] ~]# lsanaconda-ks.cfg  install.log.syslog  VMwareTools-9.6.2-1688356.tar.gzDesktop          test2.txt           vmware-tools-distribinstall.log      test.txt[[email protected] ~]# ls -alh總計 59Mdrwxr-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 .bashrcdrwx------  2 root root 4.0K 11-30 21:42 .chewingdrwx------  3 root root 4.0K 11-30 17:50 .config-rw-r--r--  1 root root  100 2006-07-13 .cshrcdrwxr-xr-x  3 root root 4.0K 11-30 13:52 Desktop-rw-------  1 root root   26 11-30 21:42 .dmrcdrwxr-x---  2 root root 4.0K 11-30 21:43 .eggcupsdrwx------  4 root root 4.0K 11-30 19:15 .gconfdrwx------  2 root root 4.0K 12-01 12:11 .gconfddrwxr-xr-x  3 root root 4.0K 11-30 21:42 .gnomedrwx------  6 root root 4.0K 11-30 21:42 .gnome2drwx------  2 root root 4.0K 11-30 21:42 .gnome2_privatedrwxr-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.syslogdrwx------  3 root root 4.0K 11-30 21:43 .metacitydrwx------  4 root root 4.0K 11-30 13:52 .mozilla-rw-------  1 root root   40 11-30 20:20 .mysql_historydrwxr-xr-x  3 root root 4.0K 11-30 21:42 .nautilusdrwxr-xr-x  3 root root 4.0K 11-30 21:42 .redhatdrwx------  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.txtdrwx------  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.gzdrwxr-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[[email protected] ~]# ls -i425993 anaconda-ks.cfg     426072 test2.txt426023 Desktop             426065 test.txt425986 install.log         426054 VMwareTools-9.6.2-1688356.tar.gz425987 install.log.syslog  458753 vmware-tools-distrib

命令名稱: mkdir

所在路徑:/bin/mkdir

許可權:所有使用者

[[email protected] ~]# mkdir /tmp/china/testmkdir: 無法建立目錄 “/tmp/china/test”: 沒有那個檔案或目錄[[email protected] ~]# mkdir -p /tmp/china/test

命令名稱:cd 

所在路徑:shell 內建命令

執行許可權:所有使用者


命令名稱:pwd

所在路徑:/bin/pwd

執行許可權:所有使用者

mkdir: 無法建立目錄 “/tmp/china/test”: 沒有那個檔案或目錄[[email protected] ~]# mkdir -p /tmp/china/test[[email protected] ~]# [[email protected] ~]# cd /tmp/china/test[[email protected] test]# pwd/tmp/china/test[[email protected] test]# cd ..[[email protected] china]# 


命令名稱:rmdir (刪除空目錄)

所在路徑:/bin/rmdir

[[email protected] china]# rmdir /tmp/china/test[[email protected] china]# cd /tmp[[email protected] tmp]# ll總計 48drwxr-xr-x 2 root root 4096 12-01 13:05 chinadrwx------ 3 root root 4096 11-30 19:15 gconfd-rootdrwx------ 2 root root 4096 11-30 19:15 keyring-n4KWUIsrwxr-xr-x 1 root root    0 11-30 19:15 mapping-rootdrwx------ 2 root root 4096 12-01 12:10 orbit-root-rw-r--r-- 1 root root    5 12-01 13:00 [email protected]:0.0srwxr-xr-x 1 root root    0 11-30 20:10 [email protected]:0.0srw------- 1 root root    0 11-30 19:16 scim-helper-manager-socket-rootsrw------- 1 root root    0 11-30 19:16 scim-panel-socket:0-rootsrw------- 1 root root    0 11-30 19:15 scim-socket-frontend-rootdrwx------ 2 root root 4096 11-30 19:15 ssh-mibWGs4219drwx------ 2 root root 4096 11-30 19:15 virtual-root.tyft1adrwxr-xr-x 2 root root 4096 11-30 21:48 vmware-config0drwxrwxrwt 4 root root 4096 11-30 18:13 VMwareDnDdrwxr-xr-x 2 root root 4096 11-30 19:13 vmware-rootdrwx------ 2 root root 4096 11-30 19:15 vmware-root-2083992326[[email protected] tmp]# rmdir /tmprmdir: /tmp: 目錄非空

命令名稱:cp

所在路徑:/bin/cp

許可權:所有使用者

[[email protected] tmp]# cp -pr /tmp/test /root # 複製目錄 需要參數r 保持原有屬性需要參數 p[[email protected] tmp]# 
命令名稱:mv 剪下和改名 不需要參數-r -p

所在路徑:/bin/mv

執行許可權:所有使用者

[[email protected] ~]# mv install.log install3.log[[email protected] ~]# ll總計 59964-rw------- 1 root root     1265 11-30 20:59 anaconda-ks.cfgdrwxr-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.syslogdrwxr-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.gzdrwxr-xr-x 7 root root     4096 2014-03-22 vmware-tools-distrib[[email protected] ~]# 


目錄名稱:rm

所在路徑:/bin/rm

執行許可權:所有使用者

[[email protected] tmp]# mkdir temp[[email protected] tmp]# cd [[email protected] ~]# cp /etc/grub.conf /tmp/temp[[email protected] ~]# rm -f /tmp/temp/grub.conf [[email protected] ~]# rm /tmp/temprm: 無法刪除目錄“/tmp/temp”: 是一個目錄[[email protected] ~]# rm -r  /tmp/temprm:是否刪除 目錄 “/tmp/temp”? y




linux 常用命令 之目錄處理(一)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.