Basic diagonsis commands

Basic diagnosis commands in solaris and in linux

1. To check icmp request

ping -s hostname (Solaris)

2. To view load, cpu usage and memory usage

top and press M (Linux)

prstat or prstat -a (Solaris)

ps -eo pcpu,pid,user,args| grep process | sort -r -k1

3. To view size of physical memory

free -m

prtconf -pv | grep Memory

4. To view cpu information

more /proc/cpuinfo

psrinfo

5. To view info about particular port or open session on a port or routing table

netstat -ntpl [linux]

netstat -f inet -an|grep LISTEN [view the list of port open on the host]

netstat -an| grep ‘ESTABLISHED’ [view different conn established on different port]

netstat -an| grep ‘ESTABLISHED’| grep ‘ip.port’ [same as above]

netstat -nr [view routing table]

6. To check wheter port is alive or not

telnet ip port

7. To compress or uncompess a file

gzip filename

gunzip -c file.gz| tar xvf –

tar zxf file.tar.gz or gtar zxf file.tar.gz

8. To determine route of a request

traceroute <ip or hostname>

9. To view a particular process is running or not and its argument

ps -ef | grep process

pargs <PID>

10. Remove or replace with find

find . -name ".mp3" -exec rm -f {} \; [find the .mp3 file and then remove them]

find ./ -name ‘*.clm’ -exec mv {} {}\.txt \; [find all .clm file & then move all to .txt]

11. Matching pattern using grep

grep abc /etc/passwd [match whether ‘abc’ exists or not]

grep -R -l ‘clamav’ /usr/share/doc [List the file names of all files that contains clamav under /usr/share/doc ]

grep "2008-07-17\ 13:[1-5][0-9]:[0-5][0-9]" [Matching lines using regular expression]
Advertisements

2 Responses to “Basic diagonsis commands”

  1. sandrar Says:

    Hi! I was surfing and found your blog post… nice! I love your blog. 🙂 Cheers! Sandra. R.

    • Sheikh Jafar Tarique Says:

      Thanks Sandra. I am glad that you find it helpful .. sorry for the late reply .. anyway what do you do?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: