Linux One Liners

Linux One Liners

To find a list of all Open Ports
$ netstat -tulpn

Linux Disk Utilization Command
$ vmstat -D

Which Shell are you in?
$ ps -p $$

Number of http connections from an IP
$ netstat -nut | awk '{print $5}' | cut -d : -f1| sort | uniq -c | sort -n

To find current working directory of a PID
$ pwdx [pid]

To format a drive to ext3
$ mkfs.ext3 [device_name]

To know when the server was last rebooted
$ last reboot

To know when the server was last Shutdown
$ last -x shutdown

Removing Semaphores for Apache
$ ipcs -s | grep nobody | perl -e 'while (<stdin>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

Leave a Comment