Skip to content

Linux Miscellaneous

Links: 104 Linux Index


Miscellaneous

$ commands

  • $$: Get the PID of the current process.
  • $?: Get the return code of the last executed command.
  • $#: Get the number of arguments in $*.
  • $*: Get the list of arguments passed to the current process.

Process Tree

  • We can view the process tree of any command by first getting its PID and then using pstree: pstree -p <pid>
  • Get all the process with pid: pstree -p
  • Linear hierarchy: pstree -ps <pid>

Last updated: 2023-05-15