Appendix A. Raspberry Pi Linux Quick Reference

Table A-1 shows some useful and common Linux commands. Table A-2 shows the directories you’ll be working in much of the time.

Table A-1. Some Linux commands
CommandMeaning

pwd

Prints your working directory

ls

Lists files in working directory

cd Desktop

Changes directory to the Desktop directory immediately under your current directory

cd ~/Desktop

Changes directory to the Desktop directory immediately under your home directory

cd ~

Changes to your home directory

nano foo.txt

Edits the text file foo.txt. Use Control-X, then type y followed by Enter or Return to save the file.

passwd

Change your password (asks for the old one first, but doesn’t echo what you type to the screen)

startx

Launch the graphical desktop from a command-line-only Linux session

sudo apt-get update

Updates the list of software you can install (requires a network connection)

sudo apt-get install ipython

Installs the program ipython

sudo shutdown -P now

Prepares the Raspberry Pi to be powered off in a safe way

sudoedit /etc/motd

Edits a file as root, with more safety checks than sudo nano /etc/motd

ifconfig

Shows the Pi’s IP addresses (127.0.0.1 is localhost, which is used for connections between programs running on the Pi; use the other one, which is your Ethernet or WiFi adapter)

sudo raspi-config

Calls up the configuration menu of most common Raspberry Pi settings (you’ll usually need to reboot after you run it)

mkdir bar/

Create a directory called bar

rm -r bar/

Remove the directory bar/ and its contents (there is no Undo)

ssh [email protected]

Connects to remote computer example.com with user “login”

exit

Close the shell or ssh connection

less /var/log/syslog

View a text file (press space for the next page, press q to quit)

tail -F /var/log/syslog

Follows the specified text file as lines are added to it (use Control-C to kill the tail command and return to the shell)

man ssh

View the manual page (built-in documentation) of the command “ssh” (press space for the next page, press q to quit)

Table A-2. The most important directories
DirectoryPurpose

/home/pi/

Your (you are the user named pi) home directory; contains all of your files on the Pi

/var/log/

Contains all the system-wide log files, such as /var/log/syslog and /var/log/auth.log

/etc/

Contains all the system-wide configuration files.

/sys/

A virtual file system for reading and modifying volatile data (things that change continuously as the system is running, such as input and output pins)

/media/

Removable media, such as /media/cdrom/ or /media/usbdisk/

/

The root directory; contains every directory and file available on the system

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset