顯示包含「shell」標籤的文章。顯示所有文章
顯示包含「shell」標籤的文章。顯示所有文章

3/30/2011

在Linux下大量改變副檔名

雖然在linux之下副檔名並沒有什麼意義, 但是有時候為了辨識容易還是會用到.這裡提供一下在bash/C shell下如何大量改變副檔名

Bourne Shell:

for f in *.foo; do
 base=`basename $f .foo`
 mv $f $base.bar
done

C Shell:

foreach f ( *.foo )
 mv $f $f:r.bar
end

3/12/2010

make your own ls color

o. add this three line to your ~/.bashrc
alias ls='ls --color'
LS_COLORS='di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rpm=90'
export LS_COLORS

o. parameter meaning:
di = directory
fi = file
ln = symbolic link
pi = fifo file
so = socket file
bd = block (buffered) special file
cd = character (unbuffered) special file
or = symbolic link pointing to a non-existent file (orphan)
mi = non-existent file pointed to by a symbolic link (visible when you type ls -l)
ex = file which is executable (ie. has 'x' set in permissions).
o. color number:

0 = default color
1 = bold
4 = underlined
5 = flashing text
7 = reverse field
31 = red
32 = green
33 = orange
34 = blue
35 = purple
36 = cyan
37 = grey
40 = black background
41 = red background
42 = green background
43 = orange background
44 = blue background
45 = purple background
46 = cyan background
47 = grey background
90 = dark grey
91 = light red
92 = light green
93 = yellow
94 = light blue
95 = light purple
96 = turquoise
100 = dark grey background
101 = light red background
102 = light green background
103 = yellow background
104 = light blue background
105 = light purple background
106 = turquoise background