一般

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 壓縮解壓logs
tar -zcvf 2013-12.tar.gz *.2013-12*
rm *.2013-12*
tar -zxvf 2013-10.tar.gz
# check 硬碟狀況
df
# 查程式pid
ps -ef | grep glassfish
# 強制停止程式
kill -9 <pid>
# 啟動service
service <service name> start
# 列出folder下全folder size(exclude hidden files)
du -sh *
# 列出folder下全folder size(only hidden files)
du -hs .[^.]*
# 列出folder下全folder size(include hidden files)
du -hs .* *
# ssh上傳file
scp <filename> username@hostIP:<remote folder>
scp test.sql cwza@localhost:/usr/local
# ssh下載file
scp username@hostIP:<remote file> <local folder>
scp cwza@localhost:/usr/local/test.sql ~/data
# mkdir 若上層不存在自動建立,若已存在該資料夾則略過不會有錯誤
mkdir -p /tmp/foo/bar
# count numbers of word and line in a file
wc -w file
wc -l file
# trace a live log file
tail -f logfile | ag print

tree

需安裝tree套件
http://www.computerhope.com/unix/tree.htm

1
2
3
4
5
6
tree -a # list all files include hidden files
tree -d # list directories only
tree -C # colorized output
tree -I __pycache__ # ignore some name
tree -L 2 # limit Depth
tree -N #解決中文亂碼