Cheatography
https://cheatography.com
netstatnetstat -atnup | My all time classic, see below for details. | netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | awk '{ printf("%s\t%s\t",$2,$1) ; for (i = 0; i < $1; i++) {printf("*")}; print "" }' | Graph the number of connections for each host |
a: Show both listening and non-listening,
t: Show TCP,
n: Show numerical addresses instead of trying to determine symbolic host, port or user names,
u: Show UDP,
p: Show the PID and name of the program to which each socket belongs.
tailftailf <file> | Output the last 10 lines of a file | tailf -n 5 <file> | Output the last 5 lines of a file |
You have to use tail if you want to follow more than one file:
tail -f /var/log/tomcat/foobar.log -f /var/log/catalina.out
dfdf -h | Show filesystem usage in human-friendly format | df -i | Show inode usage | df -l | List only local filesystems (don't list NFS or SAMBA mounts) |
More info about inodes: Check this doc !
iostatiostat -x 5 | Display full statistics for every filesystem, refresh every 5 seconds |
The first report line provides statistics concerning the time since the system was started.
| | toptop | Display Linux tasks | top -p $(pgrep -d , foobar) | Monitor processes with the same name fragment 'foobar' |
Some interactive commands
h: display help
c: toggle between process name only / full command line
u: show the processes for a specific user only
n: display a maximum of n processes
k: kill a process
H: show threads (also called Light Weight Processes)
z: toggle between monochrome and color display
psps -ef | See every process on the system | ps -ejH | Print a process tree | ps -eLf | Get info about threads | ps -C java -o pid= | Print only the process IDs of apache tomcat | ps -o nlwp <PID> | Show the threads (Light Weight Processes) associated to a PID. |
Shell keyboard shortcutsCtrl + a | Jump to the beginning of the line () | Ctrl + e | Jump to the end of the line () | Ctrl + l | Clears the screen | Ctrl + r | Lookup a command in history | Alt + . | Recalls last argument. |
|
Created By
https://tme520.com
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by TME520