Just the Basics
Following on from Don’t Fear The Command Line: Raspbian Linux Shell Commands and Tools – Part 1, in which tools for monitoring the Raspberry Pi’s hardware and running programmes are introduced, along with the Package installer (APT), this post concentrates solely on the file system.
For those of us of a certain vintage, the command line may seem a reasonably natural and intuitive interface with the computer; for many, however, it is arcane and daunting. Even for those well versed in the DOS command line, the Linux shell is sufficiently alien to cause headaches.
The aim here isn’t to educate Linux gurus, rather to provide some guidance to those either new to command line interfaces in general, or to the Linux shell (bash, in the case of Raspbian) in particular.
Navigating the file system from a command line can be especially troublesome when compared to the intuitive visual representations provided by graphical user interfaces, hence this brief guide.
Topics Covered in this Guide
- Moving Up, Down and Around the Directory Hierarchy
- Displaying the Directory Contents: the ‘ls’ Command
- Using the ‘more’ Command to Handle Overflowing Output
- Make use of Autocomplete to Speed Navigation
- Where am I? The Print Working Directory (‘pwd’) command
- Visualise the Directory Hierarchy
Please note: The Raspbian Linux Command Shell is case sensitive. Commands need to be typed exactly as shown, as do directory (folder) and file names.
Moving Up, Down and Around the Directory Hierarchy
Moving around the file system hierarchy to reach a specific directory is achieved through the cd command.
cd (short for ‘change directory’) command takes a path as a parameter, which instructs the system in how to reach a different directory. This can be achieved in several different ways.
First, we’ll introduce the building blocks that can be used to construct a path (a route from one location in the file system to another):
/. represents the directory you are currently in.
This is useful when executing a script file, which requires a path to that file to be provided (typing the script file name alone will not work).
../ indicates the directory one level above the one you are currently in.
This is useful both for navigating and for providing partially qualified paths (see below).
~ represents the home directory.
– If you are logged in as a standard user, this will be the user’s own directory. For example, for the user pi, home is
– If you are logged in as root, home is