Sometimes called a command prompt or terminal.app, the shell is an interface to the kernel. A shell can be a GUI (Graphical User Interface), but for the purposes of this guide the shell will only refer to a command line shell. I use a standard POSIX shell.
Windows users, checkout WSL. Also, Visual Studio Code is a great tool for Windows, Mac, and Linux users. Just hit Ctrl+` to open a shell.
List every process currently running on the system. Each Process is identified by a PID. Use the PID to reference it in other commands.
ps -A
Background (bg
) / Foreground (fg
) a process.
bg <PID>
fg <PID>
bg 1234
fg 888
To terminate or stop a process use kill
. If it won't die. Add the -9 parameter
kill <PID>
kill -9 1337
Each of these programs (ps,fg,bg,kill) are in the system path. If they weren't, you would need to enter the full path to the program to start it. To find out whether a program is installed in your system path, and to find out where it is use the which
command.
which ps
On my system, ps
is installed at /bin/ps
. If I enter /bin/ps -A
it's functionally the same as writing ps -A
into the shell. This is because of a variable called $PATH. To see the value of the variable let's use the echo
command.
echo $PATH
These are all the directories on your system that are checked for programs. The shell can conveniently access these binaries without the user needing to provide a full path.