2013年08月20日

1.

cd
pwd------------------------------------pwd---------------------pwd -P
mkdir
  • mkdir test1/test2/test3/test42013年08月20日 - district10 - DISTRICT10
  • mkdir -p test1/test2/test3/test4rmdir2013年08月20日 - district10 - DISTRICT10--->>p   <parents>
rmdir

2.

cp                                      -a           -l      hard link          -s   symbolic link
rm
mv                               v.s.     rename
basename        dirname

3.

cat            concatenate
tac
nl     number lines of files
more
less                    less is more? no..........oh, yes
head
tail
od        dump files in octal formats...

4.

touch      touch -t 0709150202 bashrc

5.

chattr
lsattr

6.

umask     umask S                                         umask 224

7.

chattr [+-=][ASacdistu] 檔案或目錄名稱
  • A    atime no change
  • S     sync<disc,memory>
  • a      apend - no del or mod
  • c    auto compress&decompress
  • d     no dump when u dump
  • i      immutable-------can't del

8.檔案特殊權限

  • SUID
    • SUID 權限僅對二進位程式(binary program)有效;SUID 僅可用在binary program 上, 不能夠用在 shell script 上面
    • 執行者對於該程式需要具有 x 的可執行權限;
    • 本權限僅在執行該程式的過程中有效 (run-time);
    • 執行者將具有該程式擁有者 (owner) 的權限。
  • SGID
    • SGID 對二進位程式有用;
    • 程式執行者對於該程式來說,需具備 x 的權限;
    • 執行者在執行的過程中將會獲得該程式群組的支援!
      • 使用者若對於此目錄具有 r 與 x 的權限時,該使用者能夠進入此目錄;
      • 使用者在此目錄下的有效群組(effective group)將會變成該目錄的群組;
      • 用途:若使用者在此目錄下具有 w 的權限(可以新建檔案),則使用者所建立的新檔案,該新檔案的群組與此目錄的群組相同。
  • SBIT-Sticky Bit----------like /tmp
    • SBIT 目前只針對目錄有效,對於檔案已經沒有效果了
    • 當使用者對於此目錄具有 w, x 權限,亦即具有寫入的權限時;
    • 當使用者在該目錄下建立檔案或目錄時,僅有自己與 root 才有權力刪除該檔案
  • chmod 4755 filename

9.

file
which(尋找『執行檔』)------------vs---------type
whereis(尋找特定檔案)----------------------------vs------------find
locate    ----------------------------------vs -----------------------find
  • locate:依據 /var/lib/mlocate 內的資料庫記載,找出使用者輸入的關鍵字檔名。
  • updatedb:根據 /etc/updatedb.conf 的設定去搜尋系統硬碟內的檔名,並更新 /var/lib/mlocate 內的資料庫檔案;
find [PATH] [option] [action]
  • find / -mtime 0
  • find /etc -newer /etc/passwd
  • find / -perm +7000
  • find / -perm +7000 -exec ls -l {} \;
posted @ 2013-08-22 11:20  distric10  阅读(72)  评论(0)    收藏  举报