Raspberry Pi_Eng_08.1.3 Working on Terminal Screen


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


8.1.3     Working on Terminal Screen

 

Next, let's see exactly where the current position is on the Terminal screen. If you want to know the current directory location on Linux, use "pwd" command.

 

pi@raspberrypi ~ $ pwd

/home/pi

 

The above example shows that when you run the "pwd" command, it tells that "/home/pi" is the current directory location. "~" is displayed on the screen, but in reality, it means "/home/pi". The current directory location specified in the home directory for the first time will be changed as user move the user's working directory to another directory. Then, the position displayed on the screen is changed accordingly.

 

The following example is the result of moving the current directory to several places and checking the current directory. I also tried to execute the command using "~".

 

pi@raspberrypi ~ $ cd testdata

pi@raspberrypi ~/testdata $ pwd

/home/pi/testdata

pi@raspberrypi ~/testdata $ cd ~

pi@raspberrypi ~ $ pwd

/home/pi

pi@raspberrypi ~/testdata $ cd /etc/apt

pi@raspberrypi /etc/apt $ pwd

/etc/apt

pi@raspberrypi /etc/apt $ cd ~/testdata

pi@raspberrypi ~/testdata $

 

In the above, you can see that if the current directory location is under the home directory "/home/pi", the location is indicated on the basis of "~", and if the current directory location is not under the home directory, the location is displayed on the basis of "/"(root). In other words, "testdata" under "home directory" is marked as "~/testdata" and if it is "/etc/apt", it is also marked as "/etc/apt". Also, you can see that if you use "~" in the path when executing the "cd" command, the path is specified based on the home directory.

 

The next thing to look at is the user's privilege level. A privilege is a rule that defines what actions are allowed and what actions are prohibited when a lognon user trys to work on the system. Later, we'll look at user accounts again, but in Linux there are users with normal privileges and users with super user privileges. This is indicated by the "$" symbol for users with normal privileges and the "#" for users with super user privileges. Marking "#" for a user with super user privileges means that he has to be careful because the user having the privilege can do all the work on the system, and he may destroy entire system by mistake.

 

The screen below shows that the working user is changed to the root user with super user privilege. The "sudo su -" command is a command to temporarily switch to the root user.

 


 

If you look at the above, you can notice that the overall color of the current line has been changed to white, the user account name has been changed to root, and the privilege level has been changed to the "#" symbol as well.

 

The last thing to look at is the execution command part. The user enters commands to be processed in this part. When all the input is complete, and press [Enter] key, it begin executing the command. When the operation is completed, it displays the result on the next line. It then prepares the screen so that you can enter the new command again in a new line. In this way, the user executes several commands one by one in sequence.

 

Let's look at the example below. When the "pwd" command is executed, the result is displayed on the next line, and the next line below is ready to enter a new command.