UNIX檔案目錄指令介紹:(目錄,
亦稱資料夾)
- ls 察看所在目錄內容
ls -al 察看目錄或檔案權限內容 (
含隱藏檔.xxx及以表列形式顯示 )
-rwxrwxrwx -
檔案
drwxrwxrwx d
目錄
r :read(4)
w :write(2)
x :execute(1)
rwx: owner擁有者權限,
rwx:group群組權限, rwx:all所有人權限
- chmod 改變檔案或目錄權限
[語法]: chmod ###
target_name
例 : chmod△700△public_html 關閉public_html目錄權限
rwx :
r(4) + w(2) + x(1) => 7
r-x :
r(4) + w(0) + x(1) => 5
--- :
r(0) + w(0) + x(0) => 0
例 : chmod△755△public_html 開啟public_html目錄權限
- chsh
更改使用命令解譯器,
及個人帳戶資料
例 : chsh
#Changing
user database information
for username.
Shell: /bin/tcsh ←輸入你想用的命令解譯
Full Name: username
Office Location: ↙可以將資料填寫好,在用vi
or joe存檔即可.
Office Phone:
Home Phone:
Other information: |
- chown 更改目錄或檔案擁有者.
[語法1]: chown owner
target_name
[語法2]: chown owner:group
target_name
例 : chown △ david △ a.txt 更改a.txt檔擁有者為david
- rm 刪除檔案
[語法1]: rm file_name
刪除file_name檔
[語法2]: rm -Rf name
強制刪除目錄和其子目錄(注意:動作為不可復原)
例 : rm a.txt 刪除a.txt(執行位置需有a.txt檔).
例 : rm -Rf doc
強制刪除doc目錄及其所有子目錄.
- mkdir 新增目錄(dir_name可自行命名)
[語法]: mkdir dir_name
建立dir_name目錄
例 : mkdir △ doc
在目前位置建立新目錄doc
- rmdir 刪除一目錄(
需為空目錄才可 )
[語法]: rmdir dir_name
刪除dir_name目錄
例 : rmdir △ doc
刪除目前位置下doc的目錄
- mv 搬移檔案或目錄,
或更改檔案或目錄名稱
[語法1]: mv source
target
[語法2]: mv source1
source2 ... 欲搬至的目錄
例 : mv a.txt doc
搬移a.txt檔至/doc目錄下
例 : mv a.txt b.txt
將a.txt更名為b.txt
- cp 檔案或目錄複製
[語法1]: cp source_file target_file
將來源檔複製蓋到目的檔
[語法2]: cp [-R [-H | -L | -P]] [-f | -i |
-n] [-pv] source_file target_file
例 : cp a.txt b.txt 將a.txt內容複製蓋掉b.txt上去.
例 : cp -R doc backup
將目錄/doc(含子目錄)複製成/backup.
- sort 排序(對文字檔)
[語法1]: sort textfilename
對文字檔內各行作排序
[語法2]: sort [-cmus] [-t separator] [-o
output-file] [-T tempdir] [-bdfiMnr]
[+POS1 [-POS2]] [-k POS1[,POS2]] [file...]
例 : sort a.txt -o b.txt
將a.txt內容排序,並輸出至b.txt
|
|