首页 > 代码库 > linux 常用命令 之文件收索

linux 常用命令 之文件收索

命令名称: find 

  317  find /etc  -name  iniy
  318  find /etc -name servi*
  319  find /etc -name init???
  320  find /etc -iname init???
  321  find / -size +204800 #1个数据快是512 字节 是0.5k
  322  find /home -user test
  323  find /etc/ -cmin -5
  324  find /etc/ -cmin -30
  325  find /etc/ -size +163840 -a -size -204800
  326  find /etc -name init* -a -type f
  327  find /etc -name init* -o -type f
[root@localhost tmp]# find . -inum 1

命令名称:locate

 获得文件路径

在文件资料库找查找,并不是进行硬盘查找,/tmp 目录下updatedb也无法查找

[root@localhost ~]# locate *init
/bin/redhat_lsb_init
/etc/rc.sysinit
/etc/X11/xinit
/etc/pam.d/run_init
/etc/rc.d/rc.sysinit
/etc/security/namespace.init
/etc/sysconfig/init
/sbin/capiinit
/sbin/init
/sbin/telinit
/usr/bin/msginit
/usr/bin/xinit
/usr/kerberos/bin/kinit
/usr/kerberos/bin/krb524init
/usr/sbin/capiinit
/usr/sbin/run_init
/usr/share/doc/pam-0.99.6.2/txts/README.pam_keyinit
/usr/share/doc/rp-pppoe-3.5/adsl-init
/usr/share/logwatch/scripts/services/init
/usr/share/system-config-netboot/diskless/diskless.init
[root@localhost ~]# touch byf
[root@localhost ~]# locate byf
[root@localhost ~]# find byf
byf
[root@localhost ~]# updatedb 
[root@localhost ~]# locate byf
/root/byf
[root@localhost ~]# locate -i BYF
/root/byf
[root@localhost ~]# 


命令名称:which、whereis

得到命令存放在那个文件,针对命令

[root@localhost ~]# which cp
alias cp='cp -i'
        /bin/cp
[root@localhost ~]# which adduser
/usr/sbin/adduser
[root@localhost ~]# 


命令名称: grep

查找文件内容,也就是关键字

 

  352  grep -i  multi* /etc/inittab
  353  grep -v *a*  /etc/inittab
  357  grep -v ^# /etc/inittab



linux 常用命令 之文件收索