Wednesday 4 January 2012

Linux Find Commands, Find commands in Ubuntu


1.      find
·         Find all lib files greater than 100 KB in /lib
·         find /lib -size +100k
·         This will print many file you can view smoothly by pressing ENTER just append “|more” with the command

·         Find all files which are smaller than 200 bytes
·         find -size -200b
·         There is no path specified so we can optionally specify path as current directory “.”

·         Find all symbolic links in /lib
·         find /lib -type l OR find -lname “*”
·         Both commands find the symbolic links. You prove by just “ls -l” any of the link.

·         Find all files which have been modified in last 24 hours
·         find -mtime 1
·         mtime used to find the updated files in days and if we want to see files with 36 hours, we have to find files which modified two days before by –mtime or calculate minutes and find files by –atime flag.

·         Find the file “cpuinfo” and print its first lines using “head” in the same command
·         sudo find / -iname ‘cpuinfo’ -exec head -1 {} \;
·         -name is case sensitive whereas –iname is case insensitive. –exec produeces new process and gets the results of the parent command in {} and ends with \.

·         Find your group name and ID, and search all files which belong to your group using group name and ID
·         id;    find -user 1000 -group 1000;
·         You can specify numeric userid and group as well as alphabetic names.

·         Find all files which have “.so” in their names using regular expressions
·         Find -iname “*.so”
·         * is the regex used for “all”

0 comments:

Post a Comment

 
Free Host | lasik surgery new york