Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ jobs command example     - Linux Getting Started tutorial: GNU C and Vim will fight the C / C ++ IDE semi-automatic (Linux)

- Analysis of Java in the deep copy and shallow copy (Programming)

- Cool Android realization SVG animation (Programming)

- hexdump Linux command (Linux)

- Installation of Python2.7.10 under CentOS 6.4 (Linux)

- Android imageView in the Src and Background (Programming)

- Hibernate Search 5.5 in the search results sorted (Linux)

- How to use Linux to download music from Grooveshark (Linux)

- Linux System Getting Started Learning: After starting in Ubuntu or Debian, enter the command line (Linux)

- Nginx supports user multi-threaded downloads and resume broken (Server)

- How to enable fbcon in Debian (Linux)

- Linux kernel panic (because glibc result) Repair (Linux)

- Android custom controls create the simplest skid menu in the history (Programming)

- CentOS7 install MySQL 5.5 (Database)

- How to install and use the malware detection tool LMD and ClamAV antivirus engine on Linux (Linux)

- Java integrated development environment common set of operations (Linux)

- SLF4J Tutorial (Programming)

- Encounter ORA-00600: internal error code, arguments: [4194] ORA-1552 (Database)

- Dialogue UNIX:! $ # @ *% (Linux)

- 20+ Best Practices article MySQL Performance Optimization (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.

use

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

grammar

The basic syntax is as follows:

jobs
or

jobs jobID
or

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
or

$ 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:

7895
7906
7910
7946
7949
 

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.
     
         
         
         
  More:      
 
- Ubuntu install perfectly handsome terminal Guake 0.8.1 (Linux)
- Linux remote wake the computer original code [C] (Linux)
- Eight sorting algorithm implemented in Python (Programming)
- Let Linux operating system more secure (Linux)
- Linux / UNIX: Use the dd command to create a 1GB size binary (Linux)
- Ora-14450: attempt to access ah transactional temptable already in use (Database)
- Setting grep Highlight Matches (Linux)
- SSH port forwarding application (Server)
- Linux batch copy data script (Linux)
- Mac OS X 10.9 compiler OCI8 module (Programming)
- Linux iptables: basic principles and rules (Linux)
- Zookeeper cluster deployment (Server)
- What is Unikernel? (Linux)
- Enable Intel Rapid Start in GNU / Linux (Linux)
- About AWR More Description (Database)
- Parameters of the extra port MySQL 5.6 (Database)
- JavaScript event handling Detailed (Programming)
- Binary tree and some basic operations with binary list (Programming)
- Installation and operation GAMIT software under Linux operating system (Linux)
- Five programming fallacy (Programming)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.