Good Practices

Here’s another list! This covers

Back up your stuff

You’ll need a place to back up to, and optionally a script/tool to help you/a reminder

I like compressing my files before backing up, but that’s optional. There are utilities (I know Ubuntu has one by default) to do this for you, if you like! I highly recommend having a script/cronjob to do this for you, or using a built-in tool. If you don’t have this automated, you might want to set up a reminder to do this regularly!

On a side note, also back up before you do anything major, like partitioning your drive.

The pain and anxiety you’ll feel when you’ve lost something important isn’t worth it at all. Please help future you.

Keep your files organized and give them useful names

Concerning most non-hidden files in my home directory, my rule of thumb is that if I should just know the contents of a file given its location and name.

I know it’s tempting to name files temp, test, and foo, but that scheme isn’t doing you any favors.

Go ahead and get in the habit of naming things in a Linux-compatible way. Don’t include spaces in your file/directory names; it’ll make any CLI thing with Linux painful. This bit comes back to the file organization concept, have a uniform way of dealing with natural spaces between words. Some folks like camelCase, others-like-hyphens, and others_prefer_underscores.

Unfortunately, there’s not a one-ring-to-rule-them-all solution: camelCase doesn’t work in React file naming, we can’t use hyphens in Java identifiers, and you might have to escape certain files if they contain underscores in certain languages (LaTeX does this, if I remember right). Find a way that works for you, though, given that it’ll probably change depending on what you’re doing.

Begin your names with a non-lowercase character; no one has the energy to hit the Shift key for every file/directory; tabbing will take you through the rest of the name!

Do your updates and upgrades

They’re good for your computer (and you). Do ‘em regularly (set up a cronjob or at least a reminder). :)

Before you install a thing (package, repo, ppa), find out how to uninstall it.

The docs are usually a great place to go for this! Also, you might be able to message the developer sometimes if you need a thing.

The ArchWikis are golden

That, combined with forums and the official docs are your best friends in debugging. More often than not, the ArchWikis have a copy-pastable solution to whatever issue I’m having, no matter which distro I’m working with.

Make a copy of anything you’re editing

If you’re making significant changes to an important file, make a copy of that file and name appropriately. For example, you could copy the file .bashrc to .old_bashrc, and then make all the changes/test to the actual file without too much fear. The file .old_bashrc won’t be executed due its name.

Test your scripts before running them for real

Please, please, test your scripts on a set of representative files before running them on a whole filesystem with 100+ GB of files. This especially holds true with commands such as sed and recursive things. Ask me about “wtypeype” if you want to hear about my pain on November 30, 2018.

Version control

Git is probably the most common, and it’s really easy to use. Please track your versions and commits with meaningful names; future-you will thank present-you when your code suddenly stops working.

Try to edit sensitive files as little as possible

You know how you’re supposed to use visudo to edit the sudoers list, or run crontab -e instead of editing the file directly? Try to do the same thing as much as you can get away with. Most of the time, these utilities tell you immediately if you’ve made a mistake in configuration. This way, you won’t be stuck with an impossible-to-debug situation, or worse, a brick. (Yes, messing up certain files enough can leave you with a brick. Yes, we’ve all been there before, so don’t be too hard on yourself.)