UnixServerAdmin

Server Administration & Management

Commands

1. # netstat -tulpn | grep :80

2. # fuser 7000/tcp [Find out the processes PID that opened tcp port 7000]

3. # ps ax | grep httpd | wc -l

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

5. # netstat -ant | awk ‘{print $NF}’ | grep -vE ‘[:upper:]’| sort | uniq -c | sort -rn

6. # netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

7. # wc -l /proc/net/ip_conntrack

8. # history | awk ‘{print $2}’ | sort | uniq -c | sort -rn | head [List the most used commands in your history]

9. # cat /etc/domainusers | wc -l [Main Domain of Server]

10. # /ls /var/named/ | wc -l [Total Domain of Server]

11. # ps aux | awk ‘{print $2, $4, $11}’ | sort -k2rn | head -n 20 [List running processes ordered by RAM usage]

12. # netstat -nap | grep SYN [Synflood Attack]

13. # netstat -nap | grep SYN | wc -l [Synflood Attack]

14. # echo 1 > /proc/sys/vm/drop_caches [Flash RAM Memory]

15. # /bin/sed ‘s/(.*)(: )(.*)/3: 1/’ </etc/domainips | /bin/sort >/etc/domainips_reverse [command to create reverse IP for an domain]

Advertisements

January 13, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | 2 Comments