If you get started on Linux (like I, a Mac user, did after getting curious), getting used to the platforms quirks can be challenging. Linux doesn’t work like other platforms. It requires rethinking how a computer “should” work and understanding a whole different paradigm with its own strengths and weaknesses.

One of the biggest changes is the command line. Windows has Command Prompt (which any good sysadmin will spend a good bit of time in) and Mac has Terminal, but both prefer to keep command line stuff as a last resort. Mac and Windows (and some Linux brands, such as Ubuntu) would first present a GUI for managing programs and updating your OS.

Linux, however, runs mostly on the command line. Doing all the cool (and useful) things in the operating system requires understanding how some funny-sounding commands can operate your system. However, the command line can be intimidating. To help you understand it and work in it better, here are some things you should know before starting on Linux.

Using Command Line on Linux

What is a command line?

As humorously documented in the Ubuntu beginner’s guide, terminal commands can look bizarre and intimidating.

sudo gobbledegook blah_blah -w -t -h –long-switch aWkward/ComBinationOf/mixedCase/underscores_strokes/and.dots

At its core, a command line is a way to input orders into a computer with special bits of text the computer knows. It’s confusing because you have to remember what command does what. However, once you learn the commands, it can be very fast and powerful (especially since Linux will let you change almost everything).

When you input commands in a terminal window, a program called a shell takes those and translates them into computer code. There are several different shells, but for our purposes we’ll focus on the most popular, bash.

Command-line grammar


If you break it down, you can understand some of the weirdness in command lines. There’s a kind of rough grammar to it (with plenty of exceptions).

Many commands will start with the word “sudo.” What that means is instead of executing the command with regular privileges, you want to do it as a superuser (hence “su”). This gives you access to system files and all the important stuff.

Next is a program name. This tells the system what to invoke. For example, a command that reads:

sudo apt-get update

Tells the shell to execute the apt program as a superuser. The -get part is an additional flag that tells apt what to do. “Update” is the other part of telling apt what to do (update its source list).

You might see a lot of these kinds of modifiers. Generally letters after dashes are modifying flags on a base command.

When you see something like /var/etc/test.txt, that’s a reference to a file. All files stored on a Linux computer’s hard drive can be found with some kind of file reference, just like on Mac and Windows.

Sometimes files are used as modifiers to commands. For example, you might tell the command line to copy a file to the desktop like so:

cp test.txt ~/Desktop/

Notice something: in this case, we referred to test.txt without a long preceding string to reference its absolute path. Each terminal window runs at a certain location on your computer, referenced by the bit before the dollar sign but after the colon. For example, this:


Is me at my home directory. If I type:

cd ~/Downloads


pushd Downloads

It changes the Terminal window’s location to my downloads folder. You can always check what’s within your current folder by simply typing:


Now, why does it matter where the terminal process is running? Because it means you can cheat a little. Instead of referring to a file’s absolute, complete path and name (e.g. ~/Desktop/cmdline.txt), you can just call it by the name (cmdline.txt). Definitely makes things easier to type.

What is the command line good for?

The previous section was all about using the command line for file management, but I would not recommend it unless you’re doing batch renaming or something you need to automate. Honestly, basic file management is awkward on the command line. It’s much easier to drag and drop a file onto your desktop than it is to type out the full cp command (in my opinion).

However, say you wanted to automatically copy that file into your Dropbox folder at 11pm every night to save your work. In that case, a script of commands would be perfect.

The command line is also great for installing and managing software utilities. It’s better to just type in sudo apt-get install whatever when you’re downloading the ten dependencies needed for Ruby than it is to go to Ruby’s website and download every zip you need.

Lastly, the command line rewards expertise. While it’ll be hard at first, it’ll reward you with some really awesome time-saving shortcuts once you get the hang of it.

Always useful basic commands

cd [directory]

Go to [directory]

sudo apt-get update

Refresh the list of available software

sudo apt-get upgrade

Download updates for your installed software


Put between commands to make the computer execute the first, then the second. For example, you might enter sudo apt-get update && sudo apt-get upgrade to download all new software without having to type in commands twice.

rm -r [directory or file]

Delete file or everything in that directory. Use with caution.


Print working directory. Tells you where you are so you can cd somewhere else.

man [program]

Show the manual of a certain program. Useful for checking how to use a command-line program without Google.

sudo [command]

Do as superuser. Use with caution.

[Up Arrow]

Autofills last command.


Autocompletes filenames or commands. Saves typing!

If you’re interested, there’s a good list of guides on Ubuntu’s website.