shell1

shebang = sharp-bang = #!

 

1.echo $PATH

   export PATH="$PATH:/home/user/bin"

PREPEND

prepend() { [ -d "$2" ] && eval $1=\"$2':'\$$1\" && export $1; }

2.echo -e "\e[1;31m This is red text \e[0m"

0 black 30 red 31 green 32 yellow 33 bule 34 yangred 35 qing 36 white 37

backgroud color 0 black 40 red 41 green 42 y 43 bule 44 yangred 45 qing 46 white 47

 

3.env

cat /proc/$PID/environ

pgrep gedit  -> serch process ID

4.let (()) [  ]   bc

echo "scale=2;22/7" | bc

5.$?

echo $?

6. command | tee FILE1 FILE2  | otherCommand

cat a* | tee -a out.txt | cat -n     # -a  add

7.declare -A ass_array

8.alias rm='cp $@ ~/backup && rm $@'

unalias

\command 

 

&& yu

||  huo

-eq =

-ne  !

-gt >

-lt <

-ge >=

-le <=

9. if condition;

then

commands;

fi

 

if conditon;

then

commands;

else if condition; then

commands;

else

commands;

fi

10.

 find

find . -type f -print

file type : f l d c b s p

-atime

-mtime

-ctime

find . -type f -atime -7 -print

-amin

-mmin

-cmin

find . -type f -amin +7 -print

-newer

find . -type f -newer file.txt -print

find . -type f -size +2k

-2k

2k

find . -type f -perm 644 -print

find . -type f -name "*.php" ! -perm 644 -print

find . -type f -user slynux -print

find . -type f -name "*.swp" -delete

find . -type f -user root -exec chown slynux { } \;

find . -type f -name '*.c' -exec cat { } \;>all_c_files.txt

find . -type f -name '*.c' -exec cat { } >all_c_files.txt \;

find . -type f -name '*.c' -exec cat { } >all_c_files.txt +

find . -type f -mtime +10 -name "*.txt" -exec cp { } OLD \;

find . -type f -name "*.txt" -exec printf "text file: %s\n" { } \;

11. xargs

echo "split1Xsplit2Xsplit3X" | xargs -d X

echo "splitXsplitXsplitXsplit" | xargs -d X -n 2

转载于:https://www.cnblogs.com/zhg1016/p/10522153.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值