After opening your terminal emulator of choice, you will see
Things to remember:
~ means home directory, so it is an alias to
/ means root directory.
. means current directory.
.. means parent directory.
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.
Most commands finish immediately, but some are long-running, e.g.
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.
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:
cd [path]changes current directory. For example, go up one directory up:
cd ..or go to tmp folder:
ls -hallists all files in current directory. The options are optional.
hmakes the command show file sizes in human-readable form,
amakes the command show hidden files as well (those starting with a dot
ladds various information like this:
drwxrwx--- 17 username username 4.0K Jul 14 17:38 filename
dmeans it is a directory,
rwx--- 17 usernameis mostly permission stuff and probably not relevant to you,
4.0Kmeans it is 4 KB in size, and
Jul 14 17:38is the last modification date.
sudoexecutes a command with root user permissions. Be careful when using this. E.g.
sudo apt-get install nvidia-latest
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.
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:
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.
Just for reference, here are some commonly used special character meanings:
#adds a comment (if proceeded by a space), e.g.
echo "ab" # "cd"only prints
$refers to variables, e.g.
|"pipes" the output of one command to the other, e.g.
echo "ab" | revprints
>redirects output into a file, e.g.
ls -hal / > myfile.txtwrites the output of ls into a file
&runs a command in background, e.g.
sleep 10 &runs the command but you can keep using the terminal
;delimiter for multiple commands, e.g.
echo 1 ; echo 2. Same as line break in between.
&&"and"-delimiter for multiple commands, e.g.
ls /nonexisting/directory && echo 'success'The second command will only be called if the error code of the first one was zero (success)
||"or"-delimiter for multiple commands. The second command will only be called if the error code of the first one was non-zero (failure)
~cannot be used inside quotes
- There are also double quotes
". These work similar to single quotes
'but some characters, most notably dollar sign
$, preserve their special functionality
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