Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I use the following command to find file size which is over 100MB on root filesystem.
# find / -size +102400k -exec du -hs {} \;
The command above will search /shared_fs. But I do not want to search /shared_fs because many small files is under /shared_fs. So, I wonder whether there is a way to exclude search path from find command. Now,
I am using the following command but the following command just limit the
command output not to show the files beginning with /shared_fs. Any better idea?
# find / -path /opt -prune -o -size +10240k -exec du -hs {} \;
13M /usr/share/fonts/zh_TW/TrueType/bsmi00lp.ttf
21M /usr/share/comps/i386/hdlist2
28M /var/lib/rpm/Packages
20G /home/com/com/top.log
31M /share/savlinux/talpa/talpa-redhat/combined.tgz
11M /share/savlinux/talpa/talpa-ubuntu/combined.tgz
32M /share/savlinux/talpa/talpa-suse/combined.tgz
17M /share/savlinux/talpa/talpa-asianux/combined.tgz
897M /proc/kcore
find: /proc/20994/task/20994/fd/4: No such file or directory
-path is my desired command option, thank u. I also have a problem
if I can use -path to exculde multiple directories for search list.
For example, I want to search all files > 10MB but /proc and /opt is not needed to find. Is there a way to do it.kindly please advise.
I also tried to find the file modified within last day by the following command. I found if I do not use -type f option, find command output will give me some un-desired result as the second command output. I wonder what the reason is. Any Advices?
<1> # find / \( -path /proc -o -path /sys \) -prune -o -type f -daystart -m time -1 -exec ls -al {} \;
-rw-r--r-- 1 ntp ntp 8 May 17 02:03 /var/lib/ntp/drift
-rw-r--r-- 1 root root 871 May 17 02:33 /var/lib/nfs/rmtab
-rw------- 1 root root 133187 May 17 02:33 /var/log/messages
-rw------- 1 root root 22095 May 17 02:01 /var/log/cron
-r-------- 1 root root 292876 May 17 01:15 /var/log/lastlog
-rw-rw-r-- 1 root utmp 384 May 17 01:15 /var/log/wtmp
-rw------- 1 root root 214 May 17 01:15 /var/log/secure
-rw-rw-r-- 1 root utmp 4608 May 17 01:15 /var/run/utmp
<2> # find / \( -path /proc -o -path /sys \) -prune -o -daystart -mtime -1 -exec ls -al {} \;
total 20
drwxr-xr-x 2 ntp ntp 4096 May 17 02:03 .
drwxr-xr-x 23 root root 4096 Jun 3 2008 ..
-rw-r--r-- 1 ntp ntp 8 May 17 02:03 drift
-rw-r--r-- 1 ntp ntp 8 May 17 02:03 /var/lib/ntp/drift
total 36
drwxr-xr-x 4 root root 4096 May 17 02:33 .
drwxr-xr-x 23 root root 4096 Jun 3 2008 ..
-rw-r--r-- 1 root root 334 Mar 19 10:32 etab
-rw-r--r-- 1 root root 0 Jul 11 2008 export-lock
-rw-r--r-- 1 root root 871 May 17 02:33 rmtab
drwxr-xr-x 7 root root 0 Mar 19 10:31 rpc_pipefs
drwx------ 4 rpcuser rpcuser 4096 Jun 2 2008 statd
-rw------- 1 root root 0 May 24 2006 state
-rw-r--r-- 1 root root 0 Mar 19 10:32 xtab
-rw-r--r-- 1 root root 871 May 17 02:33 /var/lib/nfs/rmtab
-rw------- 1 root root 133187 May 17 02:33 /var/log/messages
-rw------- 1 root root 22095 May 17 02:01 /var/log/cron
-r-------- 1 root root 292876 May 17 01:15 /var/log/lastlog
-rw-rw-r-- 1 root utmp 384 May 17 01:15 /var/log/wtmp
-rw------- 1 root root 214 May 17 01:15 /var/log/secure
-rw-rw-r-- 1 root utmp 4608 May 17 01:15 /var/run/utmp
crw-rw-rw- 1 root tty 5, 2 May 17 02:49 /dev/ptmx
crw--w---- 1 com tty 136, 1 May 17 02:49 /dev/pts/1sdfsdf
If you don't use -type f, the find command will return also the directories modified in the last day and their content will be listed from -exec ls -al.
Take in mind that the modification time of a directory depends on the time stamp of the more recent file. If one of these files have been modified in the last day, the directory has been modified as well and the find commands find it. Hence, executing
Code:
ls -al /path/to/dir
lists the content of the directory as usual (older files included).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.