top of page

Terminal Tutorial

Useful tips from William Shotts [1] (unless otherwise indicated)

  • To set focus mode to follow mouse in Ubuntu: gsettings set org.gnome.desktop.wm.preferences focus-mode 'mouse' [2]

  • bash = Bourne again shell (the first shell was written by Steve Bourne)

  • ls = list files

  • cd = change directory

  • pwd = print working directory

  • cd /usr/bin = change to this directory (relative pathname)

  • cd .. = up a directory level

  • cd bin = down a level

  • cd = without any modifiers, takes you back to home directory

  • cd ~emma = takes you to your home directory

  • less = text editor (q exits)

  • zless = text editor that can read .gz (compressed) files

  • file = gives additional information about the file type

  • ls -l = gives long name and other information for files in a directory

  • help command = type in "help" followed by a command to learn more about how it works (this works for built-in commands)

  • command --help = also provides documentation for commands that are not built into the shell

  • man command = shows the manual for the particular command

  • mv = move a file

  • mkdir = make a new directory

  • rm = remove a file

  • rm -r directory = can be used to remove a directory and all its contents (Be very careful about using rm in any context!)

  • ls > filename = allows you to output the data from ls to a file (like a .txt)

  • ls >> filename = appends the data to the file (> writes over the file)

  • sort < filename1 > filename2 = sort operates on the input from filename1 and passes the output to filename2

  • ls -l | less = outputs the result to less so you can scroll through it more easily

  • du | sort -nr = lists all the directories in current location from largest to smallest and provides directory size

  • tar.gz = files that are traditional Unix style tape archive files (created with tar) that are compressed using gzip

Outstanding Questions:

  • What is a kernel?

  • What is the difference between GNU, bash, Linux and Ubuntu?

  • What exactly is a shell?

Sources:

[1] http://linuxcommand.org/lc3_lts0020.php

[2] https://askubuntu.com/questions/64605/how-do-i-set-focus-follows-mouse


bottom of page