Unixコマンド 自分用まとめ
ドットインストールでやってたUnixコマンドのやつまとめました。
login
$ ssh kimura@localhost
logout
$ exit
change password
passwd
move directory
$ pwd # view current directory $ cd [path] # move directory $ cd ~ # move to home $ cd .. # move to parent
see directory
$ ls $ ls -l # see detail infomation $ ls -a # see dotfile $ ls -la
change parmission
4: read 2: write 1: execute
$ # chmod *** [path] $ chmod 755 bin
create directory
$ mkdir [path]
delete directory
$ rmdir [path]
create file
$ vi
delete file
$ rm [path]
copy file
$ cp [from] [to]
move file
$ mv [from] [to]
see file
$ cat [file] # see all $ less [file] $ more [file] # page view (space key) $ head [file] # see 10 lines from head $ tail [file] # see 10 lines from tail $ tail -100 [file]
wild card
$ rm *.txt $ rm test?.txt # 1char
search file
# find [path] -name "[name]" -type [d/f] $ find . -name "test_*" $ find . -name "test_*" -type f # only file $ find . -name "test_*" -type d # only directory
grep file
$ grep [option] [str] [path] $ grep hoge * $ grep -c hoge * # count $ grep -r hoge * # include children directory $ grep -cr hoge *
shortcut key
- {tab} : auto input file/directory name
- {up/down} : show history
show command history
$ history # see command history $ ![id] # exec command id $ !! # exec just before $ !g # exec before command starting "g" $ !g:p # view before command starting "g"
see manual
$ man [command] $ man grep # [space] scroll, [q] quit
see directory tree
$ tree
see now datetime
$ date
see calendar
$ cal $ cal -y 2030 # see 2030 calendar
see file info
$ wc [file] $ wc -l [file] # line count