Posts

Showing posts with the label find

How to find word in Linux

●     Search and list all files from current directory and down for the string ABC: find ./ -name "*" -exec grep -H ABC {} \; find ./ -type f -print | xargs grep -H "ABC" /dev/null egrep -r ABC * ●     Find all files of a given type from current directory on down: find ./ -name "*.conf" –print ●     Find all user files larger than 5Mb: find /home -size +5000000c -print ●     Find all files owned by a user (defined by user id number. see /etc/passwd) on the system: (could take a very long time) find / -user 501 -print ●     Find all files created or updated in the last five minutes: (Great for finding effects of make install) find / -cmin -5 ●     Find all users in group 20 and change them to group 102: (execute as root) find / -group 20 -exec chown :102 {} \; ●     Find all suid and setgid  executable : find / \( -perm -4000 -o -perm -2000 \) -type f -...

Useful Commands in Linux and centos

Image
/home full issue(creating disk space) find /home/*/ -name .trash | xargs rm -rf ================== changing permission for file only find . -type f -exec chmod 644 {} \; for directory find . -type d -exec chmod 775 {} \;  find /home/*/public_html -iname '*.mp3' -exec mv "{}" /home/delete \;  find /home/*/public_html -iname 'backup-' -exec mv "{}" /home/delete \; ================== How  know the hard drive speed ( this will check how fast the sites are resoving also) Use /dev/hda or /dev/sda or what ever is the drive in the server: hdparm -tT /dev/hda This command will show results like: /dev/hda: Timing cached reads:   8808 MB in  2.00 seconds = 4406.87 MB/sec Timing buffered disk reads:  162 MB in  3.03 seconds =  53.44 MB/sec If the second measurement is under 40MB/sec, the server is too slow and needs a hardware checkup Monitoring the system: Basic command line: pstree Pro...