The Raspbian OS Command Line

The Raspbian OS provides shells to be used to manage its system. Some shell commands are useful for optimizing your work. In this chapter, you learn how to work with Raspbian shells. You’ll see some examples to help you learn and understand the use of the

  • PDF / 3,828,931 Bytes
  • 51 Pages / 439.37 x 666.142 pts Page_size
  • 33 Downloads / 197 Views

DOWNLOAD

REPORT


The Raspbian OS Command Line The Raspbian OS provides shells to be used to manage its system. Some shell commands are useful for optimizing your work. In this chapter, you learn how to work with Raspbian shells. You’ll see some examples to help you learn and understand the use of the shell. The following is a list of topics covered in this chapter: •

Understand Raspbian shells



Work with Raspbian shells



Manipulate files and directories



Work with redirection



Work with resource permissions



Manipulate processes



Work with media storage

© Agus Kurniawan 2019 A. Kurniawan, Raspbian OS Programming with the Raspberry Pi, https://doi.org/10.1007/978-1-4842-4212-4_2

27

Chapter 2

The Raspbian OS Command Line

2.1  Introducing Raspbian Shells Raspbian is built from Debian OS. This means that you can operate Raspbian using the Debian/Ubuntu style. In this chapter, you learn about the Raspbian shells, which we usually call the command line. You can access the Raspbian shell from desktop mode or via remote SSH. If you are working in desktop mode, you can access the Raspbian Terminal by clicking on the Terminal icon. You’ll then see the Terminal window, as shown in Figure 2-1.

Figure 2-1.  Accessing the Raspbian Terminal from the desktop

28

Chapter 2

The Raspbian OS Command Line

You also can access the Raspbian Terminal via SSH. For instance, the IP address of Raspbian is 192.168.1.21. You can access remote SSH with the pi account, as follows. $ ssh [email protected] If this succeeds, you’ll see the Terminal, as shown in Figure 2-2.

Figure 2-2.  Accessing the Raspbian Terminal using remote SSH

29

Chapter 2

The Raspbian OS Command Line

2.2  The Basic Raspbian Shell In this section, we perform basic shell operations in Raspbian. These shell commands are general commands that you can use in your daily activities. We explore some basic shells in the following sections.

2.2.1  Rebooting Raspbian OS Sometimes you’ll want to refresh or reload libraries after you’ve installed or configured something. You’ll probably need to reboot your Raspbian. If you want to reboot your Raspberry Pi, use this command: $ sudo shutdown -r now You also can do it by using this command: $ sudo reboot

2.2.2  Shutting Down If you think you won’t be using the Raspberry Pi board again, you can turn it off. You should perform a shutdown before unplugging it from the power adapter. Use this command to perform a shutdown and turn off your Raspberry Pi: $ sudo shutdown -h now Wait several minutes. After that, you can unplug the power cable from the Raspberry Pi board.

30

Chapter 2

The Raspbian OS Command Line

2.2.3  Configuring the Timezone If you want to change the timezone in the Raspberry Pi, you can use the raspi-config tool. You can type this command on the Terminal. $ sudo raspi-config Then, you will get the dialog box shown in Figure 2-3.

Figure 2-3.  Displaying the raspi-config form

31

Chapter 2

The Raspbian OS Command Line

You can select Localisation Options to configure the timezone. When you’