Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the job control methods of Bash and KSH shell under Linux/Unix

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what are the operation control methods of Bash and KSH shell under Linux/Unix". In the daily operation, I believe that many people have doubts about the operation control methods of Bash and KSH shell under Linux/Unix. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "what are the operation control methods of Bash and KSH shell under Linux/Unix"! Next, please follow the editor to study!

What is homework control?

Job control is not only the ability to stop / suspend (stop/suspend) ongoing processes (commands), but also to continue / continue/resume to execute every process you need. This can be done with your operating system and shell or POSIX shell like bash/ksh.

Who provides the environment for job control?

Bash / Korn shell, or POSIX shell, provides an environment for job control.

Say hello to the homework list.

Your shell will have a form for the current assignment, called the assignment table. When you type a command, shell assigns it a jobID (also known as JOBSPEC). A jobID or JOBSPEC is only a small integer value.

# 1: create your * * Linux/Unix job

I'm going to run a command called xeyes, which displays two oval eyes on the screen. Type: $xeyes &

Sample output:

Fig.01: running the xeyes command in the background

I use the & symbol to have a job run in the background. Shell prints a line of information similar to the following:

[1] 6891

In this example, there are two numeric outputs that indicate:

1: the job number of the xeyes task executed in the background is 1.

6891: the process ID of Job 1.

I'm doing some more job:

# # launch a text editor, display the system load of X, and sleep command # # gedit / tmp/hello.c & xload & sleep 100000 &

# 2: list current jobs

To view the active task status of the current shell, enter:

$jobs $jobs-l

The output is as follows:

[1] 9379 Running xeyes & [2] 9380 Running gedit / tmp/hello.c & [3]-9420 Running xload & [4] + 9421 Running sleep 100000 &

A brief description is as follows:

You can also use the ps name to list the processes currently running on the system:

$ps#3: stop or suspend a running job

Press the [Ctrl]-[Z] key or use the kill command, as follows:

Kill-s stop PID

For example, start the ping command and then use the Ctrl-Z key to stop the ping command job:

Animated gif 01: suspend ping command job

At this point, the study on "what are the homework control methods of Bash and KSH shell under Linux/Unix" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report