My Authors
Read all threads
Ancient sysadmin wisdom: don’t use ‘>’ as part of your shell prompt. You’re one copy/paste error away from truncating a file.

There’s a reason root’s ‘#’ prompt gets interpreted as a comment.
‘> file.txt’ creates an empty file.txt
‘>database.zone’ now means database.zone is a zero byte file. Whoops.
More Ancient Sysadmin Wisdom:

">" replaces file contents. ">>" appends to the existing file.

You will screw this up precisely once in your career.
Ancient Sysadmin Wisdom:

VMs that live-migrate are awesome until the two redundant things migrate their way onto the same physical host.

Which then suffers a hardware fault.
Ancient Sysadmin Wisdom:

Systems should be cattle not pets, but your laptop is going to one day go to live at a farm upstate and have its ashes in a commemorative urn.
Ancient sysadmin wisdom.

alias serial_9600_8bit='screen /dev/ttyUSB0 9600,cs8' is a line in my shell config. I haven't used it in eight years but when I need it I'm going to REALLY need it, so there it stays.
Ancient sysadmin wisdom:

Install 'sl' on your laptop to teach you to type 'ls' more accurately.

Install 'sl' into production to teach you why it's important to have friends at work.
Ancient sysadmin wisdom:

You want the shell environment on production servers to be as user-hostile as possible to discourage people from spending time there. I like the korn shell for this.
Ancient sysadmin wisdom:

Some people view their public SSH keys as secret. Those people should avoid looking at github.com / THEIR_USERNAME.keys if they'd like to remain happy.
Ancient sysadmin wisdom:

Every time you run a recursive rm, replace the "rm -r" with "ls" for the first attempt.

You will skip this step. And you will regret it.
Ancient sysadmin wisdom:

In shell scripting, use 'echo' in place of 'ls'. They'll work the same way except in a couple of edge cases that will destroy the goddamned moon.
Ancient sysadmin wisdom:

There is always a desktop under someone's desk, a VM in some unrelated cloud provider, or (nowadays) a raspberry pi somewhere that keeps an eye on the site.

If you don't have one, fix that.
Ancient sysadmin wisdom:

Once you follow this advice, it will be followed shortly thereafter by adding a -u to it.

(-e is stop on error, -u is stop on unset variable)
Ancient sysadmin wisdom:

If a log is filling up your disk, rm'ing the log file won't solve it. The file handle is still open; now you've got to kill -HUP the logging daemon to get it to let go.

'> logfile' avoids this step by truncating.
Ancient sysadmin wisdom:

If running a command and piping the output somewhere still displays output, you're seeing the difference between STDOUT and STDERR. `2 > &1` is a unifying idiom that will restore balance to your universe.
Ancient sysadmin wisdom:

The real value proposition of cloud computing that your boss is sworn to never reveal to you is that it keeps you from physically touching the computers and breaking them.

It's more expensive because it's worth it.
Ancient sysadmin wisdom:

"load-bearing cron jobs running in the sysadmin's account" is the kind of problem you only discover after something important fails to happen.
Ancient sysadmin wisdom:

There are at least three places to stash a cron job on a system. When the other sysadmin is busy patting themselves on the back for finding your clever hack they'll completely forget that 'at' jobs live somewhere else.
Ancient sysadmin wisdom:

'rm -rf /' now requires a '--no-preserve-root' flag in theory, but in practice I've never been brave enough to test it.
Ancient sysadmin wisdom:

In theory there's no difference between theory and practice, but in practice there is.

That difference is called systems administration.
Ancient sysadmin wisdom:

"I don't do sysadmin work, I'm a SRE / DevOp" is what the sysadmin in denial says.

If someone offers me 40% more money to pronounce AMI with two syllables, I'd do that too. Don't leave money on the table for dumb reasons.
Ancient sysadmin wisdom:

A simple way to show disk usage items by size is 'du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s | %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x(1.5*$l),$2);}' '
Ancient sysadmin wisdom:

If you accidentally type a password into the shell, it will end up in your shell history. Hope isn't lost!

`kill -9 $$` kills your current logged in process, and dead shells write no logs.
Ancient sysadmin wisdom:

It's best to use $() instead of backticks in shell scripts just to stop the "well, actually" crowd from bothering you.
Ancient sysadmin wisdom:

No matter what system you use to manage your workstation, it will not keep up with what you actually do, and reinstallation will require a bunch of manual work.
Ancient sysadmin wisdom:

`visudo` always beats editing /etc/sudoers manually.

But you're still going to want to have a second shell opened as root beforehand to avoid tears before bedtime.
Ancient sysadmin wisdom:

`netstat -antp |grep LISTEN` shows you what's listening to TCP ports. the "p" doesn't work on Mac, and it's part of net-tools and deprecated on modern Linux, but "ss -lt" lacks the same flair.
Ancient sysadmin wisdom:

There’s systemd, upstart, and a bunch of actually good init systems, but some jackwagon is always going to try to ice skate uphill by parking a command in a tmux or screen session.
Ancient sysadmin wisdom:

When you’re done configuring a box, reboot it to make sure everything starts properly on restart. Otherwise you won’t really be done until after the 3am power outage in eight months.
Ancient sysadmin wisdom:

If your boss tells you your shell scripts need a web interface, very careful phrasing on your part means that shellinabox meets their acceptance criteria. github.com/shellinabox/sh…
Ancient sysadmin wisdom:

Reduce the TTLs on your DNS records a few days before the change or risk annoyed users.
Ancient sysadmin wisdom:

Pointing out that “users are complaining, what’s the story with our monitoring system?” answers its own question must be done delicately.
Ancient sysadmin wisdom:

Draconian policies such as “all production changes require VP approval” can be overturned within hours by following them to the letter.
Ancient sysadmin wisdom:

Draconian policies such as “all production changes require VP approval” can be overturned within hours by following them to the bathroom.

Ancient sysadmin wisdom:

Bad flags to destructive commands, typos in shell paths, and file shares mounted on a system have a convergence point where it's best to begin cleaning out your desk to beat the rush.
Ancient sysadmin wisdom:

`if [ -e FOO]` as a test condition works in part because a command on the system is, and I swear I'm not making this up, `/bin/[`. Develop a stress release before the madness gazes into you.
Ancient sysadmin wisdom:

You will eventually try something one step too cute and somehow manage to delete /dev/null itself.

Pause. Take a deep breath. Revel in the feeling that you've just stormed the gates of hell and killed the devil, then `mknod`.

Ancient sysadmin wisdom:

If you’re coming from Linux, ‘killall’ absolutely doesn’t do what you think it does on Solaris.
Ancient sysadmin wisdom:

You only need to ‘sudo’ to gain privileged access from your usual account if your usual account isn’t root.
Ancient sysadmin wisdom:

You’ll get made fun of for using “cp FILE FILE.bak” as a quick fix backup before testing something, but you might get fired for not backing it up at all. Choose wisely.
Ancient sysadmin wisdom:

If you saw this picture and flinched, I wrote this thread for you.

/fin
Missing some Tweet in this thread? You can try to force a refresh.

Keep Current with HydroxyCoreyQuinn

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!