第一分部 Shell基礎編程(1—7章)
第一章 Linux Shell 簡介
什么是Shell
存取權限和安全
Shell簡單腳本
Shell特性
Shell是核心程序(kernel)之外的指令解析器,是一個程序,同時是一種命令語言和程序設計語言。
Shell的類型:ashbashkshcshtcsh
--/etc/shells
--echo $SHELL
文件和目錄的權限(-rwxr--r--)
程序在Shell中運行
Shell中可運行子Shell
1.2存取權限與安全
文件和目錄的權限(-rwxr--r--)
setuid(suid/guid)(chmod u+s,g+s file)
umask(umask nnn)
符號鏈接(ln [-s] source_path target_path)
chmod [who] operator [permission] filename
who(u,g,o,a)
operator(+,-,=)
permission(r,w,x,s,t)
實例:
#chmod u+s myfile
表示執行這個文件時,是以擁有者身份來執行的。
#chmod u+t myfile
表示執行這個文件時,是放在緩存里執行。
#ls -l /bin | grep '^...s'
查找據有S權限的文件。
chmod mode filename
mode
-r --4
-w --2
-x --1
chmod 664 myfile
chmod 740 myfile
實例:
#chmod 4744 myfile
表示u+s,再744。g+s,6744。o+t,7744。
chown和chgrp
chown [-R] owner myfile //表示整個目錄的擁有者都改變。
chown owner.group myfile //表示擁有者和組都改變。
chown.group myfile
chgrp [-R] group myfile
umask
/etc/profile($HOME/.profile
$HOME/.bash_profile)
umask
實例:
#umask
022(代表了u,g,o)
|
|