bash – using the vi mode more effectively.

Vi blogging bundle
Vi blogging bundle (Photo credit: pedro mg)

You can first set the bash mode to vi. This will enable some vim like features to bash. So, add this to .bashrc :

set -o vi

Once, you have done that then its time to get more out of the vi mode. First, check some things and set some interesting stuff.

#Display all the bindings :
bind -P

#Copy the current bindings and use it in inputrc:
bind -p |grep -v self-insert>~/.inputrc

In the inputrc, so generated, all the functions and macros not bound are commented with “#” and you can set them to your choice as in other examples.

And here is a link that can get you started.

http://www.catonmat.net/blog/bash-vi-editing-mode-cheat-sheet/

 

Enhanced by Zemanta

force recheck on reboot – fsck

If you want to force a fsck re-check on reboot, then just

touch /forcefsck

 

Enhanced by Zemanta

using `!#$’ to referance backward-word

Operating System Tablet Strategy
Image by jeffalldridge via Flickr

Here is something that I found on the commandlinefu

cp /work/host/phone/ui/main.cpp !#$:s/host/target

Ah well…its very interesting and very useful.

Some explanation:

!# – means the current command (similar to !! being the last command)

$ – represents the last parameter

:s – is used for substitution.

Enhanced by Zemanta