Loading Loading Medway Makers: Linux

When You Start

The file system is more than a file storage system in Linux. It is an address book to the devices that store and use files like disks, tapes and printers.

The system consists of files and then directories to, collections of files and sub-directories.

When you mount a device like a disk drive or memory stick, in Linux, it is the process of allocating it a position in the directory structure so that it can be referred to and made use of.

If your using a GUI such as Ubuntu then you just need to start a terminal and you will get a window with a prompt rather like this;

   tom$gold:~$

You are now using the "shell". It tells you that you are on the computer called "gold" in the home directory for "tom". Of course your account name and computer name will probably be different. Each account on any named computer has a directory allocated to it known as a "home directory".

Typing ls and pressing the <Enter> key, will display all the files and directories in your home directory.

   tom$gold:~$ ls

      Bookmarks
      Desktop
      Downloads
      Graphics stuff
      Music
      Notes for project
      Pictures
      To do list

   tom$gold:~$

Files and directories are often shown in different colours.

You can look in a directory just listed like this;

   tom$gold:~$ ls Pictures

If your directory-name has spaces in its name you will need to put it in single quotes like this;

   tom$gold:~$ ls 'Graphics stuff'

When showing how to write commands we often don't use examples but rather write something like;

   tom$gold:~$ ls <directory-name>

relying on you to replace <directory-name> with the actual name or thing required.

If you find another directory in your directory you can see what's in that to;

   tom$gold:~$ls <directory-name-1>/<directory-name-2>

If you find another directory in your directory in your directory you can see what's in that to;

   tom$gold:~$ls <directory-name-1>/<directory-name-2>/<directory-name-3>

A string of directories like this is called a directory-path;

   tom$gold:~$ls <directory-path>

If you want a lot more detail in your listing use;

   tom$gold:~$ls -l

Changing the Current Directory

At the moment your home directory is the current working directory but you can change the current working directory with;

   cd <directory-path>

A bit more about file paths and directory paths below.

Paths

By putting that / at the start, you're saying "Start at the root directory, and work down"

If you don't put the / at the front, you're saying "Start from the current directory and work down"

If you put ../ at the front, you're saying "Go up one directory and then start looking"

And if you put ~ at the front, you're saying "Look in my home directory"

When running a command by simply typing a path to it you have to say ./ to mean a command file in the curent directory.

File Descriptors

File descriptors can include "wildcards" so that more than one file can be refered to by a single string of characters.

Here is the basic set of wildcards:

The best way to experiment with this is to use the ls command;