Linux Blog

Bash Tips for more efficient terminal usage

Filed under: Linux Software,Linux for Newb's — TheLinuxBlog.com at 5:36 pm on Monday, November 23, 2009

Here are some tips for working in the shell that I use on a daily basis. These may be known to most veterans, please contribute your favorite shortcuts to the comments. But for the most part this is not for the uber leet Linux geek, this is for those new to the terminal.

TAB
- Gives you suggestions / completes stuff for you. Type a, Press it twice, it will make your life a lot easier.

ctrl+w
- Remove word behind cursor.

ctrl+u
- Undo / Erase everything from cursor to beginning of the line

!!
- Type out whatever you typed out last, can be combined with tools like sudo

alt+f
- Go forward to the end of the previous word

alt+b
- Move cursor back to the beginning of the previous word

ctrl+d
- You’re done? Press ctrl+d to logout. If you’re in a virtual terminal, it may also close the window.

ctrl+z
- Stop the current process. Say you run gvim, and then you want to spawn another process. Press ctrl+z, then type bg. Once you’re done with the “other” process, you may type fg to bring it back into the foreground.

Command of the day: chvt

Filed under: Linux Software — TheLinuxBlog.com at 1:07 pm on Monday, July 14, 2008

Changing virtual terminals is almost essential for the Linux system administrator. If you don’t know what I mean by this then try pressing CTRL+ALT+F5 once you are there press CTRL+RIGHT ARROW until you get back to your display (should be two or so times depending on your distribution)

Until a few minutes ago I didn’t know that this could be done by the command line. chvt is a nifty command to change virtual terminal. Basically all you have to do is type “chvt 2″ to change to tty2. I found it while I was looking for a solution to open up a view of other active terminals.

This could be handy if your on a laptop or your function keys are missing / broken.