The Terminal Is Your Best Friend

Updated

I've learned to love working in the terminal. It's very intimidating at first, but once you get the hang of it, it's pretty neat. More specifically, when I say “the terminal,” I'm referring to a suite of tools that make it easy for me to modify files and run programs.

Tips and tricks for using the terminal

1. Click Tab

Tab acts like autocomplete, so instead of having to remember the exact path names for your next command, you can type the beginning of a path and press Tab. Depending on your shell and how many paths match, it may complete the name or show you the available options.

./Directory1  ./Directory2  ./Directory3

Pretty cool.

2. Learn some of the syntax

The asterisk (*) is a shell glob that matches any sequence of characters within one path segment. (It is similar to a Kleene star, but shell glob syntax is its own thing.)

For instance, if you wanted to list all files in the current directory that end in .png, you could run:

ls *.png

To match the files inside a directory called images, you would use ls images/*.png.

3. Piping

Piping is the ability to take the standard output of the first command and make it the standard input of the second command.

Let's say you wanted to list directory entries that include the text dog. ls is the first command, and grep acts as the second command:

ls | grep "dog"

For scripts, tools such as find are safer than parsing ls, especially when filenames contain newlines or other odd characters. But the pipeline makes the idea easy to see.

4. Start writing some Bash scripts

Not much else here. Google it and you'll get better at it lol.

Vim (GOAT)

In particular... I really like Vim.

Vim is a highly configurable, keyboard-driven text editor. Vim is wonderful because it was designed for you to keep your hands on the keyboard. You can navigate, copy, paste, and search for text using key commands rather than reaching for a mouse.

If you're a person who has memorized a ton of keyboard shortcuts and likes typing quickly, Vim is for you!