Raspberry Pi_Eng_10.7.3 Executing Program on Background/Foreground

10.7.3 Executing Program on Background/Foreground

Normally when we execute a command, after one command is completed, the next command is executed. We call this method of processing the foreground mode. In this way, another command can not be entered while you are working on one operation. The Raspberry Pi system always executes the command in foreground mode unless any special instruction is not issued.

Some of the tasks that you perform on the system may end in a short time, but there may be work that takes quite a while. If you have a job that takes a long time, you can start another job after it finishes, but if the next job to process is not related to the current processing job, it is possible to start the next job immediately without waiting for the current processing job to finish.

Raspberry Pi_Eng_10.7.2 “;” Command – Execute Multiple Commands Successively

10.7.2 “;” Command – Execute Multiple Commands Successively

Linux provides a way to enter and process all the commands at once, if you have multiple commands to process. To execute several commands at once in this way, link each command with the “;” command as follows.

Raspberry Pi_Eng_10.7.1 “which” Command – Check Path Name of Executable File

10.7 Commands Related to Program Execution

10.7.1 “which” Command – Check Path Name of Executable File

The “which” command tells you what program is actually being used when executing certain command on the system. In fact, many programs are installed in many places in the system, so it is often difficult to judge which program is actually used. The “which” command is used in this case.

Raspberry Pi_Eng_10.6.2 “||” Command – Execute Command by “or” Method

Original Book Contents
10.6.2 “||” Command – Execute Command by “or” Method

This command processes the next command when the first command does not processed normally, and sets the exit status by “or” operation according to the final processing result of the both commands.

Raspberry Pi_Eng_10.6.1 “&&” Command – Execute Command by “and” Method

10.6 Commands Related to Selective Execution

Normally, when a command is processed normally, the exit status is set to zero, which is ㅅtreated as “True”. On the other hand, if the command is not processed normally, the exit status is set to a non-zero value, which is treated as “False”.

10.6.1 “&&” Command – Execute Command by “and” Method

This command processes the next command if the first command is processed normally, and sets the exit status by “and” operation according to the final processing result of the both commands.

Raspberry Pi_Eng_10.5.2 “test” Command – Logical Operation

10.5.2 “test” Command – Logical Operation

This command checks the status of the file or performs a logical operation to specify exit status according to whether the result is “True” or “False”.

Raspberry Pi_Eng_10.5.1 “expr” Command – Arithmetic Operation

10.5 Commands Related to Operation

10.5.1 “expr” Command – Arithmetic Operation

You can use the “expr” command to perform arithmetic operations.

Raspberry Pi_Eng_10.4.4 “alias” Command

10.4.4 “alias” Command

On Linux, there is a feature that allows you to specify an alias name for a certain string in advance, and then use the defined alias name later instead of the string. The command to use at this time is the “alias” command.

Raspberry Pi_Eng_10.4.3 “man” Command – Get Help on Commands

10.4.3 “man” Command – Get Help on Commands

Most of the commands used in Linux can perform a variety of functions in a single command. In order to correctly execute these various functions provided by a specific command, the command must be input in various formats. Also, the execution result of the command is displayed in various types and various forms. In reality, for each command, we can hardly remember all necessary knowledge about what functions the command can do, and how to instruct the command, and how to understand the outcome of the execution.

So Linux provides detailed help for each command. With the help, users can search various informations that they can not remember when they need it, and solve the problem. The “man” command is used in this case.

Raspberry Pi_Eng_10.4.2 “echo” Command

10.4.2 “echo” Command

This command displays the specified text on standard output. It is not necessary for common task, but is often used to display information about various progresses when writing bash scripts.