linux基础符号

linux基础符号

#

* 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]# 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]# 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]# 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

```

posted @ 2020-03-15 00:14  啧啧该有就得有  阅读(131)  评论(0)    收藏  举报