Sunday, May 8, 2011

Some useful Linux/Unix Commands

Some useful Linux/Unix Commands
 Check the forms version:
strings -a $AU_TOP/forms/US/sachin_test.fmb | grep '$Header'
strings -a $SACHIN_TOP/forms/US/sachin_test.fmx | grep '$Header'

 Install our own script
install -c /usr/local/bin

 List the information for partitions
[root@erp ~]# parted -l

 Monitor backup in RHEL 5
[root@erp ~]# watch df -m

 Check the size of a directory
[root@erp ~ ]# du -sch .

 Monitor rapid clone
[root@erp ~]# tail -f file_name_with_location

 Check the last updated file name on current location
[root@erp ~]# ls -lrt | tail -1
-rwxr-xr-x 1 root dba 41 Feb 22 01:33 new2.sh

 Get the CPU info
[root@erp ~]# vi /proc/cpuinfo
[root@erp ~]# vi /proc/slabinfo

 Remove the last updated file
[root@erp ~]# ls -lrt | tail -1| awk ‘{print $9}’|xargs rm -f

 Check the server up time
[root@erp ~]# uptime

 Get the Information about memory
[root@erp ~]# vmstat
[root@erp ~]# vmstat -m

Alternatively ,we can check with the following command.
[root@erp ~]# iostat -t 10 5

 Search and remove files
$find . -name file_name | xargs -i rm -rf {}

 Top 10 file regarding there size:
find . -type f | xargs ls -s | sort -rn | awk ‘{size=$1/1024; printf(“%dMb %s\n”,
size,$2);}’ | head
or
du -xak . | sort -n | awk ‘{size=$1/1024; path=”"; for (i=2; i 50) { printf(“%dMb
%s\n”, size,path); } }’
or
du -a /var | sort -n -r | head -n 10

 Delete the files by Month
ls -lh | awk ‘{print $6 ” ” $9}’ | sed -n ‘/Mar/p’ | xargs rm -rf



--------------------------------------------------------------------------------------------

No comments:

Post a Comment