Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

  • Corporate e-Learning technology has a long and diverse pedigree. As far back as the 1980s, companies were adopting computer-based training to supplement...
    Download

  • On-demand Event Event Date: June 12, 2014 In the past, IT service management (ITSM) and IT infrastructure library (ITIL) basics might have been more...
    Download

More on LinuxToday


Simple Unix And Linux Shell Tricks To Save You A Few Gray Hairs

Feb 18, 2009, 18:34 (3 Talkback[s])
(Other stories by Mike Tremell)

[ Thanks to Mike Golvach for this link. ]

"Rather than stand for that, just do the following thing whenever you log into your shell. Always make sure that you have line editing enabled. In bash, ksh, etc, if you want to enable vi line editing, all you need to do is type:

"host # set -o vi

"on the command line or, better yet, at it to your .bash_profile, .profile or .bashrc, so line editing will get set every time you log in and you won't have to always remember to do it. If you like emacs, just replace vi in the example above. This way, once you get to the end of that long line, you can type (literally)

"[esc]0i#[enter]

"That's the escape key (to get into vi command mode), the number 0 (to whisk you back to the beginning of the line), the letter i (to get you out of vi command mode and into insert mode) and the pound (#) symbol (to make the whole line a comment) and then the enter key. This will cause your line to become a comment, just like in a shell script and the shell won't execute it. Then you can type your preceding line and (assuming vi again) type:

"[esc]kkx[enter]"

Complete Story

Related Stories: