1、 * 所有 任何东西
以.txt结尾 *.txt
以.log结尾 *.log
系统中以ls开头的文件。
find / -type f -name "ls*"
找出系统中文件名包含oldboy的文件。
find / -type f -name "*oldboy*"
2、{} 生成序列
echo {1..10}
echo {10..1}
echo {01..10}
echo {01..100}
echo {a..c}
echo {a..z}
echo {A..Z}
[[email protected] ~]# echo stu{01..10}
stu01 stu02 stu03 stu04 stu05 stu06 stu07 stu08 stu09 stu10
[[email protected] ~]# echo 20{01..10}
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
#通过{}
[[email protected] ~]# echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z
[[email protected] ~]# echo {a c f}
{a c f}
[[email protected] ~]# echo {a,c,f}
a c f
[[email protected] ~]# echo A{B,C}
AB AC
[[email protected] ~]# echo A{,C}
A AC
[[email protected] ~]# echo oldboy.txt{,.bak}
oldboy.txt oldboy.txt.bak
[[email protected] ~]# touch oldboy.txt
[[email protected] ~]# cp oldboy.txt{,.bak}
cp: overwrite `oldboy.txt.bak‘? y
[[email protected] ~]# ls -l oldboy.txt*
[[email protected] ~]# ls -l oldboy.txt*
-rw-r--r-- 3 root root 0 Nov 11 23:50 oldboy.txt
-rw-r--r--. 1 root root 0 Nov 11 23:50 oldboy.txt.bak
-rw-r--r-- 3 root root 0 Nov 11 23:50 oldboy.txt-hard
[[email protected] ~]#
[[email protected] ~]# #cp oldboy.txt{,.bak}
[[email protected] ~]# echo oldboy.txt{,.bak}
oldboy.txt oldboy.txt.bak
[[email protected] ~]# echo A{,C}
A AC
3、小结
1)查找文件
2)* {}
3)? 任何一个
练习题:
说说都有哪些通配符?
原文地址:https://www.cnblogs.com/Klanti/p/9143240.html