command line tricks

November 20, 2009 by nuno costa no comments Stumble It del.icio.us

commandline

Today I thought on sharing with you some bash command line tricks to help improve your productivity and help you earn a few geek points

This tricks will help you a lot and helps you to extent your keyboard live by saving a few hundredth strokes

we will dive into the bash history secrets and the ! (bang) command:

  • !!
    This bang command, when entered into the bash shell will run the previous command. It basically does the same thing as hitting the up arrow and hitting enter.
  • !command
    Ex: !ls
    This will run the last command that started with ‘ls’.
  • !command:p
    Ex: !ls:p
    This will display the command instead of running it.
  • !$
    Ex: !$ or echo !$
    The last word of the previous command. This the same as hitting Esc + . and is mainly useful for substitutions.
  • !$:p
    Instead of running the last word of the previous command this will print it out.
  • !*
    Runs the previous command without the first word.
  • !*:p
    This will print the previous command without the first word.
  • Ctrl + r
    Hit Ctrl + r and start typing, bash will search and show you the last command you rand that satisfies the search text you typed
  • Ctrl + s
    Everything you type will not be shown
  • Ctrl + q
    Inverts the effect of Ctrl + s, now everything is shown
  • Ctrl + a
    Goes to the beginning of the line
  • Ctrl + e
    Goes to the end of the line
  • Ctrl + w
    Deletes the previous word
  • Esc + Esc
    word compellation, it's the same as hitting tab
  • Esc + backspace
    Deletes until finding a delimiter, if hitting Esc + backspace on file.txt the .txt will be deleted

 

What are your favorite command line tricks ?

 

More from francodacosta.com

© francodacosta.com - All rights reserved