My Software Universe Cheat Sheet
- 1 minList of useful commands for all technologies I regularly use.
Content:
JVM
Show running Java processes:
jpsShow thread stack trace for Java process:
jstack <PID>Every 500ms print GC cause of the running JVM process
jstat -gccause <PID> 500msRemote debugging
java -agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=nShell
misc
Show all process as a tree
ps ufaxShow processes listening on ports
sudo netstat -lneutpWatch file size of the file
watch du -sh file.txtFind text in files
find . -name "*.txt" -exec grep -n -H "text" {} \\;netcat
listen on specific port and forward output to the file
nc -l 5555 > output.rawconnect to host and port and send some text
nc localhost 5555
> Hello World!tcpdump
Sniff communication on localhost interface (lo) and port 5555 and write it to the file
tcpdump -i lo -w recording.pcap port 5555awk
Remove empty lines from a file
awk 'length($0) > 0 {print $0}' file_with_blanks > new_file_wo_blanksPrint first column but wrap value in double quotes
head file.csv | awk -F\; '{print "\x22"$1"\x22"}'sed
Escape quotes in the file $f
sed 's/\"/\\\"/g' $fTmux
Set start directory for current tmux session Press Ctrl+B, : and then write attach -c /path/to/start/directory
Rename current session: Ctrl+B, $
AWS CLI
List all instances with the project tag set to <value>
aws ec2 describe-instances --filters "Name=tag:Project,Values=<value>" --output text --query 'Reservations[*].Instances[*].[ImageId,State.Name,PublicIpAddress,Tags[*]]' | column -t