it was 0 days ago that I realized that a backgrounded job under Linux could be brought to the foreground by typing %1 (or %2, etc.)

· · Web · 7 · 7 · 23

@craigmaloney Back in my day we ONLY had fg, AND WE WERE GLAD FOR IT!

@craigmaloney @Capheind still thinking “fg 2” is easier to type than “%2” but good to know

@craigmaloney oh that's cool. I've always resorted to just typing "fg" but that's nice when you have several

Probably a function of bash verses older bourne shell.

@craigmaloney @djsundog Bonus points: if you need to log out but let a background process keep running: disown %1

@djsundog @futzle many jobs would have been saved from being stopped and run with nohup had I realized this little tidbit. thanks!

@craigmaloney Interesting. Which shell? I've used the `fg` command to do that in bash.

Handy tip: % to foreground the most-recently backgrounded job, and %- to foreground the second-most-recently backgrounded job.

Which is to say, with %- you can flip between two jobs.

It's TOS and NOS. (Top of stack and next on stack.)

@Capheind @dlek @mhmd @futzle

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!