linux基础符号

时间:2020-03-15 10:10:15   收藏:0   阅读:75

#

* root用户命令提示符

```

[root@wenhaha wenhaha]#

```

 $

* 普通用户命令提示符

```

[wenhaha1@wenhaha wenhaha]$

```

* awk中表示列

```

[wenhaha1@wenhaha wenhaha]$ cat wenhaha1.txt

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

-bash: ech: command not found

[wenhaha1@wenhaha wenhaha]$ awk ‘{print $1}‘ wenhaha1.txt

123343

wenhaha

-bash:

```

 >

* 标准输出重定向

```

[root@wenhaha wenhaha]# echo wenhaha > wenhaha1.txt

[root@wenhaha wenhaha]# cat wenhaha1.txt

wenhaha

```

* 错误输出重定向

```

[root@wenhaha wenhaha]# ech > wenhaha1.txt

-bash: ech: command not found

[root@wenhaha wenhaha]# cat wenhaha1.txt

[root@wenhaha wenhaha]# ech 2> wenhaha1.txt

[root@wenhaha wenhaha]# cat wenhaha1.txt

-bash: ech: command not found

```

*追加输出重定向

```

[root@wenhaha wenhaha]# cat wenhaha1.txt

123343 3423543 45345 345

[root@wenhaha wenhaha]# echo "wenhaha wenhaha wehan wehshdf " >> wenhaha1.txt

[root@wenhaha wenhaha]# cat wenhaha1.txt

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

```

* 2>>错误追加输出重定向

```

[root@wenhaha wenhaha]# cat wenhaha1.txt

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

[root@wenhaha wenhaha]# ech "wenhaha wenhaha wehan wehshdf " >> wenhaha1.txt

-bash: ech: command not found

[root@wenhaha wenhaha]# ech "wenhaha wenhaha wehan wehshdf " 2>> wenhaha1.txt

[root@wenhaha wenhaha]# cat wenhaha1.txt

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

-bash: ech: command not found

```

 <

* 输入重定向

```

[root@wenhaha wenhaha]# echo "123343 3423543 45345 345" > wenhaha1.txt

[root@wenhaha wenhaha]# column -t < wenhaha1.txt

123343 3423543 45345 345

```

* 追加输入重定向

```

[root@wenhaha wenhaha]# echo << wenhaha

> wefkwejfksd

> wehfsdfs

> wenhaha

```

 

 |

 

* 管道

```

[root@wenhaha wenhaha]# cat wenhaha1.txt | wc -l

3

[root@wenhaha wenhaha]# wc -l < wenhaha1.txt

3

```

 

* | xargs

 

```

[root@wenhaha wenhaha]# ls wenhaha1.txt |xargs wc -l

3 wenhaha1.txt

[root@wenhaha wenhaha]# wc -l wenhaha1.txt

3 wenhaha1.txt

```

&&

```

[root@wenhaha wenhaha]# ech wenhaha && cat wenhaha1.txt

bash: ech: command not found

[root@wenhaha wenhaha]# echo wenhaha && cat wenhaha1.txt

wenhaha

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

-bash: ech: command not found

```

 ||

```

[root@wenhaha wenhaha]# echo wenhaha || cat wenhaha1.txt

wenhaha

[root@wenhaha wenhaha]# ech wenhaha || cat wenhaha1.txt

bash: ech: command not found

123343 3423543 45345 345

wenhaha wenhaha wehan wehshdf

-bash: ech: command not found

```

原文:https://www.cnblogs.com/wenhaha/p/12495391.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!