Live data from Hacker News

Devops/Sysadmin Cheatsheet

rubytune.com

101–110 of 110 posts

Re: Devops/Sysadmin Cheatsheet

#101
post #81

Meta question: where do you actually learn this stuff? I am a developer with an intermediate desktop level command line knowledge learnt mostly on the job but would appreciate a crash course on system-level command line, diagnostics, devops, etc.

In my experience, you pretty much learn this on the fly. You don't know how to do X, you google it, if you do X often enough, you'll eventually learn. After a while you end up mastering most of the unix suite (ls, grep, awk, du, etc..) so instead of googling stuff you write it. Unlike fundamentals (think books like SICP, Introduction to Algorithms, K&R, the Dragon book, et al), this is just a collection of useful com…

I second the idea of learning on the job, especially by things going bad.

I have the feeling ops people can be somehow.. "measured".. by how many things they had exploding in their face, and then learned how to fix them.

For example, looking at TFA, the first thing I thought is "oh, `df -i` should be there too".

Because I ran out of inodes enough times that I learned to check that (though I am not a sysadmin).

Re: Devops/Sysadmin Cheatsheet

#102
post #97
post #16

Some 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…

Regarding ctime, some Unix versions(or I should say filesystems) really store the creation time(birthtime) of the inode. FreeBSD's find has the -Bmin switch for searching for true creation time.

Can anyone link something about this? We have two contradictory opinions and I'm not sure who to believe. The Wikipedia article on ctime isn't at all helpful either:

http://en.wikipedia.org/wiki/Ctime

Re: Devops/Sysadmin Cheatsheet

#103
post #82
post #16

Some 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…

ctime is also useful because it's harder to forge. You can normally set the mtime on your files to whatever you want, but forging the ctime normally requires either directly modifying the filesystem structures on disk, or changing the system clock.

ctime is trivial to manipulate. For instance, 'touch -t 1111111111 foo'

Re: Devops/Sysadmin Cheatsheet

#104
post #98

Earlier quoted context omitted.

I'd second a quick pdf version of it as well, I'm sure more than a few of us have a directory with cheatsheets in somewhere on their drive as a 'just in case'.

Here's a work in progress, still needs some loooovvvee: https://www.dropbox.com/s/a0rx9c28euwokaz/cheatsheet-pdf-ver...

Nice work!

Re: Devops/Sysadmin Cheatsheet

#105
post #97

Earlier quoted context omitted.

Regarding ctime, some Unix versions(or I should say filesystems) really store the creation time(birthtime) of the inode. FreeBSD's find has the -Bmin switch for searching for true creation time.

Can anyone link something about this? We have two contradictory opinions and I'm not sure who to believe. The Wikipedia article on ctime isn't at all helpful either: http://en.wikipedia.org/wiki/Ctime

I really wasn't clear about what I wanted to say, sorry. birthtime is different from ctime on those systems. Ctime is last change on the inode as parent said.

I just wanted to note that some Unix systems really store the creation time. See http://www.daemon-systems.org/man/fstat.2.html for an example.

Re: Devops/Sysadmin Cheatsheet

#106
post #74

Devops/Sysadmin Cheatsheet for Linux Most of the commands listed rely on various GNU extensions to the various utilities or are only applicable to Linux. FreeBSD: strace -> dtrace/ktrace/ lsof -> sockstat/fstat watch -> no idea sudo -> Almost never installed by default on FreeBSD ps aux --sort=-resident|head -11 -> --sort is not valid ... And the list goes on ...

If you're going down that path, add windows servers to your list and find more things missing.

I don't know a lot of people running Ruby services on top of Windows ...

Re: Devops/Sysadmin Cheatsheet

#107
post #74

Earlier quoted context omitted.

If you're going down that path, add windows servers to your list and find more things missing.

I don't know a lot of people running Ruby services on top of Windows ...

I don’t know a lot of people running Ruby services on FreeBSD, either. I’m pretty sure I know one or two who, at least, develop on Windows.

But, yeah, noone’s stopping you to make your FreeBSD version of the cheatsheet, what with the open source spirit and all… :P

Re: Devops/Sysadmin Cheatsheet

#108
post #82

Earlier quoted context omitted.

ctime is also useful because it's harder to forge. You can normally set the mtime on your files to whatever you want, but forging the ctime normally requires either directly modifying the filesystem structures on disk, or changing the system clock.

ctime is trivial to manipulate. For instance, 'touch -t 1111111111 foo'

You are wrong; -t does not change the ctime. It changes the atime and mtime. You cannot change the ctime using touch.

Re: Devops/Sysadmin Cheatsheet

#109

There'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 .…

Instead of: ls -al | sort -nk5 I suggest: ls -larS

I upvoted you the other day and it seems coming back today i have the upvote option again? Weird.

Either way, have an upvote!

Re: Devops/Sysadmin Cheatsheet

#110

Earlier quoted context omitted.

Correct with one important caveat: because * is a shell expansion, it will not process any directories starting with a ".". e.g., imap maildir directories.

That's fair, but for the proposed use, checking the size of home directories, .* directories are of little concern. Honestly, when I have to get fine grained enough to dig into disk usage using 'du', I'm rarely concerned with hidden directories (and I typically append a 'c' to the command as well, so if I do have to pay attention to . directories, I will notice the discrepancy between reported sizes).

Your local maven repo (.m2/repository) can get huge.
Post reply on HN