Thursday, December 2, 2010

Linux Amazing Keypresses & Commands : Set 4

1. command
$sudo !!
After executing this command, you have to never think about typing sudo. When you type enter     after typing sudo !! , user password prompt will appear & after entering password, the user don't need to enter sudo before the commands.

2. pressing [tab] twice
    This is the favorite keypress used by linux users. It's useful tool for auto completion of commands. Type initial characters of a command & hit tab twice. Eg. type if & hit tab twice. shell will display all the possible commands beginning with if like 'ifconfig'.



3. pressing [Ctrl] + [R]
    This will allow you to search the command history. After hitting [Ctrl] + [R],  type some letters of the command you want to search.
Note It's same as executing command >history | grep

4. command
$history |tr '\011' ' ' |tr -s " "| cut -d' ' -f3 |sort |uniq -c |sort -nbr |head -n10
     This command will display the top 10 used commands. What it does - it sorts all the commands in the history & arrange them as per their frequency of occurrence. If you want to display top 20 previously executed commands, replace 10 with 20.

No comments:

Post a Comment