Live data from Hacker News

Devops/Sysadmin Cheatsheet

rubytune.com

21–30 of 110 posts

Re: Devops/Sysadmin Cheatsheet

#21
post #18

Okay, 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?

[deleted]

Re: Devops/Sysadmin Cheatsheet

#22
post #18

Okay, 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?

I will admit that I have a fuzzy understanding as well. My take on it is a holistic view and integration between development and operations instead of formal or informal walls between the two.

Wikipedia: http://en.wikipedia.org/wiki/Devops

In small companies it usually always exists by accident. I think the "hype" is more around large companies that have huge barriers and sometimes friction between development and IT or sustaining Operations.

Re: Devops/Sysadmin Cheatsheet

#23
post #9

I 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 suppose if you type it at any random point it might be. It's useful more when typed something that you forgot to sudo.

If you are running sudo, the long-term payoff is probably higher if you never use sudo !!. The very small chance of a huge disaster is still a lot higher than up arrow. Unless you are on a laggy connection and up arrow delays and you push it twice and end up running the wrong command!

If you have lots of jitter and lag, i suggest using Mosh which I've found to be amazingly awesome when using it on Amtrak's spotty free wifi (3G uplink).

Re: Devops/Sysadmin Cheatsheet

#24
Thanks for this nice list.

Small nitpick/question: why put the commands in inputs? Do you edit them on that page? Or is it just to format them?

I tried to do a copy/paste on the page contents to my personal offline notebook but the most important bits, the commands, didn't paste.

Re: Devops/Sysadmin Cheatsheet

#25
Great 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), lsof (for the file handle to ip/port) and netstat (to find the process on the remote host) to track RPC calls that are hung.

For 'ps auxww', throw on an f to get a visual representation of child processes.

And finally, ssh tunnels (which can be chained together) to get past bastion servers easily:

    Host 
        HostName 
        ProxyCommand ssh -q  "nc -w 3600 %h %p"

Re: Devops/Sysadmin Cheatsheet

#26
Checks the speed of the network. if you are looking to good connectivity on your VPS.

    wget cachefly.cachefly.net/100mb.test -O /dev/null
check the write speed of the disk. Mostly used to check what kind of a write speed you get on the machine.

    dd if=/dev/zero of=iotest bs=64k count=16k conv=fdatasync && rm -rf iotest

Re: Devops/Sysadmin Cheatsheet

#27
[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=-resident|head -11

Other errors: They list same command "du -hs" for twice. I believe they meant "df -h" for "overview of all disks". Although, it's correctly overview of mounted file systems.

Re: Devops/Sysadmin Cheatsheet

#28
post #9

I 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.

So, what's wrong with sudo !! then?

It re-executes your previous command -- this time with root privilege.

If and only if you meant to do that, you're fine.

Re: Devops/Sysadmin Cheatsheet

#29

Earlier quoted context omitted.

I suppose if you type it at any random point it might be. It's useful more when typed something that you forgot to sudo.

If you are running sudo, the long-term payoff is probably higher if you never use sudo !!. The very small chance of a huge disaster is still a lot higher than up arrow. Unless you are on a laggy connection and up arrow delays and you push it twice and end up running the wrong command! If you have lots of jitter and lag, i suggest using Mosh which I've found to be amazingly awesome when using it on Amtrak's spotty fre…

I've never had any incidents with `sudo !!`, however, I should point out that zsh (maybe other shells as well) replaces the `!!` with the full command and requires another press of Enter.

    $ rm -rf /root
    rm: cannot remove `root': Permission denied
    $ sudo !!  # Does not run this, but returns the line below.
    $ sudo rm -rf /root  # Then you say, "Wait I dont want to do this."

Re: Devops/Sysadmin Cheatsheet

#30
post #14

A little gotcha: "iptables -L" doesn't list the NAT table rules; do "iptables -L; iptables -t nat -L" instead.

I also almost always add '-n' to iptables commands to disable reverse name resolution, which can sometimes take a while. Similarly when calling netstat.
Post reply on HN