Rails Devops Cheatsheet
A collection of command line tips and time-saving snippets curated by Rubytune
Not all snippets work on all distros! Boo! Make sure you know what you are doing!
You might have to apt-get/homebrew/etc. Corrections and tip-offs to
Download the PDF
All processes, with params + hierarchy
Show all ruby-related PIDs and processes
What is a process doing?
What files does a process have open?
(also nice to detect ruby version of a process)
Flavors of kill
Keep an eye on a process
How much mem is free?
Learn how to read output
Are we swapping?
First line is avg since boot
List the top 10 memory hogs
Detect OOM and other bad things
Disable OOM killer for a process
Check reads/writes per disk
Files (often logs) marked for deletion but not yet deleted
Overview of all disks
Usage of this dir and all subdirs
Find files over 100MB
Low hanging fruit for free space.
Check /var/log too!
Find files created within the last 7 days
Find files older than 14 days
Delete files older than 14 days
Monitor a log file for an IP or anything else
Generate a large file (count * bs = total bytes)
TCP sockets in use
Get IP/Ethernet info
host <=> IP resolution
Curl, display headers (I), follow redirects (L)
Traceroute with stats over time (top for traceroute)
Traceroute using TCP to avoid ICMP blockage
List any IP blocks/rules
Drop any network requests from IP
Show traffic by port
Show all ports listening with process PID
D/L speed test (don't run in prod! :)
Terminal & Screen
Start a screen session as the current user
Join/re-attach to a screen session
Record a terminal session
Playback a recorded terminal session
Tips n Tricks
Run Previous command as root
Change to last working dir
Run something forever
"Tail" all queries hitting mysql.
Connect to production mysql locally on port 3307 via ssh