Command Line reference
Navigation and fi les
cd
Changes directory. For example,
cd movies
moves to the
movies
folder.
cd ~
moves to your home directory,
cd /
moves to the root directory,
cd ..
moves back one directory.
ls
Lists files. By itself, it lists the files in the current directory.
ls movies
lists the files in the directory
movies
.
ls -a
lists all files (including hidden ones), and
ls -l
lists more
information about each file.
cp
Copies files.
cp orig-file new-file
copies
orig-file
to
new-file
.
wget
Downloads a file from the internet. To download
the Google homepage to the current directory, use
wget www.google.com
.
df -h
Displays the amount of space left on the device.
pwd
Displays the current directory.
|
The pipe symbol is used to pass information from one
program to another.
Finding fi les
find
<location>
<tests>
Useful flags include:
-mtime <number>
finds files modified
in the last
<number>
days.
<number>
could be, for example,
2 (exactly two days ago), -2 (less than two days ago)
or +2 (more than two days ago).
-name <filename>
finds files called
<filename>
.
-iname <filename>
matches files called
<filename>
but not case-sensitive.
-writable
finds files that are writable. There are many
more options. See the man page for a detailed list. For
example
find / -mtime -2 -writable
finds all files on the
filesystem that were changed less than two days ago and are
writable by the current user.
33
Raspberry Pi User Guide.indd 33
08/07/2014 14:44