switching stopped processes in linux bash (using putty)

5

Accessing a remote server (Ubunty Hardy) through ssh (putty), i can stop running 'programs' with CTRL-Z (pause signal). I can have multiple paused jobs, which I can see with the command 'jobs'.

The question is regarding if it is possible (or if it already exists) to configure a shortcut to change between processes....

That is, a shortcut equivalent to:

PAUSE current process
fg 'next' (brings to foreground the next stopped application)

The goal is to achieve an equivalent to ALT-TAB via putty... : )

arod

Posted 2010-07-10T19:40:11.713

Reputation: 183

Answers

7

You would probably benefit from GNU screen (or the byobu variant on Ubuntu) to be able to switch between sessions. That way your other sessions keep running rather than being halted / suspended as you propose here.

Dirk Eddelbuettel

Posted 2010-07-10T19:40:11.713

Reputation: 1 191

yes, it's cool, i tried it... it changes a bit my shell, more features than needed... thanks ! – arod – 2011-02-03T21:27:26.707

4

You can use fg %n where the n is the job id you see in square brackets when using jobs. Also, you can use fg %- for previous job.

See http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html Section 3.203 Job Control Job ID

niry

Posted 2010-07-10T19:40:11.713

Reputation: 176

@niry: Or just do fg n without the percent. :) Anyway, I think he's asking if you can configure one key to effectively type ^Zfg $(tail jobs | cut -f1 "-d ") or similar. – Lucas Jones – 2010-07-10T19:49:54.600

exactly, that's what i'm looking for – None – 2010-07-10T19:51:37.500

i know about "fg n", but im looking if its possible to configure a shortcut to do ^Zfg $(tail jobs | cut -f1 "-d ") or similar – None – 2010-07-10T19:55:26.480

In that case, screen is your friend, my friend. 1up @Dirk. – niry – 2010-07-10T19:59:20.030

1From Windows, use putty as before. Then on the server, launch screen (or, preferably, byobu) and add additional sessions between which you can switch. – Dirk Eddelbuettel – 2010-07-10T21:01:32.600