Anatomy of your directory

The purpose of this section is to understand what you might find as you navigate around in your terminal.


If you recall from the Basic Use section, the ls -l and ls -la commands have a bunch of seemingly random letters and things:


All of these are important to understand to understand permissions, especially the first block of letters and dashes.

Let’s take a look at the first line and break it down:


  • The first grouping of letters (A-D) is the file type and the read/write/execute permissions:

    • A: The file type

      • d: directory (which this example is)

      • -: regular file (like a .txt)

      • l: symbolic link (like a shortcut on your desktop)

    • B: Owner permissions. Each permissions field has three character positions:

      • r if the file is readable; - if it is not

      • w if the file is writeable; - if it is not

      • x if the file is executable; - if it is not

    • C: Group permissions. r/w/x have the same meaning as B

    • D: Other permissions. r/w/x have the same meaning as B

  • E: Number of links to this location

  • F: Owner name (Your username)

  • G: Owner group (most likely grp.csci.Students)

  • H: File size in bytes

  • I: Date modified

  • J: File/directory name

Changing permissions

If you are having trouble with permissions on a file that you own, you can update the permissions with chmod. chmod is generally called with the following format:

chmod < mode > fileName

Where the < mode > specifies what permissions get changed and for who. chmod has two ways you can change the permissions: octal notation (numbers 0-7), or symbolic notation (letters for group and permission). We will cover both ways so you can choose which you prefer.


With octal notation, we have this basic usage:

chmod ### fileName

The numbers make up what is called the mode where the first # represents the permission level of the owner, the second for the group, and the third for other.

The numbers breakdown like so:

  • 4 - read

  • 2 - write

  • 1 - execute

And any combinations of r/w/x can be achieved by adding the numbers. For example, if to give read and execute permissions you would use 5.


chmod 764 fileName

Changes the permissions for fileName so that the owner has rwx, the group has, rw, and other has r only.


With symbolic notation, we have this general usage:

chmod <u|g|o><=|+|-><r|w|x> fileName

This may look confusing, but stick with me. Let me give you an example:

chmod ug=wr fileName

This changes the user’s (owner’s) and group’s permissions to wr for the file filename. It does not change permissions for other.

The mode in the symbolic notation consists of three sections:

  1. Groups affected. This can be any combination of u/g/o for user (owner), group, and other respectively.

  2. Operator. This can be =, + or - where the operator sets, adds, or removes the specified permissions respectively.

  3. Permissions. This can be any combination of r/w/x for read, write, and execute respectively.

A few examples:

chmod ug+wx fileName

adds write and execute permissions to the user and group without affecting the read permission or the other group; and,

chmod go-rwx fileName

removes all read, write, and execute permissions for group and other.

Dot files

When you hear the word “dotfiles” that tends to refer to files or directories that begin with a “.” prefix. If you have seen the Git page, you know that when you create a repository your local machine gains a .git folder. These directories or files will not show up if you simply type an ls command as you remember from the basic command section of this survival guide. Dotfiles are also known as hidden directories/files and a UNIX based terminal (like the one in the labs) is configured to recognize that and not list its information.

A dotfile’s purpose is to store information that a user does not need to access often or at all and will often hold configuration information for various programs. Nearly every application on your computer that you use can be configured to look and act the way you like. Your configurations will go into dotfiles usually ending in “conf” or “rc” like.vimrc or Tmux’s .tmux.conf. Note: changing these files could have disastrous results if you change the wrong thing. We implore you to understand what you are changing before you change it by doing some research into your dotfile.

In an ideal world, there would be a one stop walk-through that tells you exactly what to do to a file to make it do what you want, but the configuration of dotfiles varies depending on the program you are configuring so we suggest you do research on your specific dotfile before diving in to change it. If you notice somebody with a feature you like–whether it is the color text in the terminal or how a certain application in the terminal interacts–ask to see their dotfiles to learn a few things from what they have done and steal a line or two for your own config. There are endless dotfile repositories on GitHub and anyone would be glad to answer your questions.