Some Tips

Posted: May 2, 2013 in General linux

1. To check the CPU usage of the process running

ps -e -o pcpu,cpu,nice,state,cputime,args –sort pcpu | sed ‘/^ 0.0 /d’

2. To check whether any Zombie process are running

ps aux | awk ‘{ print $8 ” ” $2 }’ | grep -w Z

3. To store all the processes both parent and child in a file sample.txt

pstree -paul >sample.txt

4. To check the files with GB size under /backup/cpbackup

ls -lsh ./*/* |grep G

5. To exclude particular directory or file.

Step 1: Create cpbackup-exclude.conf in the user home directory.

/home/user/cpbackup-exclude.conf

Step 2: Add the files u need to exclude in that file.

Step 3: If u need to add directory dont add a trailing slash at the end it will exclude all files from directory.

6. To check Which are IP’s listening mostly to port x(example :80):

netstat -plan |grep :80|awk ‘{print $5}’ |cut -d: -f1 |sort |uniq -c |sort -n

7.To display history without line numbers:

history | perl -i -pe ‘s/^([ ]*)([0-9]*)(.*)$/$3/gi’

8. To display the date range for a site’s certs

openssl s_client -connect http://www.google.com:443 &0 |openssl x509 -dates -noout

9. To verify whether the RSA private key and certificate match you can use the following command

Save the key file as key.txt and certificate file as crt.txt

openssl rsa -modulus -noout -in key.txt | openssl md5 > key.out

openssl x509 -modulus -noout -in crt.txt | openssl md5 > crt.out

Now check both file are same using the following command:

diff key.out crt.out

Advertisements

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