Tyler Chris - Fedora Linux стр 31.

Шрифт
Фон

Local files refers to filesbinaries, scripts, and datafilesthat you have developed and that are not part of Fedora. Separating these files from the rest of the operating system makes it easier to move them to a new system in the future.

4.3.1.3. Ambiguous filenames

pattern matching

Square brackets [] can be used to contain a list of characters [123] , a range of characters [aj] , or a combined list and range [123aj] ; this pattern will match any one character from the list or range. Using an exclamation mark or carat symbol as the first character inside the square brackets will invert the meaning, causing a match with any one character which is not in the list or range.

Table 4-6 lists some examples of ambiguous filenames.

Table 4-6. Ambiguous filenames

FilenameDescriptionMatchesDoes not match
a*Any filename starting with a absolutely.txtAlbert
a.outbackup
albert_abc_
*x*Any filename containing an x xylophone.gifconstantinople
nexusALEX
old.x
*[09]Any filename ending in a digit file3file
menu.backup60file3a
file3.txt
416-555-1212.phone
[Aa]???.txtAny eight-character filename starting with a or A and ending in .txt appl.txtapplication.txt
ax42.txta.txt
Any1.txtallow.txt
[azAZ][09]Any two-character filename starting with a letter and ending with a digita9No
G77G
N3XX
Fortran77
[!azAZ]*Any filename that does not start with a letter9lives.odtabc.txt
[^azAZ]*_whateverNevermore

4.3.1.4. Choosing easy-to-use filenames

Here are my recommendations for Linux filenames:

Build the names from lowercase letters, digits, dots, hyphens, and underscores. Avoid all other punctuation. Start the filename with a letter or digit (unless you want to specify a hidden file), and do not include spaces.

Although it makes command-line file manipulation more awkward, more and more users are adding spaces to photo and music filenames.

font fonts

Filename extensions (such as .gif , .txt , or .odt ) are not recognized by the Linux kernel; instead, the file contents and security permissions determine how a file is treated. However, some applications do use extensions as an indication of file type, so it's a good idea to employ traditional extensions such as .mp3 for MP3 audio files and .png for portable network graphics files.

4.3.1.5. Listing the contents of directories

ls

$ ls

4Suite crontab hosts libuser.conf nxserver

a2ps.cfg cron.weekly hosts.allow lisarc oaf

...(Lines snipped)...

You can specify an alternate directory or file pattern as an argument:

$ ls /

bin etc lost+found mnt proc sbin sys usr

boot home media net ptal selinux tftpboot var

dev lib misc opt root srv tmp

$ ls -d a*

a2ps.cfg alsa ant.conf audit.rules

a2ps-site.cfg alternatives ant.d auto.master

acpi amanda asound.state auto.misc

adjtime amandates atalk auto.net

alchemist amd.conf at.deny auto.smb

aliases amd.net atmsigd.conf

aliases.db anacrontab auditd.conf

By default, filenames starting with a dot ( . ) are not shown. This provides a convenient way to store information such as a program configuration in a file without constantly seeing the filename in directory listings; you'll encounter many dot files and directories in your home directory. If you wish to see these "hidden" files, add the -a (all) option:

$ ls -a

ls can display more than just the name of each file. The -l (long) option will change the output to include the security permissions, number of names, user and group name, file size in bytes, and the date and time of last modification:

$ ls -l

-rw------- 1 chris chris 3962 Aug 29 02:57 a2script

-rwx------ 1 chris chris 17001 Aug 29 02:57 ab1

-rw------- 1 chris chris 2094 Aug 29 02:57 ab1.c

-rwx------ 1 chris chris 884 Aug 29 02:57 perl1

-rw------- 1 chris chris 884 Aug 29 02:57 perl1.bck

-rwx------ 1 chris chris 55 Aug 29 02:57 perl2

-rw------- 1 chris chris 55 Aug 29 02:57 perl2.bck

-rwx------ 1 chris chris 11704 Aug 29 02:57 pointer1

-rw------- 1 chris chris 228 Aug 29 02:57 pointer1.c

-rwx------ 1 chris chris 12974 Aug 29 02:57 pp1

-rw------- 1 chris chris 2294 Aug 29 02:57 pp1.c

ls -l is so frequently used that Fedora has a predefined alias (shorthand) for it: ll.

$ ls -S -l

-rwx------ 1 chris chris 17001 Aug 29 02:57 ab1

-rwx------ 1 chris chris 12974 Aug 29 02:57 pp1

-rwx------ 1 chris chris 11704 Aug 29 02:57 pointer1

-rw------- 1 chris chris 3962 Aug 29 02:57 a2script

-rw------- 1 chris chris 2294 Aug 29 02:57 pp1.c

-rw------- 1 chris chris 2094 Aug 29 02:57 ab1.c

-rwx------ 1 chris chris 884 Aug 29 02:57 perl1

-rw------- 1 chris chris 884 Aug 29 02:57 perl1.bck

-rw------- 1 chris chris 228 Aug 29 02:57 pointer1.c

-rwx------ 1 chris chris 55 Aug 29 02:57 perl2

-rw------- 1 chris chris 55 Aug 29 02:57 perl2.bck

The first character on each line is the file type: - for plain files, d for directories, and l for symbolic links.

There are dozens of options to the ls command; see its manpage for details.

4.3.1.6. Displaying and changing the current working directory

pwd

$ pwd

/home/chris

To change the directory, use the cd (change-directory) command.

Ваша оценка очень важна

0
Шрифт
Фон

Помогите Вашим друзьям узнать о библиотеке