Using Dot Files


When a new Unix system user account is created, certain default settings maintained in default configuration files (called dot files) are placed in the user's home directory (~). Dot files are files with names starting with the . character. Depending on the Unix shell in use, different files are more active than others. For the most part, these files should be left alone unless you know what you are doing. However, there will be times when you will need to alter them although frequent changes to these files are not needed.

In working with dot files, you may accidentally corrupt them or make them invalid with an incorrect entry. Invalid or corrupted dot files can prevent you from logging in or otherwise affect your account. It is important that you back these up, and that you tread carefully when making changes at work. However, if you have the time and patience, have a free-for-all on your Unix home lab system. To list all of your dot files, type ls -a at the shell prompt.

Use Combined Options When you want to see your dot files in a long listing, type ls la. The . is what makes them hidden files.


Not all systems have examples you can follow, but for those of you who do: What are some of the default dot files you think you may encounter? Following is a list of some of the default dot files you are likely to see, use, or come in contact with sometime on your Unix system.

  • .login and .logout As you might guess, .login and .logout files are executed when you log in and when you log out. If you look in these files, you will find that they are shell scripts, which use commands that you are familiar with.

  • .cshrc or .profile Shell scripts that are executed when you open a shell. Shells have their own scripts that execute at startup.

  • .X11defaults or .Xdefaults This file contains settings that are used by the server resource database; the settings are mainly used in the X Window System.

If you use the find command with a wildcard such as find *.* /etc, you can see that many dot files are in your directories as well. Don't be afraid to look in the dot files; just don't alter them if you do not know what you are doing, or if you are on a production system at work that you cannot test on.



    SAMS Teach Yourself Unix in 10 Minutes
    Sams Teach Yourself Unix in 10 Minutes (2nd Edition)
    ISBN: 0672327643
    EAN: 2147483647
    Year: 2005
    Pages: 170

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net