Five minute tutorial on using Ubuntu / Linux terminal

This tutorial is meant for you if you prefer Windows-like GUIs but have to use the terminal, because some random dude on the internet only posted a command line only solution for your specific problem. I once made this guide to help someone on configuring a driver and figured it might help others too.

This applies to all common Linux distributions like Ubuntu which run Bash.

After opening your terminal emulator of choice, you will see

Command prompt

user_name@computer_name:current_directory$

For example,

some_name@laptop:~$

Things to remember:

~ means home directory, so it is an alias to /home/some_name.

/ means root directory.

. means current directory.

.. means parent directory.

Running commands

Commands always consist out of a command name and arguments, delimited by space. Try the following, it will open a desktop pop-up:

notify-send Summary Body

and press Enter.

Many special characters have side effects, so if your arguments contain anything besides simple letters and numbers, better wrap them in single quotes:

notify-send 'Some summary with spaces' 'Body with some special chars !@#$%^&*()_'

You can press Tab while typing for autocompletion.

You can press Up and Down for navigating through your previously typed commands.

Interrupt command

Most commands finish immediately, but some are long-running, e.g.

sleep 1000

You can interrupt any running command by pressing Ctrl+c. In rare cases, it's q or Ctrl+d or typing :wq (saving changes). If nothing helps, close the window or kill the process using task manager.

Copy paste

If you are accustomed to Ctrl+c/Ctrl+v being copy/paste keybindings, you cannot use them like this. You have to use the mouse or use the terminal emulator's special keybinding (typically Ctrl+Shift+c). Please be careful with pasting random online commands. The terminal has full control over your entire system.

List of commands you need

There are hundreds of commands available, and thousands more you can install.

From all of these, you will very likely need the following:

If you want to know how to edit files, read files, move files, copy stuff, format text etc., check out other tutorials. You want to do that using graphical tools anyway.

Running scripts

Commands like notify-send and sleep are installed globally. You can also run local scripts by supplying their path. E.g. run a script called some-script in the current directory:

./some-script.sh

Scripts are marked as not executable by default. You can make it executable: Most file managers support that via right click. Alternatively in the terminal, run chmod +x filename.

For repeated actions, you can even create scripts yourself: Simply write commands into a file.

Special characters

Just for reference, here are some commonly used special character meanings:

Notes

  1. ~ cannot be used inside quotes
  2. There are also double quotes ". These work similar to single quotes ' but some characters, most notably dollar sign $, preserve their special functionality

Further reading

If you are interesting in learning more about Bash (scripting), check out Linux Fundamentals, it is a nice incremental guide by Philip Carinhas and much more concise than most others. It was written 2001 but virtually nothing has changed (not a joke), except for that for text editing, your best bet will be the user-friendly nano instead of vi.