一 ls 命令
1. [root@chy ~]# ls -l 列出檔案的詳細資訊
總用量 4
-rw-------. 1 root root 1695 5月 26 03:22 anaconda-ks.cfg
第一列是許可權,第二列是有幾個檔案使用了inode .第三列是所有者
第四列是所屬組。第五列是檔案的大小 ,第六列是檔案建立的時間。
第七列是它的檔名。
[root@chy ~]# ls -i anaconda-ks.cfg 檢視檔案的inode
143700 anaconda-ks.cfg
2.[root@chy ~]# ls -la 列出檔案的詳細檔案與隱藏檔案
3 .[root@chy ~]# ls -ld / 列出目錄本身,而不是列車目錄內的檔案資料
二、檔案型別
1.[root@chy ~]# ls -la
總用量 44
dr-xr-x---. 3 root root 4096 6月 1 00:46 .
dr-xr-xr-x. 18 root root 4096 6月 1 05:18 ..
-rw-------. 1 root root 1695 5月 26 03:22 anaconda-ks.cfg
-rw-------. 1 root root 6058 6月 2 04:10 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
drwx------. 2 root root 4096 6月 1 08:43 .ssh
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
對以上說明:
第一列d 是目錄
第一列- 是檔案 (普通檔案可以用cat 來檢視)
第一列c 是字串裝置
第一列l 是軟鏈結 (相當於快捷方式)
第一列b 是塊裝置 (如光碟)
第一列s 是用來通訊的 (程序與程序之間通訊)
三 alias命令
alias 別名
1 root@chy ~]# which ls 用which 來檢視別名
2 [root@chy ~]# alias 檢視有哪些命令使用了別名
3 [root@chy ~]# echo $path
4 [root@chy ~]# alias chy='ls -lha' 建立別名
[root@chy ~]# alias -p 檢視別名
[root@chy ~]# unalias chy 取消別名
補充說明:alias 只是當前生效,如果想永久生效[root@chy ~]# vi .bash_profile 中增加想要建立的別名 然後[root@chy ~]# source .bash_profile 就可以永久生效了
五 絕對路徑
六 cd 命令
七 建立和刪除目錄mkdir&rmdir
[root@chy ~]# mkdir /tmp/chylinux/ 建立tmp下的chylinux目錄[root@chy ~]# ls -ld /tmp/chylinux (檢視此目錄如下)drwxr-xr-x 2 root root 4096 6月 4 10:30 /tmp/chylinux[root@chy ~]# date (檢視時間的命令)\[root@chy ~]# mkdir -p /tmp/chylinux/123/456/789/1234567 (mkdir -p 是建立一連串的目錄)[root@chy ~]# mkdir -pv /tmp/chylinux/1/2/3 (mkdir -pv v的意思是視覺化的意思,如下列)mkdir: 已建立目錄 "/tmp/chylinux/1"mkdir: 已建立目錄 "/tmp/chylinux/1/2"mkdir: 已建立目錄 "/tmp/chylinux/1/2/3"[root@chy ~]# mkdir -m 777 chy (-m 這個是建立時配置目錄的許可權,不需要看預設的umask許可權
[root@chy ~]# ls -ld chy (如下是mkdir -m的式列)
drwxrwxrwx 2 root root 4096 6月 4 12:21 chy
rmdir == remove directory ("刪除『空』的目錄",只能刪除空目錄)[root@chy ~]# rmdir -pv /tmp/chylinux/123/456/789 (刪除目錄 rm -pv 連串刪除並且視覺化如下試例)
rmdir: 正在刪除目錄 "/tmp/chylinux/123/456/789"
rmdir: 正在刪除目錄 "/tmp/chylinux/123/456"
rmdir: 正在刪除目錄 "/tmp/chylinux/123"
rmdir: 正在刪除目錄 "/tmp/chylinux"
rmdir: 刪除目錄 "/tmp/chylinux" 失敗: 目錄非空
八、rm = remove
[root@chy ~]# rm /tmp/chylinux/1/2/3/1.txt(刪除檔案)rm:是否刪除普通空檔案 "/tmp/chylinux/1/2/3/1.txt"?y[root@chy ~]# rm /tmp/chylinux/1/2/3/* (*是萬用字元,匹配0個或多個字元)rm:是否刪除普通空檔案 "/tmp/chylinux/1/2/3/1.txt"?n
[root@chy ~]# rm -f /tmp/chylinux/1/2/3/* (rm -f 是強制刪除,不需要問, f =forced )[root@chy ~]# history (檢視歷史命令)[root@chy ~]# rm -r /tmp/chylinux/1/2/3 (rm -r 是否刪除目錄r =recursive )[root@chy ~]# rm -rfv /tmp/chylinux/1/2/3 (rm -rfv 刪除目錄,不提示並且視覺化)[root@chy ~]# !tree (!是回到歷史命令最後使用tree的命令)[root@chy ~]# rm -rfv /tmp/chylinux/1/2/3/ (這裡需要注意的是刪除的目錄如果是不存在的目錄,如3目錄不存在,在刪除的時候加上rm-rfv 是沒有任何提示的。試例如下)[root@chy ~]# rm -vr /tmp/chylinux/1/2/3rm: 無法刪除"/tmp/chylinux/1/2/3": 沒有那個檔案或目錄
llinux 命令 cat命令
cat concatenate,連線 命令將 檔案 或標準輸入組合輸出到標準輸出,如果沒有指定檔案,或者檔案為 則從標準輸入讀取。cat 選項 檔案 1 顯示檔案內容 root vm 0 4 centos chenwei cat case.sh bin bash case 1in 1 echo 周一...
llinux驅動基礎知識
開篇語 1.linux體系結構 分為使用者空間和核心空間 主要講核心結構 1 system call inte ce sci層 為使用者空間提供了一套標準的系統呼叫函式來訪問linux核心 2 procees management pm 程序管理是建立程序 fork exec 停止程序 kill e...
llinux 檔案搜尋命令
檔案搜尋命令 locate locate 檔名 只能搜尋檔名 在後台資料庫中按檔名搜尋,搜尋速度快 var lib mlocate update 更新資料庫 命令搜尋命令 whereis與which 1 搜尋命令的命令whereis whereis 命令名 選項 b 只查詢可執行檔案 m 只查詢幫助...