原创BLog,转载请注明出处
http://blog.csdn.net/hello_hwc?viewmode=contents
which命令
首先查看man which的说明which - shows the full path of (shell) commands.
[root@localhost testForCsdn]# echo $PATH /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin使用举例
[root@localhost testForCsdn]# which ls alias ls='ls --color=tty' /bin/ls过滤掉alias中的信息
[root@localhost testForCsdn]# which --skip-alias ls /bin/ls
man whereis whereis - locate the binary, source, and manual page files for a command从db中查找系统特定二进制文件,源文件,和manual page文件
updatedb选项
[root@localhost testForCsdn]# whereis init init: /sbin/init /etc/init.d /usr/share/man/man8/init.8.gz
[root@localhost testForCsdn]# whereis -b init init: /sbin/init /etc/init.d
[root@localhost ~]# locate -c init 601 [root@localhost ~]# locate -bc init 486
<pre name="code" class="plain">[root@localhost ~]# locate init | mroe
[root@localhost ~]# find /etc -name init /etc/sysconfig/init
[root@localhost ~]# find testForCsdn/ -size -2048 testForCsdn/ testForCsdn/file.txt testForCsdn/file.softlink testForCsdn/file.hardlink
[root@localhost ~]# find testForCsdn/ -user root testForCsdn/ testForCsdn/file.txt testForCsdn/file.softlink testForCsdn/file.hardlink
min按照分钟为单位
查找一小时内访问过的文件
[root@localhost ~]# find testForCsdn/ -amin -60 testForCsdn/ testForCsdn/file.txt testForCsdn/file.softlink testForCsdn/file.hardlink
[root@localhost ~]# find testForCsdn/ -type l testForCsdn/file.softlink
查找指定inode然后产出
查找指定inode然后删除该文件
find / -inum 15 –exec rm –rf {} \;
7、-a -r
a and[root@localhost ~]# find testForCsdn/ -size -2048 -a -type l testForCsdn/file.softlink
[root@localhost ~]# find testForCsdn/ -size -2048 -a -type l -exec ls -l {} \; lrwxrwxrwx 1 root root 8 Oct 24 20:32 testForCsdn/file.softlink -> file.txt解释下:这里的{}是查找的结果,分号;代表结果。用\进行转义
Grep
附上之前写的一篇链接
Grep的9个经典使用场景
http://blog.csdn.net/hello_hwc/article/details/40017833