The command prompt
Now that you’ve logged in you’ll see a command prompt with:
pi@raspberrypi ~ $
What does it mean?
- The
pi
section is your username followed by@
. - The
raspberrypi
(the default hostname), the~
is your current working directory. - The
~
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.
Other Directories
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:
pwd
you should see the following output:
/home/pi
pwd stands for print working directory.
Changing 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:
cd ..
Now when you print the current working directory, you should see.
/home
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~
shorthand)cd
(even typing justcd
takes you back to your home directory, the maker ofcd
sure hates to type extra characters)cd -
(the-
argument takes us to the directory we were immediately previously in, so this command would also work)
Other directories
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).’
Directory | Description |
---|---|
/ |
The upper most of your hard disk (or SD Card) |
/bin |
Programs and commands that all users can run |
/boot |
All the files needed for booting your Raspberry Pi |
/dev |
Files that represent devices on your Raspberry Pi |
/etc |
Configuration files |
/etc/init.d |
Scripts to start, stop and otherwise command services |
/etc/X11 |
X11 Configuration Files |
/home |
All the user home directories (except for root’s) |
/home/pi |
The Pi user’s home directory |
/lib |
This is where the Kernel modules / drivers live. |
/media |
There is where hard disks, SD Cards and other removable media are mounted |
/proc |
Virtual directory that provides details of running processes |
/sbin |
Programs primarily used for systems maintenance |
/sys |
Another special folder that represents hardware devices |
/tmp |
A space for temporary files |
/usr |
Programs and data usable by every user |
/usr/bin |
Most programs you’ll run live in here |
/usr/lib |
Libraries to support programs and programming languages |
/usr/local |
By convention software specific to a machine goes here. |
/usr/sbin |
More system software |
/usr/share |
Supporting files that aren’t specific to chip architecture |
/usr/src |
Source code! |
/var |
System logs |
/var/backups |
Typically compressed copies of system logs |
/var/cache |
apt-get and other programs keep their data here |
/var/log/ |
All the system and service logs |
/var/mail |
This is where your mail goes (if you’ve set it up) |
/var/spool |
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!
Leave a Reply