Department of Electrical Engineering and Computer Science



Dotfiles

Dotfiles are configuration files that reside in your home area. They are called dotfiles because they begin with the period or “dot” character. These files control many aspects of your Unix/Linux environment. For example, the default login shell for EECS accounts is Z-Shell (zsh). Its dotfiles include .zshrc (the main zsh configuration file) and .zlogin (a list of commands to execute at login, etc.).

This document describes listing and viewing dotfiles, common dotfiles, editing dotfiles, frequent tasks and problems related to dotfiles, and restoring all dotfiles.

Listing and viewing dotfiles


By default, dotfiles do not appear in file listings:

prompt> ls
bin/ junk/ ntprofile/

Use the -a option with the ls command to include dotfiles in the listing:

prompt> ls -a
./ .fvwm2rc .xinitrc
../ .login .xserverrc
.bash_login .logout bin/
.bash_logout .mailrc junk/
.bashrc .plan ntprofile/
.cshrc .project
.exrc .setprompt*

To view the contents of a dotfile, use your favorite “pager”, such as more or less. Editing dotfiles is discussed later in this document.

Common dotfiles

Your EECS account has a set of default dotfiles for the most important applications. Here is a partial list of the dotfiles in your home area:

.bashrc
.bash_login
.bash_logout

.cshrc
.login
.logout
.csh_files/.aliases.all
.csh_files/.aliases.interactive
.csh_files/.setprompt

.zshrc
.zlogin
.zlogout
.zsh_files/.zsh.path
.zsh_files/.zsh.manpath
.zsh_files/.zsh.aliases
.zsh_files/.zsh.prompt

.exrc
.fvwm2rc
.mailrc
.muttrc
.pinerc
.plan
.project
.vimrc
.Xauthority
.xinitrc
.Xresources
.xserverrc

For more information on the specific dotfiles, read the manual pages (using man command) for zsh, vi, xinit, finger, and fvwm2.

Editing dotfiles

Making a backup

Before you attempt to edit any dotfile, make a backup copy of the file you are going to modify. The easiest way to do this is to copy the file to a new file with a different name. For example, if you will be modifying .zshrc, run the following command:

cp .zshrc .zshrc.backup

This will copy your current .zshrc file to .zshrc.backup. Should you render your .zshrc unusable and are unable to fix the problem, you can always copy .zshrc.backup back to .zshrc and restore your previous settings.

Editing

To edit a dotfile, use any standard ASCII text editor such as vi. Once you have edited your files, you may need to log out and log back in to test any changes. If you are editing your Z-Shell dotfiles (e.g., .zshrc), you may be able to test the new configuration by using the source command:

source .zshrc

This command will reread your .zshrc file and apply any changes you have made. If you added or removed any entries from your shell's “path”, we recommend that you log out and log back in to test the changes. For more information, please read the manual page for Z-Shell (man zsh).

Frequent tasks and problems

Here are some tips for performing basic modifications and solving typical problems.

Adding a directory to your path

The shell's “path” specifies the locations it searches for programs when you type a command. For zsh, you add paths to the .zsh_files/.zsh.path file. For example, to look in the directory /home/mydir/bin for executables, add the following line to .zsh_files/.zsh.path:

export PATH="$PATH:/home/mydir/bin"

You should then log out and log back in for the changes to take effect.

Recovering dotfiles

If you made a backup copy of the dotfile before you modified it, simply copy the backup to the original file. For example:

cp .zshrc.backup .zshrc

If you did not make a backup, you can restore the default dotfile. The default EECS account dotfiles are stored in ~skels/default. For example, to restore the original .zshrc file, run the following command:

cp ~skels/default/.zshrc ~/.zshrc

To restore all of the default dotfiles for your account, see the corresponding section in this document.

Changing the window manager

The default window manager supported by the EECS IT staff is Xfce. FVWM and GNOME are also available; however, we strongly recommend Xfce. If you would like to change your window manager, follow the directions below.

NEW ACCOUNTS

The instructions below pertain to new accounts created after June 2005, or if you have updated your dotfiles.

OLDER ACCOUNTS

Change the exec line in your .xinitrc file to the following:

Restoring all dotfiles

If your dotfiles are out-of-date, or if you have severely damaged your home area, you can restore the default dotfiles using a script provided by the EECS IT staff. Log onto an EECS machine and run the following command:

update_config

This script will walk you through replacing your dotfiles. Read each prompt carefully. You will be given the option to backup your existing files. In addition, update_config can sometimes attempt to preserve personal changes you have made. (This is not always possible, however.) If running update_config causes problems and you selected to backup your files, you can restore the backup using the following command:

revert_config

If you have any difficulties, contact the EECS IT staff.


 

The University of Tennessee, Knoxville. Big Orange. Big Ideas.

Knoxville, Tennessee 37996 | 865-974-1000
The flagship campus of the University of Tennessee System