linux中的jobs和ps命令有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11305588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 07:13:05  来源:igfitidea点击:

What is the difference between the jobs and ps commands in linux?

linuxunix

提问by Abhishek Gupta

Please tell me the differences in information displayed by two commands jobs and ps in unix operating system?

请问unix操作系统中job和ps这两个命令显示的信息有什么区别?

采纳答案by Alan Curry

jobsis a shell builtin. It tells you about the jobs that the current shell is managing. It can give you information that is internal to the shell, like the job numbers (which you can use in shortcuts like fg %2) and the original command line as it appeared before variable expansions.

jobs是一个内置的shell。它告诉您当前 shell 正在管理的作业。它可以为您提供 shell 内部的信息,例如作业编号(您可以在诸如 之类的快捷方式中使用fg %2)和出现在变量扩展之前的原始命令行。

psis an external command which can tell you about all the processes running on the system. (By default it only shows a small subset, but there are options to select larger sets of processes to display.) It doesn't know about the shell-internal stuff.

ps是一个外部命令,它可以告诉您系统上运行的所有进程。(默认情况下它只显示一个小的子集,但有选项可以选择更大的进程集来显示。)它不知道 shell 内部的东西。

回答by K1773R

jobs: shows the current jobs living in this terminal as example ->

工作:显示居住在此终端中的当前工作作为示例 ->

gedit &
jobs

this will show u gedit is running atm.

这将显示你 gedit 正在运行 atm。

if you close the terminal, gedit dies too, you can use disownso it wont die.

如果您关闭终端, gedit 也会死,您可以使用disown它不会死。

psis a totally different thing, its a process table display tool.

ps是完全不同的东西,它是一个过程表显示工具。