I often find myself in the following position: I've started typing a long command at the bash prompt, but half-way through I find out I need to check something with another command. This is a problem when I'm at the console (no X), which is often the case, because then I only have the following unsatisfactory ways to do it, that I know of:
- Hit ctrl+alt+F2 and log in on another virtual console, and find out what I wanted, then go back and continue
- ctrl+a, type echo + space + enter, find out what I wanted, press ↑ until I find my command, ctrl+a, del x 5, ctrl+e, and continue
- Highlight what I've typed so far with my mouse (if gpm is running, which it usually is), press ctrl+c to interrupt, find out what I wanted while being careful not to use my mouse to highlight stuff, then press middle mouse button on a new prompt and continue
- Pray to the command line gods that the half-written command will have no adverse effects but simply fail, and gingerly press enter, then find out what I wanted, press uparrow until I get my command back, and continue
- Jump into my time machine, travel back in time and remind myself to start screen before starting to type command, travel back to the present, press ctrl+a c, find out what I wanted, press ctrl+a ctrl+a, and continue
So what I want to know is, is there some more elegant way of doing this? A sort of subshell-command or similar?
I'm most interested in methods that do not require any preparations or setup to work.