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

Written By
Web Webster
Web Webster
Feb 18, 2009

[ 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]”

Advertisement


Complete Story

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.