OPS102 - File Globbing, Common Commands, Text Editors

From CDOT Wiki
Revision as of 05:13, 18 September 2023 by Chris Tyler (talk | contribs) (Created page with "== File Globbing / Ambiguous Filenames / Filename Patterns == Linux and Windows systems both allow ambiguous filenames, which use ''wildcard'' symbols to enable filename matc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

File Globbing / Ambiguous Filenames / Filename Patterns

Linux and Windows systems both allow ambiguous filenames, which use wildcard symbols to enable filename matching. The process of converting an ambiguous filename, or filename pattern, into a list of matchine filenames is called globbing or filename expansion.

On a Linux system, globbing is performed by the shell. This means that all arguments are subject to globbing, whether they're intended to be a filename argument or not.

On a Windows system, ambiguous filenames are converted into a list of filenames by the command or application. This means that arguments that are not filenames are not subject to filename expansion. However, it also means that applications must contain additional code to perform globbing.

Wildcard Symbols

Symbol Meaning in Linux Meaning in Windows
* Matches zero or more characters Matches zero or more characters
? Matches one character Matches one character, unless at the end of the filename or immediately before the dot preceeding the extension or at the end of the name
[list] Matches any one of the characters within the brackets Not applicable

Examples

Pattern Matches on Linux Does not match on Linux Matches on Windows Does not match on Windows
a* a aa aaa alpha argonaut Alpha banana a aa aaa alpha Alpha banana
b*e blue bite red green blot blue bite red green blot
c[oa]t cat cot coat cat cot coat (Not applicable)
d?e due doe duo Doe date due doe Doe duo date
a?? aaa abc aa abcd aaa abc aa abcd