< About your files on Linux - 3.0 >

What you need to know about the files on your Linux system. Learn how Linux treats file names, what are hidden files and directories, and how to use the file command to determine the type of a file.

Author: Nana Långstedt < nana.langstedt at gmail.com >
tuXfile created: 20 December 2001
Last modified: 22 September 2005


back to

< Case and extensions >

First of all, keep in mind that file names are case sensitive. This means that WeirdFile isn't the same thing as weirdfile or WEIRDFILE.

Linux doesn't use file name extensions like MS Windows does. You can name all your files the way you want, because the type and purpose of the file are determined different ways. Of course you can use file name extensions if it helps you to see more quickly what type your files are, and usually it's a very good habit to use the extensions, but you're not forced to do so.

< Hidden files and directories >

There are more files on your system than you can see, because some of the files are hidden files. For example, change to your home directory and list the contents of it with ls. You see some files and directories there, but you don't see all of them, because some of your files are hidden. The -a option is used when you want to display all files, including hidden ones:
$ ls -a

Now you probably see a bunch of files and directories starting with a dot. When a file name starts with a dot, it's a hidden file and you don't see it when you do a normal directory listing. Directories can also be hidden the same way - put a dot in front of the directory name, and you won't see the directory or its contents when you do a normal directory listing.

Usually these hidden files are configuration files, and many of them were placed into your home directory when your user account was created. They're used for configuring different things related to your account, and some apps also store their configuration and setting files in your home directory as hidden files or in hidden directories. It's useful to hide config files because you probably edit them very rarely and don't need to see them. When the files are hidden, they're not disturbing you by cluttering up your home directory, so you'll find the rest of your files more easily.

< Determine the type of a file >

If you see a strange file on your system and don't know what it is, it's often helpful to determine its type. If the file has a file name extension, you probably can determine its type easily, but if you don't recognize the extension or if the file doesn't have one, you need different ways of finding out what sort of a file it is. This is where the file command comes in handy. file examines a file's contents and tells you what kind of a file it is:

me@puter: ~$ file examine.html
examine.html: HTML document text
me@puter: ~$

You can also give multiple files as arguments to file, if you want:

me@puter: ~$ file view_this picture.gif
view_this: ASCII English text
picture.gif: GIF image data, version 89a, 88 x 31
me@puter: ~$

Very easy. You just give the file name as an argument to file and then it tells you the type of the file and maybe some additional info about it, too.

< What next? >

Now you know how Linux treats files differently from Windows and you know what are hidden files and directories. You also know how to view a file's type. Next, you might want to know how to view the file's contents.

Related tuXfiles

Linux help > Working with files > About your files on Linux

Copyright © 2001 - 2011 Nana Långstedt