shell基础十二篇_学习笔记_1_chmod_date_chattr
权限命令: chmod
1为运行; 2为可写; 4为只读
所以3为可写可运行;5为可读可运行;6为可读可运行;7为可读可写可运行
我按字面意思理解:
u就是user
g就是group
o就是other
a就是all
所以
chmod 777
chmod a+xwr
chmod ugo+xwr
得到的结果会是一样的.
修改时间命令: date
例如修改为 1999年1月1日 01:01 分 [ 可以精确到秒 ]
date -s “1999/01/01 01:01”
debian:~/test# date
2009年 04月 11日 星期六 16:46:33 EDT
debian:~/test# date -s “1999/01/01 01:01”
1999年 01月 01日 星期五 01:01:00 EST
debian:~/test# date -s “2009/04/11 16:50:00”
2009年 04月 11日 星期六 16:50:00 EDT
锁定文件命令: chattr [ 就算是root用户也无法删除 ]
debian:~/test# ls
temp
debian:~/test# chattr +i temp
debian:~/test# rm temp
rm:是否删除有写保护的 一般空文件 “temp”? Y
rm: 无法删除 “temp”: 不允许的操作
debian:~/test# ls
temp
debian:~/test# chattr -i temp
debian:~/test# ls
temp
debian:~/test# rm temp
debian:~/test# ls
debian:~/test#
A file with the ‘i’ attribute cannot be modified: it cannot be deleted
or renamed, no link can be created to this file and no data can be
written to the file
其实,在linux下,文件的权限属性有10位,第一位表示类型,如:文件夹,链接文件或者块文件和字符文件。后面9位被分成3组,一组3位。这三组依次表示文件所有者,同组用户和其他用户的权限。如果我们用ls -l命令查看,就可以看到诸如drwxr-xr-x这样的字符串,其中r表示读,w表示xie,x表示执行。如果想将一个文件改为所有人可读可写可执行,那么命令是chmod 777。如果只是文件所有者本身对它有读写和执行的权限,其他用户什么权限都没有,那么chmod 700。如果同组用户和所有者有读写权限,没有执行权限,其他用户什么权限都没有,那么就是chmod 660,看出其中的规律了吗?不用死记硬背啦……
回复:哇,谢谢DDR物语的指教!
老大,你的Posts大都非常专业,我们都不理解。
真晕~~~
回复:恶补以前没学的知识呢~
CG因为爱上了Win2K3这个系统之后好长时间没有动过我的Ubuntu了,小桥,我对python确实不太熟悉,C和C 的话你要学习的话,这个没有问题,如果要是不行的话大家一起学习吧,QQ119280977 ,MSN cglory@live.com
回复:okok,已经加了~