Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19854
  • 博文数量: 11
  • 博客积分: 50
  • 博客等级: 民兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-22 09:38
文章分类
文章存档

2012年(11)

我的朋友
最近访客

分类: Python/Ruby

2012-08-11 11:17:01

子曰:“温故而知新,可以为师矣”,通过一些示例,力求简洁,来对前一阶段的学习进行回顾。
(持续复习中。。。。)
下面这些命令,都知道是什么含义,那复习的效果就达到了。哈哈。。。努力,加油。

(一)第一阶段
$pwd                  
$ls -al
$su zwh
$chmod u+rwx,g+rw,g-x,o+r,o-wx myfile     
$chmod 764 myfile
$chmod -R 764  ./dir/*.txt
$chmod 4711 myfile
$chmod 6711 myfile
$chmod u+s,g-s myfile
$ls -l | grep '^...s'
$ls -l | grep '^...s..s'
$chown -R -h  owner myfile
$chgrp -R -h admin myfile
$id
$group
$group admin
$umask
$umask 002
$ln -s source_file target_file

(二)第二阶段
$find . -name "*.txt" -print
$find . -name "[abc][a-z][a-z][0-9][0-9].txt" -print
$find . -perm 711 -print
$find /test -path /test/dir1 -prune  -o -print
$find . -path ./dir1 -prune  -o  -print
$find . -path ./dir1 -prune  -o -name "a.txt" -print
$find . -path ./dir1 -prune  -o -name "*.txt" -perm 644 -print
$find . \( -path ./dir1 -o -path ./dir2 -o -path ./dir3 \)  -prune  -o -print
$find . \( -path ./dir1 -o -path ./dir2 -o -path ./dir3 \)  -prune  -o -name "*.txt" -perm 644 -print
$find . -user zwh -print
$find . -nouser -print
$find . -group -zwh -print
$find . -nogroup -print
$find . -mtime +5 -print   (5天)
$find . -mtime -5 -a -mtime +1 -print
$find . -newer a.txt ! -newer c.txt -print
$find . -type d -print
$find . -type f -print
$find . -type l -print
$find . -size +256c -print   (256字节)
$find . -size +256 -print     (256块,每块的大小随系统而不同,通常1块=512字节)
$find . -depth  -name "*.txt" -print
$find . -name "c.txt" -ok rm {} \;
$find . -name "c.txt" -exec rm {} \;
$find . -name "a.txt" | xargs grep "aaa*"
(三)第三阶段
#crontab -u zwh e
$crontab -e
$crontab -l
$crontab -r
crontab条目:分<>时<>日<>月<>星期<>要执行的命令,其中<>为空格
1,15,30,45 18-21 * * /bin/find -name "*logs" -exec rm {} \;
1,2,3 * * * * /bin/echo `date` > /dev/pts/4
$at 21:30 -f /apps/bin/db_back.sh
$at 21:30
at>find /etc -name "passwd" -print
at>
$echo find /etc -name "passwd" -print | at now + 1 minute
$at -l
$atrm job 3
$find /etc -name "passwd" -print >find.dt 2>&1 &
说明:&命令把作业放到后台执行,形式:命令 &
$ps x | grep 29271
$kill 29271
$nohup ps1 &
$nohup ./quarterend > qtr.out 2>&1 &

(四)第四阶段
*匹配文件名中任何字符串
?匹配文件名中任何单个字符
[...]匹配方括号[]中任何字符
[a-z]a到z之间任意字母
[0-9]0到9之间任意数字
[!0-9]非数字
$find . name "[a-z][a-z][a-z][0-9].log" -print
阅读(820) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~