Tuesday, December 12, 2006

Save time with shell tricks

If u r administering a server without X, or even a normal Linux user, u often open the shell and type commands to do many everyday tasks. So now, i'm going to introduce some tricks for u to use shell better. These may save much time for u and may be make you find out some fun.

(1) Auto complement with Tab key:
If you're typing a long command or a long file name, u should only type some first characters and then press Tab key one or two times. Then, the shell will try to fill it for u.

(2) History:
Use up/down arrow key to get the previous/next command u've just use.

(3) Move:
^ + A or Home to move to the start of the line
^ + E or End to move to the end of the line
^ + left/right arrow key to move back/forward one word

(4) Delete:
^ + K to delete from the cursor to the end of the line
^ + X + Back space to delete from the cursor the the start of the line

(5) Change case:
Esc + U : change the text from the cursor position to the end of the line to Upper case
Esc + L : change the text from the cursor position to the end of the line to Lower case

Finally, u can change your bash shell configuration by editting the following files:
~/.bashrc and ~/.profile for user configure
/etc/bashrc and /etc/profile for global configure

Hope u have fun with these tricks!

No comments: