host1$ while : ; do nc -l 6666 > /dev/null; done
host2$ pv /dev/zero | nc host1 6666
156MiB 0:00:17 [9.46MiB/s] [ ]Devops/Sysadmin Cheatsheet
41–50 of 110 posts
Re: Devops/Sysadmin Cheatsheet
#42Great list. A few more (related or building on those there) Quick mysql "why is my database under so much load suddenly" that doesn't rely on the slow query log: pt-query-digest --processlist h= --interval=0.01 --print > /tmp/queries.out pt-query-digest /tmp/queries.out Tracking down what files exactly are filling up the disk. Go to /, and follow the big numbers: du -smc * Combine strace (for the file handle no), lso…
I prefer using tcpdump instead of processlist when dealing with pt-query-digest. You get everything instead of just what happens to show up during the interval specified. This is, of course, assuming that you don't allow localhost socket connections.
The pt-query-digest function will cause additional load on the DB, but it won't interrupt communications.
Re: Devops/Sysadmin Cheatsheet
#43I would warn anyone that read this to understand what each command does before actually running anything on a machine. Things like "sudo !!" are INCREDIBLY dangerous, and I would never put that on a cheat sheet.
I use this one like a dozen times a day. user@host$ less /var/log/syslog Permission Denied crap... $ sudo !! sudo less /var/log/syslog Woo!
Re: Devops/Sysadmin Cheatsheet
#44Some random thoughts: - Instead of 'while true;' you can use the shorter 'while :;'. ':' is a null command. - On OS X, dtruss is kinda, sorta like strace (it's a wrapper around dtrace, and the dtruss name comes from Solaris). - For basic host to IP resolution, I prefer ping as it calls gethostbyname(), like most other programs will do. host/dig are suitable for querying/testing DNS independent of how the local box is…
Re: Devops/Sysadmin Cheatsheet
#45Great list. A few more (related or building on those there) Quick mysql "why is my database under so much load suddenly" that doesn't rely on the slow query log: pt-query-digest --processlist h= --interval=0.01 --print > /tmp/queries.out pt-query-digest /tmp/queries.out Tracking down what files exactly are filling up the disk. Go to /, and follow the big numbers: du -smc * Combine strace (for the file handle no), lso…
Re: Devops/Sysadmin Cheatsheet
#46Small typo, "Overview of all disks" should be df -h not du -sh
Re: Devops/Sysadmin Cheatsheet
#47There's a few typos in this, in case it helps: ps auxww -> ps auxww -H (H is hierarchy) Faster than lsof, and only displays files - although most things in unix are files! lsof -p -> ls -l /proc/$PID/fd Run something forever watch command Overview of all disks du should be df. Find files over 100mb find . -size +100M Low hanging fruit for size ls -al | sort -nk5 Files created (modified) within the past 7 days: find .…
Re: Devops/Sysadmin Cheatsheet
#48[Edit oh gads I see now the commands are in text boxes and the full command is not visible. It is "ps aux | head -1 && ps aux | sort -k 4 -nr | head" which maybe correct is even more ridiculous.] > ps aux | head -1 && ps aux | sort Is a wasteful construct and doesn't even do what is claimed "List the top 10 memory hogs". Depending on what you consider "memory" something like this is shorter and correct. ps aux --sort…
Re: Devops/Sysadmin Cheatsheet
#49Some random thoughts: - Instead of 'while true;' you can use the shorter 'while :;'. ':' is a null command. - On OS X, dtruss is kinda, sorta like strace (it's a wrapper around dtrace, and the dtruss name comes from Solaris). - For basic host to IP resolution, I prefer ping as it calls gethostbyname(), like most other programs will do. host/dig are suitable for querying/testing DNS independent of how the local box is…
traceroute -P udp
This is super useful if you're probing a network that's hostile to ICMP packets - it's a lot more reliable than ICMP in many scenarios, from my experience.
Re: Devops/Sysadmin Cheatsheet
#50Okay, I'll admit it. I don't actually know what devops is. I know what developers do and what sysadmins do. Is devops just a buzzword for one person who can do both? Or does it mean something other than that?
But yes, my impression is that it's normally a developer who "trends towards doing systems administration" – so someone who knows the codebase, but can provision and wrangle servers. So, someone like me (I write full stack apps, but my "speciality" is the server end of things).