官术网_书友最值得收藏!

  • Ubuntu 20.04 Essentials
  • Neil Smyth
  • 148字
  • 2021-06-11 17:39:42

9.7 Filename Shorthand

Many shell commands take one or more filenames as arguments. For example, to display the content of a text file named list.txt, the cat command would be used as follows:

$ cat list.txt

Similarly, the content of multiple text files could be displayed by specifying all the file names as arguments:

$ cat list.txt list2.txt list3.txt list4.txt

Instead of typing in each name, pattern matching can be used to specify all files with names matching certain criteria. For example, the ‘*’ wildcard character can be used to simplify the above example:

$ cat *.txt

The above command will display the content of all files ending with a .txt extension. This could be further restricted to any file names beginning with list and ending in .txt:

$ cat list*.txt

Single character matches may be specified using the ‘?’ character:

$ cat list?.txt

主站蜘蛛池模板: 大田县| 乳山市| 兖州市| 栾川县| 宁城县| 资溪县| 文山县| 泰兴市| 上思县| 中江县| 察雅县| 抚顺县| 凭祥市| 新竹县| 婺源县| 邛崃市| 剑河县| 平遥县| 德州市| 平凉市| 建德市| 开阳县| 彰化市| 彰化市| 吐鲁番市| 连云港市| 当涂县| 沛县| 广宗县| 家居| 锡林郭勒盟| 奉节县| 蓝山县| 浦城县| 哈尔滨市| 桑日县| 沅陵县| 穆棱市| 子洲县| 永州市| 澎湖县|