$ man bash
Commands for Moving
beginning-of-line (C-a)
Move to the start of the current line.
$ echo $SHELLOPTS SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
set -o emacs
| Operation | Commands | appendex |
|---|---|---|
| Move to the start of the current line. | Ctrl + a | Ahead |
| Move to the end of the line. | Ctrl + e | End |
| Move back a character. | Esc - b | Back |
| Move forward to the end of the next word. | Esc - f | Forward |
| Operation | Commands | appendex |
|---|---|---|
| Kill the word behind point, using white space as a word boundary. | Ctrl + w | |
| Kill the text from point to the end of the line. | Ctrl + k | |
| Kill backward from point to the beginning of the line. | Ctrl + u |
| Operation | Commands | appendex |
|---|---|---|
| Clear the screen leaving the current line at the top of the screen. | Ctrl + l | |
| Ctrl + c | ||
| Ctrl + s | ||
| Ctrl + q |
| Operation | Commands | appendex |
|---|---|---|
| Fetch the previous command from the history list, moving back in the list. | Ctrl + p | |
| Fetch the next command from the history list, moving forward in the list. | Ctrl + n | |
| Search backward starting at the current line and moving `up' through the history as necessary. | Ctrl + r | 'Esc' is cansel this operation. |
set -o vi
$ echo 192.168.0.{100,101}
192.168.0.100 192.168.0.101
$ echo 192.168.0.{100..102}
192.168.0.100 192.168.0.101 192.168.0.102
$ H=`echo 192.168.10.{1..15}`
$ for i in $H ; do echo $i ; done
$ for i in $H ; do host $i ; done
$ cp hoge.txt{,.org} <- copy and .org
$ mv filename{,.org} <- add .org
$ mv filename{.org,} <- delete .org
$ mkdir {dir1,dir2,dir3}
$ ls
dir1/ dir2/ dir3/
$ mkdir dir{1,2,3}
$ ls
dir1/ dir2/ dir3/
$ cp images/{foo,bar}*.gif ~/
$ cp {foo,bar}.jar ~/
$ for i in `ls -1` ; do echo $i ; done
$ for i in `ls -1` ; do cp $i{,.new} ; done
## From *.org To .new
$ for i in *.org; do cp $i ${i%.org}.new ; done
$ date;for i in 192.168.0.{10,11} 192.168.1.{1..5} ; do ssh $i "uname -n;/sbin/ifconfig | grep add" ; echo ; done
$ HOGE="abcdef"
$ echo ${HOGE:0:2}
ab
$ echo ${HOGE:2:2}
cd
$ echo ${HOGE:4:2}
ef
$ echo ${HOGE:2}
cdef
$ echo ${HOGE:0:-2}
abcd