Powered by Blogger.

Tuesday, February 23, 2010

CRAZY COMMANDS

  • Often, commands on the console may span many lines, and encountering a type mistake at the beginning of the command would require you to use the slow way of punching the right/left arrow keys to traverse in the command string.

Remedy:
Try Ctrl+e to move to the end of the command string and Ctrl+a to reach
start.It’s the fastest way to edit a Linux command line. To delete a word in the
command string, use Ctrl+w.

  • Another wonder of a simple shell variable is !$. Let’s say you have to create a directory, go into it and then rename it. So the flow of commands would be:

$ mkdir your_dir
        $ mv your_dir my_dir
$ cd my_dir

Remedy: Well, Linux has a shorter and quicker way:

$ mkdir your_dir
$ mv !$ my_dir
$ cd !$

!$ points to the last string in the command string. This is useful in various scenarios where the last word of command string is to be used in subsequent commands (almost with all Linux commands like vi, tar, gzip, etc).


0 comments

Post a Comment