3

A bit more details, what I'm looking for is some kind of ^Z for sudo shells.

For instance when running a long command I can hit ^Z to suspend the command or when I do ~^Z in ssh after hitting Enter. Then I can simply do fg and get my long command/ssh session running again.

  • Have you considered running the root shell in a screen or tmux session? – n.st Jul 2 '14 at 0:18
3

You can use suspend (as long as you invoked the shell with sudo -s instead of sudo -i):

anthony@Haruhi:~$ sudo -s
[sudo] password for anthony: 
root@Haruhi:~# suspend

[1]+  Stopped                 sudo -s
anthony@Haruhi:~$ 

If you invoked it with sudo -i, you can use suspend -f to force it to suspend anyway; note that you need to be careful there (as if you did that to an actual login shell, it could be pretty difficult to resume it).

  • Awesome, I always use -s so I should be fine. Thanks! – foo Jul 1 '14 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.