Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours

(singke) #1
command line displays nothing as you type a password.


  1. At the pi@raspberrypi ~ $ prompt, type the command whoami and press the
    Enter key. You should see the word pi displayed and then, on the next line down,
    another pi@raspberrypi ~ $ prompt displayed.

  2. Now at the prompt, type the command calendar and press the Enter key. You
    should see some interesting facts concerning today’s date and the next few days.


By the Way: Exploring Files and Directories
In the next few steps, you will explore files and directories. It is important that
you learn how to do this so you will know how and where to store the Python
programs you create in this book.


  1. Type the command ls and press the Enter key. You should see a list of files and
    subdirectories that are located in your current location in the directory structure. This
    is called your present working directory.

  2. Type the command pwd and press the Enter key. This shows you the actual name of
    your present working directory. If you are logged into the pi user account, the
    displayed present working directory is /home/pi.

  3. Type mkdir py3prog and press the Enter key to create a subdirectory called
    py3prog. You will use this directory to store all your Python programs and work in
    progress.

  4. To see if you created the subdirectory, type the command ls and press the Enter
    key. Along with the list of files and subdirectories you saw in step 6, you should now
    see the py3prog subdirectory.

  5. To make your present working directory the newly created py3prog subdirectory,
    type cd py3prog and press the Enter key.

  6. Make sure you are in the correct directory by typing the command pwd and pressing
    the Enter key. You should see the directory name /home/pi/py3prog displayed.

  7. Now go back to the pi user home directory by simply typing cd and pressing the
    Enter key. Make sure you made it to the home directory by typing the pwd command
    and pressing the Enter key. You should now see the directory name /home/pi
    displayed because you are back to the home directory.


By the Way: Commands to Manage
Now you will try out a few commands that will help you manage your
Raspberry Pi.


  1. (Warning: This next command will not work, and it is not supposed to work!) Type
    the command reboot and press the Enter key. You should get the message
    reboot: must be superuser., as shown in Listing 2.3.

Free download pdf