I am gradually getting used to the CLI for Ubuntu. I am used to switching between windows when editing a file, going to the command line to run a cmd, and then back again etc.

I feel severly restricted by the CLI, as it seems I can only do one thing at a time. Surely, there must be a way where I can 'switch between' several command line consoles?

Also, I am using vim, and I sometimes need access the command line. At the moment, I have to quit vim to get to the CLI, and then start vim again. This is not very productive.

can someone tell me how to switch between CLI screens/consoles and also how to switch to the CLI from withinin vim and then back to vim again without having to close vim?

BTW, my distro is Ubuntu Lucid Lynx (10.04 LTS)

  1. press ctrlz to suspend vim and put it into the background of your current shell.
  2. do something else
  3. with jobs you get a list of your background jobs
  4. use %N (N being the nth background job) or just fg (if it is the only background job) to bring vim back to foreground.

this whole topic is covered by the term "Job Control". you can read more about it:

regarding your "switching virtual terminals" issue: i would also advise you to use either screen or tmux as a terminal multiplexer instead of switching virtual terminals.

alt text

| improve this answer | |
  • whats wrong with switching virtual terminals? – Zeta2 Jul 12 '10 at 9:20
  • it takes longer than "ctrl+a c", you can not detach from it and reattach your session (aka you can not logout of the machine while your stuff is still running, you can not switch to an xterm and continue your work there) .. etc etc etc – akira Jul 12 '10 at 9:32
  • ah, tx 4 clarification – Zeta2 Jul 12 '10 at 9:48
  • I'd suggest tmux over screen, but it's really user preference. Once you get used to it, you'll definitely keep using it. – Rob Oct 25 '11 at 19:43

It sounds like you are using a full GUI desktop and using the Terminal program to do occasional commands on the local machine.

Assuming that is the case, then you can do any of:

  • open multiple instances of the Terminal program
  • open multiple tabs within the Terminal program, using Ctrl-Shift-T (or the menu or right click)
  • install the terminator program (sudo apt-get install terminator) - it allows you to split your screen horizontally using Ctrl-Shift-O or vertically using Ctrl-Shift-E (or using right click) - so you can end up with something like this screenshot:

terminator screenshot

| improve this answer | |

L_AltF1 through L_AltF12 with switch between VT1 through VT12, and L_AltL_ShiftF1 through L_AltL_ShiftF12 with switch between VT13 through VT24. L_CtrlL_AltLeft and L_CtrlL_AltRight can be used to cycle between active virtual terminals. openvt can be used to activate another virtual terminal.

You can also use screen to have multiple console areas on the same VT.

| improve this answer | |

You don't have to quit vim, you can run a shell from within it using the :sh command. When you're finished in the shell, just enter exit at the shell prompt to return to vim. This gives you another technique to choose from.

| improve this answer | |
  1. You can edit multiple files in different "windows" inside Vim with vertical (:vs) and horizontal split (:sp).

  2. The above trick can also be combined with the Vim plugin Conque which allows you to run any terminal command inside Vim, e.g. a shell.

I often split Vim windows to edit several files, but I use tmux if I need to combine Vim with a shell in a single terminal. I haven't had good experiences with the Conque plugin personally, but I thought I could mention it to help complete the discussion.

| improve this answer | |

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.