Copyright (C) 2000-2012 |
Whole document tree
Files and filenamesUnder most operating systems (including UNIX), there is the concept of a file, which is just a bundle of information given a name (called a filename). Examples of files might be your history term paper, an e-mail message, or an actual program that can be executed. Essentially, anything saved on disk is saved in an individual file. FilenamesFiles are identified by their filenames. For example, the file containing your conference talk might be saved with the filename talk.txt. There is no standard format for file names as there is under MS-DOS and some other operating systems; in general, a filename can contain any character (except the / character–see the discussion of path names below) and is limited to 256 characters in length.
You should also be aware of several UNIX conventions; while they are not mandatory, it is usually a good idea to follow them.
WildcardsWhen entering commands from the command line, you can use so-called wildcards instead of an exact filename. The most common wildcard is *, which matches any sequence of symbols (including an empty string). For example, the command ls *.txt will list all the files with the extension txt, and the command rm chapter* will remove all files with the names starting with chapter (ls and rm are UNIX commands for listing and removing files). Another useful wildcard is ?, which matches any single symbol: for example, rm chapter?.txt will remove files chapter1.txt, chapter2.txt , but not chapter10.txt Most new GNOME users prefer using the GNOME File Manager for operations with files, rather than working from the command line. Wildcards can also be used in Nautilus in the file selection and view filter dialogs. Using spaces, commas, etc. in file namesAs was mentioned above, a file name may contain not only letters and numbers, but also spaces, commas, etc. — any characters other than slash (/). However, if you are using commands typed on the command line, you should be careful when dealing with such files. To avoid problems, it is advised that you enclose filenames that contain anything other than letters, numbers, and dots, in single quotes: to delete file My File, you should type rm 'My File' rather than rm My File. Of course, if you are only using graphical tools such as GNOME File Manager, than you do not need to worry about this: to delete file My File, just drag it to the trash can.
|