Raspberry Pi_Eng_10.3.1 Type of Profile

10.3 Shell and Profile

10.3.1 Type of Profile

There are many files and programs installed in the Raspberry Pi system. When working on the system, these items mutually interact with each other under certain control, and the necessary work is done. The results will vary depending on which files and which programs is used when you perform certain tasks. Therefore, in order for the system to operate consistantly, it is necessary to control the user’s working environment by instructing the system which program to use, which data to use, and how to operate.

Raspberry Pi_Eng_10.2.2 Environment Variable

10.2.2 Environment Variable

When the system is booted and a particular user logs on, the user is presented with a predefined screen and if the user issues a certain command, the command is processed in a predefined manner. At this time, the user confirms the contents defined in advance and determines the concrete processing method. When making important decisions that is necessary for the system to works, the system refers to a number of predefined data. Among these data, the important variables that the system frequently uses are stored in a special place, which is called an environment variable.

Raspberry Pi_Eng_10.2.1 Variable

10.2 Shell Environment

10.2.1 Variable

10.2.1.1 What is Variable?

Variable is a place where data can be temporarily stored in the computer’s memory. The difference with the file is that when the computer is shut down, the data in the file is retained when the computer is turned on again, and the data in the variable is lost when the computer is shut down.

If you use multiple words to define variable,, you can use “_” to connect them together.

Raspberry Pi_Eng_10.10.2 “cal” Command and “ncal” Command

10.10.2 “cal” Command and “ncal” Command

This command performs the function to print the calendar. While the “cal” command shows it in the traditional calendar format with a simpler type, the “ncal” command can display it in a variety of formats and use various options.

The following describes the usage format for the “cal” command.

Raspberry Pi_Eng_10.10.1 “date” Command- Confirm & Change Time Information

10.10 Commands Related to System Information

10.10.1 “date” Command- Confirm & Change Time Information

The time zone set in the current system can be changed using “raspi-config” command. For details, refer to the description of [9.2 How to Configure the System].

If the system is connected to the Internet, it will connect to the time server on the network and set the time automatically. This configuration is handled automatically each time the system boots. Therefore, even if you change the time manually, the next time you boot, it will be reset to the time of time server.

On Linux, use the “date” command to directly query or adjust the system date and time.

Raspberry Pi_Eng_10.1.4 Utilizing Command Execution History

10.1.4 Utilizing Command Execution History

When working at the Terminal, you may work a task repeatedly on multiple files, or work multiple tasks on a specific file. In addition, there are times when you need to reconfirm what tasks you have done previously in multiple steps. In some cases, you may want to correct partially and rework the command in case the input is wrong and an error occurs. When you execute various commands, it is useful to know the history of commands that you have executed before.

Raspberry Pi_Eng_10.1.3 Quoting Rule

10.1.3 Quoting Rule

10.1.3.1 Overview of Quoting Rule

Quoting is to enclose a string with quotation marks. The reason for doing this is to prevent the special characters from being reinterpreted or expanded by the Shell or Shell script when special characters are included in the string. For reference, “special character” refers to a character that can be interpreted differently from the meaning of a character. For example, the wildcard character “*” is a special character.

Raspberry Pi_Eng_10.1.2 Special Key of Shell

10.1.2 Special Key of Shell

In Shell, special keys are defined in advance to perform special functions.

key

function

description

ctrl+d

terminate input

Same as logout or exit. Log out of the shell (similar to exit).
“EOF” (End of file, end the foreground job).
End incoming input from standard input.

ctrl+c

terminate program

terminate a running program

ctrl+z

switch to background

Switch the running job to background and pause.

ctrl+s

halt screen output

halt screen output

ctrl+q

resume screen output

Restart screen output interrupted by ctrl + s

Raspberry Pi_Eng_10.1.1 Standard Input and Output

10.1 Command Overview

10.1.1 Standard Input and Output

In the Shell, a standard device is already specified for the input device that receives the input data for execution and the output device for which the processing result is displayed. Therefore, unless there is a specific designation, data is always input from the standard input device, and the processing result is always output to the standard output device.

Raspberry Pi_Eng_10.0 Chapter 10 Understanding Shell Command

Chapter 10 Understanding Shell Command

Chapter’s Main Topics

This chapter describes the Shell command. It will first explain the basics of the Shell command, explain how to use the Shell command, and then describe the most basic Shell commands. We will not cover all the Shell commands here, and commands associated with a particular topic will be discussed together when dealing with the topic.

It includes descriptions on the following topics:
■ Command overview

■ Shell environment

■ Shell and profile

■ Basic command

■ Operation processing related commands

■ Selective execution related commands

■ Program execution related commands

■ Input and output adjustments related commands

■ Data manipulation related commands

■ System information related commands