首页 > 代码库 > Shell cmd set note

Shell cmd set note

1,expr

a)expr calculate//a=10;echo `expr $a - 1 `

b)string index //a=‘abcde‘;echo `expr index $a "b"`|| string substr// a=‘abcde‘; echo `expr substr $a 2 3`

c)regrexp// a=

2,echo

a)string len//echo ${#a} ||string index//echo ${a:1:4}

centOs install emacs-nox :yum -y install emacs-nox

 3,ps -ef | grep docker | grep -v "color=auto" | awk -F " " ‘{print $2}‘ | xargs kill -9 //stop all docker process

 4,awk

voh@linux-i8n8:~> yes | head -5 | awk ‘{printf("user_%d 12345 user_%d@qq.com\n",NR,NR)}‘

user_1 12345 user_1@qq.com
...

5,ps axw -o pid,ppid,user,%cpu,vsz,wchan,command | egrep ‘(nginx|PID)‘    

Shell cmd set note