常用通配符以及常用的符号整理

常用通配符以及常用的符号整理

作用:

  • 更快地查询到所需的文件

常用的通配符

  • * 匹配任意0个或者多个字符串

  • ? 匹配任意一个字符

  • [abcd] 匹配adcd中的任意一个字符

  • [a-z] 匹配a-z中的任意一个字符

  • [!a-z] 匹配非a-z中的任意一个字符

#*使用方式
[root@gsh ~]# ls /etc/*.conf
/etc/asound.conf /etc/ld.so.conf     /etc/nsswitch.conf   /etc/sudo.conf
/etc/dracut.conf /etc/libaudit.conf   /etc/resolv.conf     /etc/sysctl.conf
/etc/e2fsck.conf /etc/libuser.conf   /etc/rsyncd.conf     /etc/tcsd.conf
/etc/fuse.conf   /etc/locale.conf     /etc/rsyslog.conf   /etc/updatedb.conf
/etc/host.conf   /etc/logrotate.conf /etc/sestatus.conf   /etc/vconsole.conf
/etc/kdump.conf   /etc/man_db.conf     /etc/sos.conf       /etc/yum.conf
/etc/krb5.conf   /etc/mke2fs.conf     /etc/sudo-ldap.conf
#?使用方式
[root@gsh ~]# ls /etc/service?
/etc/services
[root@gsh ~]# ls /etc/?ervices
/etc/services
#[abcd] 使用方式
[root@gsh ~]# ls /etc/service[a-z]
/etc/services
#\!使用方式
[root@gsh ~]# ls /etc/service[!0-9]
/etc/services

与路径和位置相关的特殊符号

  • ~ 用户的家目录

  • - 上一次工作目录

  • . 代表当前目录

  • .. 表示上一级目录

[root@gsh ~]# cd .
[root@gsh ~]# cd ..
[root@gsh /]# cd -
/root
[root@gsh ~]# cd /etc/
[root@gsh /etc]# cd ~
[root@gsh ~]#

不同引号

  • '' 所见即所得

  • "" 输出双引号内部的内容,如果引号内有变量,或者转移字符则会进行转义操作

  • `` 一般用于引用

[root@gsh ~]# echo '$PWD'
$PWD
[root@gsh ~]# echo -e "$PWD\taaa"
/root aaa
[root@gsh ~]# echo `pwd`
/root
[root@gsh ~]#

标准输入\输出\错误输出

 

posted @ 2020-09-28 21:50  Gsh-123  阅读(1056)  评论(0)    收藏  举报