Linux command line and shell scripting buble

Chapter 4 More bash shell Commands

1. ps

ps -ef

 

2. top

 

3. kill 3940

kill -s HUP 3940

killall http*

 

4. df

df -h

5. du

du -h

 

6. sort

sort -n 

sort -r

sort -t ":" -k 3 -n

 

7. grep

grep three file1

grep -v

grep -n

grep -c 

 

8. tar

tar -cvf test.tar test1/ test2/

tar -xvf test.tar

tar -tf test.tar

 

 

Chapter 6: Using Linux Environment Variables

$mytest=(one two three four five)

$ echo ${mytest[1]}

$ echo ${mytest[*]}

$ mytest[2]=seven

$ unset mytest[2]

$ unset mytest

 

Chapter11: Basic Script Building

echo -n

 

testing=`date`

 

testing=$(date)

 

date +%y%m%d

 

$ wc << EOF

> test string1

> test string2

> EOF

 

$ expr 2 + 3

$ expr 2 \* 3

$var1=$[1+4]

$var1=$(echo "scale=4;3.44/5" | bc)

 

var5=$(bc << EOF
scale=4
a1 = ($var1 * $var2)
b1 = ($var3 * $var4)
a1 + b1
EOF
)

posted @ 2019-07-24 00:00  NewMan13  阅读(216)  评论(0编辑  收藏  举报