MENU

linux常用命令课程002

March 7, 2018 • Read: 3943 • 课程笔记

`which aming`    搜命令,局限于PATH
`whereis ls`     局限于目录内
`locate` ,可能会没有  `yum install -y mlocate`  安装一下

`locate`安装用到库是mlocate   updatedb  生成数据库,这个文件会在凌晨4点自动执行
locate 不会把tmp下的临时文件计算在内
`find /root -type f`  搜索root下所有的文件,包括隐藏的
`find /root -type d`  root下所有的目录
`find /root -name "test"` 精确搜索
`find /root -name "*.txt"` 搜索所有的后缀为txt的文件
`find /root name "*txt" -mtime -5`  搜索5天以内的txt文件
`find /root name "*txt" -mtime +5`  搜索5天以前的txt文件
`find /root name "*txt" -mmin -60 |xargs ls -l` 
`find /root name "*txt" -mmin -60 -exec ls -l {} \;`

`atime  ctime  mtime`            查看  修改  大小
`echo "abcderfsfd" >> 3.txt`     追加内容到3.txt里面
`stat 3.txt |tail 4`             查看3.txt最后3行

`find /etc/init.d -type d` 
`find /etc/init.d/ ! -type d `      ! 取反

`ln -s /root/3.txt /tmp/21.txt`    把3.txt创建软连接到tmp下,并重命名为21.txt   使用绝对路径
`pwd -P` 物理地址
`PWD =L` 逻辑地址

兼总条贯 知至知终

最后编辑于: May 11, 2018