Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ jobs command example     - Linux5.8 installed phpMyAdmin was unable to issue related php-mcrypt (Database)

- Based on Google Cloud Storage Mirroring open Maven Central Repository (Server)

- configuration ssh without password under Linux (Linux)

- Using Maven to download Spring (Linux)

- OpenSSL Introduction and compilation steps on Windows, Linux, Mac systems (Linux)

- Editor of the popular Linux Gvim (Linux)

- Bash added to the Vi mode indicator (Linux)

- Python system default encoding (Programming)

- Struts2 Result Types (Programming)

- To install the Oracle process notes on Oracle Linux 4u4 (Database)

- Why JavaScript basic types can invoke methods (Programming)

- How to write a new Git protocol (Linux)

- No password on Oracle and MySQL login (Database)

- Simple comparison of MySQL and Oracle in a sql analytical details (Database)

- Understanding the type in C ++ bitset (Programming)

- Cache implementation APP interacts with the server-side interface control Session (Server)

- Linux security settings Notes (Linux)

- lolcat: an output terminal rainbow effects in the Linux command-line tool (Linux)

- Install Ubuntu Software Center App Grid (Linux)

- To install PostgreSQL 9.4 (Database)

  jobs command example
  Add Date : 2018-11-21      
  I am a new Linux / Unix users. How can I use BASH in Linux or Unix-like systems / KSH / TCSH or POSIX-based shell to see the current jobs (job)? How to display the status of the current job on Unix / Linux? (LCTT Annotation: job, often referred to as "task")

Job control is the ability to stop / pause process (command) is executed in accordance with your request to continue / resume their execution. This is done by your operating system and such as bash / ksh, or POSIX shell and other shell to execute.

Jobs currently executing shell will be stored in a table, you can use the jobs command to display.


It displays the status of the job in the current shell session.


The basic syntax is as follows:


jobs jobID

jobs [options] jobID

Some job to start demonstration

Before you start using the jobs command, you need to first start multiple jobs on the system. Execute the following command to start the job:

### Start xeyes, calculator, text editor and gedit ###
xeyes &
gnome-calculator &
gedit fetch-stock-prices.py &
Finally, run the ping command in the foreground:

ping www.cyberciti.biz
Press Ctrl-Z key to suspend (suspend) ping command job.

jobs command example

To display the job status of the current shell, enter:

$ Jobs
Example output:

[1] 7895Running gpass &
[2] 7906Running gnome-calculator &
[3] -7910Running gedit fetch-stock-prices.py &
[4] + 7946Stoppedping cyberciti.biz
To display the process name to "p" at the beginning of the ID or job name, enter:

$ Jobs -p% p

$ Jobs% p
Example output:

[4] -Stoppedping cyberciti.biz
The character% is a designated tasks. In this example, you can use the job name at the beginning of string to suspend it, such as% ping.

How to display the process ID does not contain information other normal?

by jobs -l command (lowercase L) option lists detailed information about each job, run:

$ Jobs -l

Fig.01: Displays the status of jobs in the shell

How to list only the most recent status change process?

First, start a new job as follows:

$ Sleep100 &
Now, only hinted that since the last stop or quit after the operations, enter:

$ Jobs -n
Sample output:

[5] -Runningsleep100 &

Display only the process ID (PID)

-p option by jobs command displays only PID:

$ Jobs -p
Sample output:


How to display only the job that is running it?

-r option by jobs command displays only running jobs, enter:

$ Jobs -r
Sample output:

[1] Running gpass &
[2] Running gnome-calculator &
[3] -Running gedit fetch-stock-prices.py &

How to display only jobs that have stopped working?

-s option through the jobs command displays only stopped working a job, enter:

$ Jobs -s
Sample output:

[4] + Stoppedping cyberciti.biz
To continue with the ping cyberciti.biz job, enter the following command bg:

$ Bg% 4

About / usr / bin / jobs and shell built-in instructions

Enter the following command to find out whether the type jobs command shell builtin or external command or are:

$ Type -a jobs
Example output:

jobs is a shell builtin
jobs is / usr / bin / jobs
In almost all cases, you need to use the BASH / KSH / POSIX shell built-in jobs command. / Usr / bin / jobs command can not be used in the current shell. / Usr / bin / jobs command to work in different environments, and does not share his father bash / ksh shell the job.
- iOS developers - a simple factory pattern and OC reflection (Programming)
- Linux MultiPath software implementation instructions (Linux)
- Java inheritance initialization problem (Programming)
- Oracle Character Set Summary (Database)
- Linux System Getting Started Learning: Linux common log file (Linux)
- SQLite3 simple operation (Database)
- Share Java-based multithreading file case (Programming)
- Linux Shell Scripting multithreading (Programming)
- Linux Study of --CentOS create local yum repository (Linux)
- C ++ overloaded stream insertion operator and the stream extraction operator (Programming)
- Linux basic introductory tutorial ---- Software Installation under Linux (Linux)
- Linux 64-bit porting (Programming)
- sudo command scenario analysis (Linux)
- Android custom ViewPager create kaleidoscopic image transition effects (Programming)
- Ubuntu 15.10 under Python + Apache + CGI fully configured (Server)
- How to manage KVM virtual environments with command-line tools in Linux (Server)
- Linux ./configure --prefix command (Linux)
- Binary tree traversal: the first sequence in order preorder recursive and non-recursive and traversal sequence (Programming)
- IOS distributed management using GitHub project development (Linux)
- Using a proxy method under Linux terminal (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.