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

  • 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

主站蜘蛛池模板: 左贡县| 衢州市| 台东县| 镇远县| 芮城县| 北流市| 浦城县| 万宁市| 临湘市| 娄底市| 桦川县| 新巴尔虎左旗| 黔西县| 林西县| 突泉县| 新竹市| 新乡市| 沈阳市| 老河口市| 神池县| 安仁县| 古交市| 丁青县| 卓资县| 天镇县| 南昌县| 安宁市| 乌苏市| 北川| 侯马市| 连平县| 临泉县| 高青县| 曲沃县| 雅江县| 府谷县| 涞水县| 柳江县| 桦川县| 泸西县| 五寨县|