Raspberry Pi_Kor_10.3.1 profile 종류

10.3 Shell과 profile

10.3.1 profile 종류

Raspberry Pi 시스템에는 수많은 파일과 프로그램들이 설치되어 있는데, 시스템에서 어떤 작업을 할 때는 이러한 항목들이 일정한 통제하에 서로 상호 관계를 맺으면서 필요한 작업을 하게 된다. 특정 작업을 할 때 어떤 파일과 어떤 프로그램을 사용하는가에 따라서 그 결과는 달라지게 된다. 따라서 시스템이 일정하게 작동하기 위해서는 시스템에게 어떤 프로그램을 사용할 것인지, 어떤 자료를 사용할 것인지, 어떠한 방식으로 작동할 것인지를 지시하여 사용자의 작업환경을 일정하게 관리할 필요가 있다.

Raspberry Pi_Kor_10.2.2 환경변수(environment variable)

10.2.2 환경변수(environment variable)

시스템을 booting 하고 특정 사용자가 logon 하면, 사용자에게 사전에 정의된 형식으로 화면을 보여 주고, 사용자가 어떤 명령을 지시하면 사전에 지정된 방식으로 그 명령을 처리해 준다. 이때 사용자는 사전에 정의된 내용을 확인하여 구체적인 처리 방법을 결정하게 된다. 이렇게 시스템이 작동하는데 필요한 중요한 결정을 할 때는 사전에 정의된 많은 자료들을 참조하게 된다. 이러한 자료들 중에서 시스템이 자주 사용하는 중요한 변수들에 대해서 그 값을 특별한 장소에 저장하고 있는데, 이것을 환경변수(environment variable) 라고 한다.

Raspberry Pi_Eng_10.9.4 “uniq” Command

10.9.4 “uniq” Command

This command performs the function of removing adjacent redundant data when reading data from the input or exporting the data to the output.

[Command Format]

uniq [option] [input] [output]

[Command Overview]

■ This removes adjacent redundant row data from input or output.

■ User privilege — Normal user.

Raspberry Pi_Eng_10.9.3 “sort” Command

10.9.3 “sort” Command

This command sorts the data in the specified file according to certain rule and then exports them to standard output.

[Command Format]

sort [option] [directory/file]

[Command Overview]

■ This sorts the data in the specified file.

■ User privilege — Normal user.

Raspberry Pi_Eng_10.9.2 “wc” Command

10.9.2 “wc” Command

This command counts and returns the number of line, word, and byte in the specified file.

[Command Format]

wc [option] [directory/file]

[Command Overview]

■ This calculates and reports the number of line, word, and byte in the specified file.

■ User privilege — Normal user.

Raspberry Pi_Eng_10.9.1 “awk” Command

10.9 Commands Related to Data Manipulation

10.9.1 “awk” Command

The “awk” command reads the specified file, finds the line that has a value matching the specified pattern, and performs the specified operation if the pattern matches. Here, the operation means a field manipulation in a line or an arithmetic operation using a field value. The name “awk” comes from the names of three people who developed it, Aho, Weinberger, and Kernighan.

Awk is a programming language with features such as Shell programming, BC, and the C programming language. It works perfectly with BC, and field variables with names like Shell arguments $1, $2, and $3 can be used on each input line. It also has a printing and control operator similar to the C language.

Raspberry Pi_Eng_10.8.3 | (pipe) Command

10.8.3 | (pipe) Command

In Linux, there is a way to use the output from the execution of one command as input to another command, which is “|” (pipe) command. The word “pipe” here means that all incoming input to the pipe is not removed or sent elsewhere, but is passed to the exit as it is entered without loss of content.

Normally, when a command is executed, it receives input data from an explicitly specified file or input device, processes it in the manner specified by the command, and sends the result to the output.

Raspberry Pi_Eng_10.8.2 Redirection Command – Change Input and Output Device

10.8.2 Redirection Command – Change Input and Output Device

In Linux, when you run a particular command, it sends its execution results to a predefined output device. However, if necessary, the execution result can be sent to an output device other than the predefined output device.

It is “<" and ">” (redirection) that is used in this case. If you use this command, it sends the execution result to the output device specified after this command. “redirect” means to change the default input device and the default output device where are set as the keyboard and monitor to another device.

Note that there are several commands as follows for user to redirect input and output with:

■ < and << -- Sends the processing result of the right to the left. ■ > and >> — Sends the processing result of the left to the right.

■ < and > — Overwrite existing file if one exists

■ << and >> — Append existing file if one exists

Raspberry Pi_Eng_10.8.1 “xargs” Command

10.8 Commands to Adjust Input and Output

10.8.1 “xargs” Command

This command allows you to use the output of the previously executed command as an argument input to the next command.

[Command Format]

xargs [option] exec-command

Raspberry Pi_Eng_10.7.4 “exit” Command – Terminate Process

10.7.4 “exit” Command – Terminate Process

The “exit” command is used to terminate process while a process is in progress.

[Command Format]

exit [exit-status]

[Command Overview]

■ This terminates the running process and set the exit status to the specified value.

■ User privilege — Normal user.