实验楼学习笔记---linux基础命令

启动计划任务

 

#sudo cron -f &   #启动计划任务
#crontab -e       #编辑当前用户计划任务
#sudo crontab -e #编辑root用户计划任务

 

#cut /etc/passwd -d ':' -f 1,6       #查询并打印passwd文件中用户名及其家目录
#cut /etc/passwd -c 2-5             #打印passwd文件每行中第2-5行(包含第5)的内容
#cut /etc/passwd -c -5               #打印passwd文件每行中第1-5行(包含第5)的内容
#cut /etc/passwd -c 5-               #打印passwd文件每行中第5行之后(包含第5)的内容

 

# export | grep ".*yanlou$"          #查看环境变量中以“yanlou"结尾的内容

 

#wc /etc/passwd                      #统计passwd文件行数,单词数,字节数

 

#ls -d /etc/*/ | wc -l               #统计/etc下的目录数量

 

#cat /etc/passwd | sort -t':' -k 3 -n       #查看passwd,以“:”分割的第三列排序(第三列为数字,所以加上-n,默认按照字母顺序排序)

 

# 输出重复过的行(重复的只输出一个)及重复次数
$ history | cut -c 8- | cut -d ' ' -f 1 | sort | uniq -dc
# 输出所有重复的行
$ history | cut -c 8- | cut -d ' ' -f 1 | sort | uniq -D

 

猜你喜欢

转载自www.cnblogs.com/gzhm/p/12172412.html