How to know which command is being executed without stopping it?
Solution 1:
If you want to see the full command line for every instance of make
that is running on your computer, open a new terminal and try:
pgrep -a make
pgrep
is a program that searches through all processes on your computer. In this case, it is looking for programs named make
. The option -a
tells pgrep
to list both the process ID and the full command line for each matching process. (Without -a
, it would just return the process ID.) For more information on pgrep's many options, see man pgrep
.
Solution 2:
While the terminal window is active you can pause (suspend) the process by pressing Ctrl+Z. You can then push the job in the background by typing bg
(your job will now continue in the background and you can at the same time work on the command line; this is equivalent to starting a job with &
at the end of the command line). Then use cursor-arrows (up and down) to see which command you used. If you want (but this is not necessary) you can then get your job to the foreground by typing fg
.
Solution 3:
I do something like Stefan: ^Z to pause the job, and then I run jobs
. If you have multiple processes running, you may have to sort out which job was the one you paused, but this generally will give the command line. Then run fg
to continue execution.