Tag: bash
2 Useful Things to Know on the Linux Bash Command Line
2 Useful Things to Know on the Linux Bash Command Line
A couple useful Linux commands that I have shown a few people in the past are
Ctrl+A
This takes you to the beginning of the command line, so say you type out some ridiculously long command and you want to go back to the first character without holding down your arrow key for a minute, Ctrl+A will get you there.
!
When you put a “!” at the beginning of your command line it matches the following text with the most recently run command
Say you recently ran the following list of commandscd /var/log/httpd
tail -n100 error.log
vi /etc/httpd/httpd.conf
/etc/init.d/httpd restart
grep 127.0.0.1 *.log| tail -1if you type
!tail # this will run the tail command from the second line above as though you retyped “tail -n100 error.log”
!grep # (or even “!g”) will run the grep command from the fifth line above as though you retyped “grep 127.0.0.1 *.log| tail -1”
Those are my favorites for now ..