GNOME User's Guide | ||
---|---|---|
<<< Previous | Appendix A. If you are new to Linux/UNIX | Next >>> |
Under 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.
Files 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.
![]() | IMPORTANT |
---|---|
Unlike MS-DOS, the filenames in UNIX are case-sensitive: myfile.txt and MyFile.txt are considered as two different files. |
You should also be aware of several UNIX conventions; while they are not mandatory, it is usually a good idea to follow them.
It is customary to use the format filename.extension for filenames, where the extension indicates the file type; for example, the extension txt is usually used for plain text files, while the extension jpeg is used for graphics in JPEG format, and so on. In particular, the GNOME File Manager (GMC) uses extensions to determine file type. You can view all the file extensions recognized by GMC by choosing the Edit mime types command in the Commands menu of GMC. Note that the standard convention in UNIX is that the executables (i.e., the program files) have no extension at all.
Files and directories whose names begin with a dot (.) are usually configuration files, that is, files which keep settings and preferences for various applications. For example, GNOME keeps all its settings in various files in the directories .gnome and .gnome-desktop in the user's home directory. Since most of the time you do not need to edit these files manually, or even know their precise names and locations, GMC usually doesn't show these files. You can change this setting using the Preferences dialog (see the section called Changing Your Preferences in the File Manager in the chapter called The GNOME File Manager).
Files with names ending with tilde (~) are usually backup files created by various applications. For example, when you edit a file myfile.txt with emacs, it saves the previous version in the file myfile.txt~. Again, you can control whether you want GNOME File Manager to show these files or not in Preferences dialog (see the section called Changing Your Preferences in the File Manager in the chapter called The GNOME File Manager).
When 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 from GMC in the file selection and view filter dialogs.
As 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. For example, if you have a file named My file, and you want to delete it, typing rm My file will not give the desired effect: the command rm will assume that you want to remove files My and file. At best, it will give you an error message; at worst (if you do have a file named My) it will remove a wrong file. The right way to do this is to enclose the file name in single quotes: rm 'My File'. The same should be done for file names containing any symbols that are normally considered as "separators", or have some special meaning; this includes comma (,), star (*), question mark (?), and more. To be on the safe side, quote in this way all file names that contain anything other than letters, numbers, and dots.
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.
<<< Previous | Home | Next >>> |
If you are new to Linux/UNIX | Up | Directories and paths |