Some useful and tricky UNIX commands
1) Global Replacement Commant in vi :- 1,$s/xyz/abc/g
2) For alligning of the content in vi :- set noai nosm (no auto intended and no show match)
3) Shutdown from remote command prompt :- shutdown -t 00 (Windows)
4) To see blocked session in windows :- qwinsta \Server:100.1.2.100 (windows)
5) how to extract cpio file :- cpio -icdmv #greater than symbol # # file_name #
6) To find which PID using port :- lsof -i TCP:portno or lsof -i tcp | grep #portnumber#
7) To find IP address of server :- netstat -in
8) To Find files "generated/modified" today and remove them from unix :-
ls -ltr | awk '{print $7 " " $9}' | grep -w `date "+%d` | awk '{print $2}' | xargs rm
9) To find the files containing a specific string :- Find . –type f –print | xargs grep “vinay”
10) To get ram/os details on HP :- /usr/contrib/bin/machinfo
11) To get disk details on HP :- ioscan -fnkC disk
12) To find a file larger then the 10GB :- find /u01/soft -type f -size +1048576
13) How to use ldapbind :-
ldapbind -h 100.1.2.100 -p 389 -D "cn=testuser,cn=Users,dc=testworld,dc=com" -w #password#
14) To Check disk group information :- ls /etc/lvmtab
15) To Check the status of disk groups obtained from above :- # vgdisplay vg00
# cmviewcl
16) To run a package on HP-UX :- cmrunpkg -v tnetappl
17) To find whole processes running on server :- ps -eaf | grep #process-name or any key string#
18) To find a free port available on the server :- netstat -na | grep #portno#
19) To take a tar backup :- tar -cvf #source_name# #file_name.tar#
20) To extract a tar backup :- tar -xvf #file_name.tar#
2) For alligning of the content in vi :- set noai nosm (no auto intended and no show match)
3) Shutdown from remote command prompt :- shutdown -t 00 (Windows)
4) To see blocked session in windows :- qwinsta \Server:100.1.2.100 (windows)
5) how to extract cpio file :- cpio -icdmv #greater than symbol # # file_name #
6) To find which PID using port :- lsof -i TCP:portno or lsof -i tcp | grep #portnumber#
7) To find IP address of server :- netstat -in
8) To Find files "generated/modified" today and remove them from unix :-
ls -ltr | awk '{print $7 " " $9}' | grep -w `date "+%d` | awk '{print $2}' | xargs rm
9) To find the files containing a specific string :- Find . –type f –print | xargs grep “vinay”
10) To get ram/os details on HP :- /usr/contrib/bin/machinfo
11) To get disk details on HP :- ioscan -fnkC disk
12) To find a file larger then the 10GB :- find /u01/soft -type f -size +1048576
13) How to use ldapbind :-
ldapbind -h 100.1.2.100 -p 389 -D "cn=testuser,cn=Users,dc=testworld,dc=com" -w #password#
14) To Check disk group information :- ls /etc/lvmtab
15) To Check the status of disk groups obtained from above :- # vgdisplay vg00
# cmviewcl
16) To run a package on HP-UX :- cmrunpkg -v tnetappl
17) To find whole processes running on server :- ps -eaf | grep #process-name or any key string#
18) To find a free port available on the server :- netstat -na | grep #portno#
19) To take a tar backup :- tar -cvf #source_name# #file_name.tar#
20) To extract a tar backup :- tar -xvf #file_name.tar#
Comments