Pausing a long running program in the terminal?

Press Control+Z.

This will suspend the process and return you to a shell. You can do other things now if you want or you can return to the background process by entering % followed by Return.

Note that if you're doing this to something that needs to be responsive, you're going to tank the system, but if it's just something like a nano instance, everything should be okay.


This is bash job control

Use CTL-Z to stop the job.

Then you can type bg to run it in the background, if there's only on job it does exactly that.

If you have more than one you can use jobs to list then and use fg %N and bg %N to the desired effect.

Example:

ubuntu@ip-10-170-59-120:~$ find /usr -name "*.so"
/usr/lib/python2.7/dist-packages/OpenSSL/crypto.so
/usr/lib/python2.7/dist-packages/OpenSSL/SSL.so
/usr/lib/python2.7/dist-packages/OpenSSL/rand.so
/usr/lib/python2.7/dist-packages/gi/_glib/_glib.so
/usr/lib/python2.7/dist-packages/gi/_gobject/_gobject.so
/usr/lib/python2.7/dist-packages/gi/_gi.so
/usr/lib/python2.7/config/libpython2.7.so
...
^Z
[1]+  Stopped                 find /usr -name 

ubuntu@ip-10-170-59-120:~$ jobs
[1]+  Stopped                 find /usr -name "*.so"

ubuntu@ip-10-170-59-120:~$ fg %1
find /usr -name "*.so"
/usr/lib/php5/20090626+lfs/apc.so
/usr/lib/php5/20090626+lfs/memcache.so
/usr/lib/php5/20090626+lfs/mysql.so
...

For anything else not attached to the TTY you can use SIGSTOP and SIGCONT. So for example if you think a daemon is causing problems but you don't know which one it is, you can send the pid SIGSTOP, it's like hitting pause, then check for changes, OK that's not it, and rinse and repeat until you find the problem.

Hope this helps.


I know that this answer is a little bit late, but you can use the shortcut Ctrl+s to stop your programme (if you wanna may be read the output or something like this), then you can continue using the shortcut Ctrl+q.