Here are the ones I use often ( some of these are not bash specific ):
Emacs key bindings ( default with bash on FreeBSD )
- ^r reverse history lookup
- ^w delete previous word
- ^k delete all words from current position to end of line
- ^y paste text ( from deleted word )
- alt backspace delete word to a space/tab or '/'
If you want to use vi key bindings you can enable this with 'set -o vi'
Bash Variables:
- $$ current PID
- $! PID of last command
- !$ last 'word' of last command
$ ls -ald /bin
drwxr-xr-x 2 root wheel 1024 Dec 31 05:23 /bin
$ ls !$ | grep rm
ls /bin | grep rm
rm
rmail
rmdir
- !cmd rerun cmd with the same arguments
$ ls -ald /bin
drwxr-xr-x 2 root wheel 1024 Dec 31 05:23 /bin
$ !ls
ls -ald /bin
drwxr-xr-x 2 root wheel 1024 Dec 31 05:23 /bin
- !! rerun the last command
$ ls -ald /bin
drwxr-xr-x 2 root wheel 1024 Dec 31 05:23 /bin
$ !!
ls -ald /bin
drwxr-xr-x 2 root wheel 1024 Dec 31 05:23 /bin
No comments:
Post a Comment