如何知道当前 bash 会话的进程 ID?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41787234/
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
How to know the process id of current bash session?
提问by Hind Forsum
I'm on a linux server and admin user. There're many admin users using this machine at the same time. So under current bash command line, how to know the current process id of the bash process I'm using?
我在 linux 服务器和管理员用户上。有许多管理员用户同时使用这台机器。那么在当前的 bash 命令行下,如何知道我正在使用的 bash 进程的当前进程 ID?
Thanks!
谢谢!
回答by v_sukt
You can use echo $$ to get the PID of the current Bash shell you are using.
您可以使用 echo $$ 获取您正在使用的当前 Bash shell 的 PID。