Flashcards in File Names and File Globbing Deck (18):
File names can contain almost any character except...?
/ (it can't be part of a filename since it's the character used to separate directory name components in a relative or fully-qualified name. Since many of the more "unusual" characters are shell metacharacters, they must be protected in quotes to be used in a filename.)
Although filenames can contain almost any character, that doesn't mean that they...?
Files that start with _____ are "hidden" files.
The *, ?, [...], and [^...] characters can be used to match filenames, through a process commonly called...?
Many OS's restrict the choice and number of characters that can be used in naming files, in Linux....?
virtually any printable character can be used in a filename, and filenames can be of almost any length.
Linux filenames can be up to _____ characters long, excluding any directory components.
When used in a command, an absolute or relative filename, including directory components, may be up to .....?
4095 characters long. (This allows names of files and directories to be very descriptive.)
You should avoid using punctuation in filenames since ...?
the uninformed use of shell meta-characters can produce disastrous results.
In general, filenames should be composed of ...?
alphabetic and numeric characters (A-Z, a-z, 0-9) and the punctuation symbols ._-+~ (dot, underscore, dash, plus, tilde). Normally, filenames should start with an alphanumeric character or a dot. While you will encounter them with some frequency, files with embedded spaces are discouraged. (but putting quotes around a file with a space in the middle, will not cause any errors)
A file name with a leading or trailing space is ...?
legal, (but very tricky to identify in a file listing)
File and directory names (remember directory is a type of file) that start with a dot are...?
"hidden" files. (Hidden files do not appear in the directory listings produced by ls unless the special command option -a (all) is used, or unless you specify the leading dot as part of the name. This makes it possible to reduce clutter and confusion by keeping certain files "out of sight, out of mind". Except for hiding the file, the leading dot has no other significance, and hidden files and directories can be used just like any others.)
Hidden files also do not appear in...?
a "glob", unless the leading dot was specifically listed.
Commands like cp -r and rm -r work on entire directory sub-trees, but Linux has a more...?
flexible way of identifying sets of files.
The bash command shell treats some of its special meta-characters as...?
wildcard characters. (When bash reads the command line, the shell performs a process called meta-character expansion or wildcard expansion, generates a list of filenames that match the pattern described by the wildcard expression, and then it passes the generated list on to the command. This is commonly referred to as "filename globbing".
* matches zero or more characters (except leading dot)
? matches exactly one character (except leading dot)
[...] matches exactly one character from the list or range
[^...] matches exactly one character not from the list or range
The bracket wildcards represent a list of...?
single characters. (Thus [aeiou] matches any one vowel. A contiguous range of characters may be represented using a dash, as in [a-z] for the lowercase alphabet. A leading carat (^) negates the list, so that [^aeiou] is any character except a vowel. A "real" dash or carat can be represented by escaping the characters using a backslash (\). Thus, the expression [a\-z] matches a, z or a dash only. Ranges and single characters can be mixed together. The pattern [A-Za-z0-9._\-+~] matches any one of the "safe" filename characters.)
Pattern Generates the list
* all the files in the list
*.html page1.html page2.html
page*.htm* page1.html page2.html page3.htm page40.htm
image?.* image1.jpeg image2.jpeg
[ps]* page1.html page2.html page3.htm page40.htm script1.pl
[^ps]* image1.jpeg image2.jpeg image10.jpeg image11.jpeg