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?
Thanks!
Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column. Click on any column name to sort.
In this quick article, we've explored how to get the name and the command line of a given PID in the Linux command line. The ps -p <PID> command is pretty straightforward to get the process information of a PID. Alternatively, we can also access the special /proc/PID directory to retrieve process information.
There is a special variable called "$" and "$BASHPID" which stores the process ID of the current shell. Go ahead and run the below command to see what is the process ID of your current shell.
You can use echo $$ to get the PID of the current Bash shell you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With