You can greatly increase your productivity and efficiency as a Middleware Administrator when you master just a very few critical Unix/Linux commands.
Here are 10 awesome Unix/Linux commands you should master if your infrastructure is unix based.
1. ps -ef
How can this command help me ?
“ps -ef” shows *all* the processes running on your System. It shows good information such as process id, the user running the program, the command line being used to run the program etc. When coupled with grep (ps -ef | grep <my application>), this command can instantly show you whether your application is alive or not.
Example:
karun.subramanian>ps -ef | grep bash
karun.su 5956 9796 pty0 14:06:32 /usr/bin/bash
karun.su 5740 5956 pty0 14:30:49 /usr/bin/bash
karun.subramanian>
2. netstat
How can this command help me ?
netstat shows information about the network sockets. It can be extremely useful as it can instantly show the network activity of your application server.
Example:
netstat -an
-a: Displays all connections and listen ports
-n: Displays numerical IP instead of host names (without this flag, the server will try to resolve the IP to host name and this can be slow)
One powerful option is “-p” where the output will show the process id associated with the socket. For example, if you want to find out which process is using port 8088, you would run the following command
netstat -anp | grep 8088
3. df -k
How can this command help me ?
Shows all the File Systems and their usage in Kilo Bytes. Useful when dealing with ‘File System’ capacity issues.
Example:
df -k
Note: Another useful command when dealing with disk space usage is ‘du‘. I regularly use the command “du -sk *” to find out which directories are reponsible for disk space utilization.
4. traceroute
How can this command help me ?
Shows the network path being taken to reach the given server. Can be useful to find out the network devices present enroute to the destination server.
Example:
traceroute <my host>
5. tcpdump
How can this command help me ?
Captures network packets for analysis. Can be handy to troubleshoot ssl handshake issues, connection resets or connection failure type issues. The output of this command can be analyzed using tools like Microsoft Network Monitor or Wireshark
Example:
tcpdump host <myserver> -w <output file>
6. vmstat
How can this command help me ?
There was a time where I could just glimpse the output of vmstat and tell what’s the problem with the system. vmstat (virtual memory statistics) shows critical Server performance info such as CPU runqueue, Memory pages scan rate, IO waits etc
Example:
vmstat 2 20
(Take vmstat at 2 seconds interval for 20 minutes.)
7. find
How can this command help me ?
Find is a powerful command to search File system for files/directories.
Example:
find . – Displays all the files and directories from the current directory onwards (traverses sub directories)
find /mydir -name “*.dmp” – Displays all the files and directories whose names end with “.mp” under /mydir
8. kill
How can this command help me ?
Terminates processes. For example, when the Application Server does not respond to the usual shutdown commands, you will have to terminate it forcefully and ‘kill’ is the command you would need.
Example:
kill -9 <process id>
-9 will forcefully terminate the process – it is ugly but sometimes you will have to do this.
9. top
How can this command help me ?
Extremely useful performance monitoring tool. ‘topas’ in IBM AIX. For example, if you want to find out if you are running out of CPU or Memory, you would launch top.
Example:
top
10. vi
How can this command help me ?
Either you love it or hate it. The truth is ‘vi’ is a very versatile text editor – once you learn few basic things, and with some practice, vI will become second nature to you.
Examples:
vi
Esc i – Start typing text
Esc k – Move cursor one line down
Esc j – Move cursor one line up
Esc l – Move cursor one character right
Esc h – Move cursor on character left
(Note: Esc key toggles between input mode and command mode)
Esc :wq – Save and exit
Esc : q! – Exit without saving
There you have it. While Unix commands are numerous and their switches/options are countless, mastering just above commands will take you a long way.
To learn more about these commands, use the man page:
man <command>
Enjoy
please share me new commands daily
Its is very usefull for me and still more command i am excepting form you