Linux learning: find command problem

  

1. Find the /var directory owner is root, and all files belonging to the group mail

1 2

[root@www ~]# Find /var \\( -user root -a -group mail \\) -ls 132134 4 drwxrwxr-x 2 root mail 4096 September 12 13:55 /var/spool/mail

2. Find the /usr directory All files that are not root, bin, or hadoop

1 2

[root@www ~]# find /usr ! \\( -user root -o -user bin -o -user Hadoop \\) -exec ls -l {} \\; -rwsr-xr-x. 1 abrt abrt 10296 July 25 00:08 /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache

3. Find all files whose contents have been modified in the /etc directory and whose owner is not root or hadoop


1 2

[ ,null,null,3],Root@www ~]# find /etc ! \\( -user root -o -user hadoop \\) -mtime -7 -exec ls -l {} \\; -rw-r--r--. 1 bash root 0 September 12 13:46 /etc/find_lab/find.txt

4. Find all files that have no owner or group on the current system and have been visited in the last week

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

[root@www ~]# find /-atime -7 -a \\( -nouser -o -nogroup \\) -ls 131305 0 -rw-rw---- 1 507 mail 0 September 12 13:55 /var/spool/mail/rainman find: “/proc/16541/task/16541/fd/5”: No such file or directory Find: “/proc/16541/task/16541/fdinfo/5”: No such file or directory find: “/proc/16541/fd/5”: No such file or directory find: “/proc/16541 /fdinfo/5”: No such file or directory 430089 4 -rwxr--r-- 1 507 abc 21 September 11 13:33 /lab/readme.txt 39 4 drwx------ 4 507 507 4096 9 Month 12 13:55 /home/rainman 40 4 -rw-r--r-- 1 507 507 18 July 24 02:55 /home/rainman/.bash_logout 41 4 drwxr-xr-x 2 507 507 4096 November 12 2010 /home/rainman/.gnome2 47 4 -rw-r--r-- 1 507 507 500 November 27 2014 /home/rainman/.emacs 46 4 -rw-r--r-- 1 507 507 176 Jul 24 02:55 /home/rainman/.bash_profile 45 4 -rw-r--r-- 1 507 507 124 July 24 02:55 /home/rainman/.bashrc 42 4 drwxr-xr-x 4 507 507 4096 August 17 19:31 /home/rainman/.mozilla 43 4 drwxr-xr-x 2 507 507 4096 August 18 2010 /home/rainman/.mozilla/plugins 44 4 drwxr-xr-x 2 507 507 4096 August 18 2010 /home/rainman/.mozilla/extensions

5. Find /etc All files larger than 20K and of type common file

1 2 3 4 5 6 7 8 9 10 11

[root@www ~]# find /etc -type f -size +20k -exec ls -l {} \\; | Head -n 10 -rw-r--r--. 1 root root 27223 November 12 2010 /etc/sound/events/gnome-2.soundlist -rw-r--r--. 1 root root 34419 March 4 2015 /etc/httpd/conf/httpd.conf -rw-r--r--. 1 root root 21214 June 16 2014 /etc/dnsmasq.conf -rw-r--r--. 1 root root 23173 November 21 2014 /etc/gimp/2.0/gimprc -rw-r--r--. 1 root root 29853 April 10 00:44 /etc/sysconfig/network-scripts/network-functions-ipv6 -rw-r --r--. 1 root root 45016 November 11 2010 /etc/gconf/schemas/compiz-decoration.schemas -rw-r--r--. 1 root root 49322 November 11 2010 /etc/gconf/schemas /compiz-wall.schemas -rw-r--r--. 1 root root 148031 November 11 2010 /etc/gconf/schemas/gok.schemas -rw-r--r--. 1 root root 31365 November 11 2010 /etc/gconf/schemas/gedit.schemas -rw-r--r--. 1 root root 32382 March 14 2012 /etc/gconf/schemas/gweather.schemas

Copyright © Windows knowledge All Rights Reserved