Thursday, April 16, 2009

You Learn Something New Every Day

I think I must have been off school the day we did the beginner's Unix class. I noticed some weirdness in my apache error logs today, even weirder, the user was apparently using my own external IP address. After a bit of investigation I noticed that w3m was running on my server, on pts/5, which according to who I was on using bash. I first had to look up tty and pts. Ok, got that. Now switch screens and find pts/5, but w3m doesn't seem to be running. A helpful colleague asked if I'd tried fg, which I'd never even heard of. Turns out you can send processes to the background using ctrl-z* and bring them back with fg, would you believe it? Guess that's how people survive without screen.

* I had wondered sometimes what happened to processes went when I hit ctrl-z accidentally, doh.

6 comments:

Gez Page said...

`bg` shows your backgrounded processes also.

I thought at first it was going to be something I'd run on your server a long time ago and forgot about. Often find that I've left a screen session running with a logged in root prompt. oops!

Jamie said...

Shhhh!

\revokes sudo perms

Gez Page said...

ok just realised thats bollocks - it's `jobs` that shows backgrounded processes. `bg` starts backgrounded processes to actually run in the background, ctrl+z actually freezes the process and fg brings it back, but bg will start it running in the background....

Jamie said...

Well bg seems to list background processes on my box. Unfortunately I don't seem to have a manual entry for it.

Gez Page said...

maybe thats why I was confused. whatis for the 2 commands on gentoo:

jobs (1p) - display status of jobs in the current session

bg (1p) - run jobs in the background

Gez Page said...

hey have you seen this?

http://portableubuntu.demonccc.com.ar/

runs ubuntu within windows, it's actually pretty good too.