The command prompt
Now that you’ve logged in you’ll see a command prompt with:
pi@raspberrypi ~ $
What does it mean?
pisection is your username followed by
raspberrypi(the default hostname), the
~is your current working directory.
~symbol is short hand for your home directory. When you log into your Raspberry Pi, you first land in your home directory.
- The tailing
$is your shell prompt, anything you type to the right of it gets executed as commands.
Poking around the home directory
When you first login, you’re in the home directory. The home directory is represented as
~ on the command prompt. The
~ character can be used as a shortcut to jump into your home directory.
To see what’s inside your home directory use the ls command.
Your home directory has the following path
/home/pi. There are other folders/directories above your home directory.
Don’t believe me? We can ask Linux to tell us what our current directory is by running:
you should see the following output:
pwd stands for print working directory.
To change directory use the cd command. What did you think cd stands for?
Moving up a directory
To move up a directory from pi’s home directory to the
/home directory use the following command:
Now when you print the current working directory, you should see.
To go back to your home directory you would use the command:
cd pi however the following commands could also do the trick:
cd /home/pi(specifying the full path)
cd ~(using the
cd(even typing just
cdtakes you back to your home directory, the maker of
cdsure hates to type extra characters)
-argument takes us to the directory we were immediately previously in, so this command would also work)
Of course there’s more to your Pi than the
/home directory. Let’s have an explore.
The folder structure on your Raspberry Pi looks something like this (with your home directory highlighted).’
||The upper most of your hard disk (or SD Card)|
||Programs and commands that all users can run|
||All the files needed for booting your Raspberry Pi|
||Files that represent devices on your Raspberry Pi|
||Scripts to start, stop and otherwise command services|
||X11 Configuration Files|
||All the user home directories (except for root’s)|
||The Pi user’s home directory|
||This is where the Kernel modules / drivers live.|
||There is where hard disks, SD Cards and other removable media are mounted|
||Virtual directory that provides details of running processes|
||Programs primarily used for systems maintenance|
||Another special folder that represents hardware devices|
||A space for temporary files|
||Programs and data usable by every user|
||Most programs you’ll run live in here|
||Libraries to support programs and programming languages|
||By convention software specific to a machine goes here.|
||More system software|
||Supporting files that aren’t specific to chip architecture|
||Typically compressed copies of system logs|
||apt-get and other programs keep their data here|
||All the system and service logs|
||This is where your mail goes (if you’ve set it up)|
||Data that is waiting to be processed or dealt with lives here (e.g. mail or print jobs)|
Ok, enough exploring let’s see what other commands we can do on the Pi!