Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Produces output similar to this:

Image RemovedImage Added

There are three sub-directories under the /stor/work/CBRS_unix directory: fastq, test and unix, each with their own sub-directories and files. Again, notice how tree colors file with the extension .gz differently. These are FASTQ files, compressed using the gzip protocol, produced by a Next Generation Sequencing (NGS) run in our Genome Sequencing and Analysis (GSAF) core facility.

Note that in Unix, and on Macs, directories are separated by forward slash ( / ) characters, unlike Windows where the backslash ( \ ) is used. And the root of all the file systems is that 1st forward slash ( / ).

Finding file systems

So if you're on a new system, how do you know what file systems are available to you? The df (disk free) command will list all the available file systems. As its name suggests, it also shows file system sizes, so it's always good to use df -h (human readable) to see sizes in more readable form. Also, there can be many many file systems available on any given system, so always pipe the output to more.

...

This produces a rather busy display like this one:

Image RemovedImage Added

Fortunately, you can ignore most of it. Focus on the Mounted on and Size columns.

  • Look for the / (forward slash), under the Mounted on column:
    • / (forward slash) is the root of the file system where the operating system is installed
    • Note its Size is 98G with 47G used
  • Look for Mounted on entries with large Size numbers:
    • Gigabytes (10^9 bytes), Terabytes (10^12 bytes), Petabytes (10^15 bytes)
  • Ignore file systems with names like /run, /dev, /snap, /sys, /boot, /tmp, /var – these are system related
  • Here we see a number starting with /stor (/stor, /stor/home, /stor/work, etc.)
    • Note its large Size: 39T - a sign that it's a file system you want to know about.

Here's a similar listing from the Lonestar5 Lonestar6 compute cluster at TACC:

Image RemovedImage Added

Here the big important file systems are /home1 (7.0T), /scratch (8.1P) and /work (6.8P). There's also /admin (3.5T) but its name suggests that normal users won't be able to access it.

...

There are also some "special" built-in directory names:

  • ~ (tilde) means my your Home directory
  • . (single period) means the current directory
  • .. (two periods) means the parent of the current directory (directory above it)
    • So ls .. means "list contents of the parent directory"
  • - (dash) means whatever directory you were in before this one

...

  • On our system, we've arranged that the command prompt "follows you" around the file system.
  • On other systems you can use the pwd (present working directory) command to see where you arethe full pathname of the directory you're in

Exercise 4-1

What is the full pathname of your Home directory?

Expand
titleAnswer...

pwd will display something like /stor/home/student01

Change into the /stor/work/CBRS_unix directory then back to your Home directory. Then use the - (dash) to go back to /stor/work/CBRS_unix without typing it in, then Home again using ~ (tilde). How does the command prompt change?

...

The Tab key is your best friend! Hit the Tab key once or twice - it's almost always magic!

Hitting Tab invokes shell completion, instructing the shell to try to guess what you're doing and finish the typing for you.

On most modern Linux shells you use Tab completion by pressing:

...

Expand
titleStructure of the /stor/work/CBRS_unix directory

Image RemovedImage Added


Code Block
languagebash
pwd                     # where am I now, really? /stor/home/student01
cd ..                   # up one level - now I'm in /stor/home
cd ../work/CBRS_unix/   # change into /stor/work/CBRS_unix using relative syntax
cd ./unix/docs/         # change into the unix/docs sub-directory relative to /stor/work/CBRS_unix
cd ../../fastq/         # go up two levels, then into fastq directory
cd ../../../home/       # change to the /stor/home directory using relative syntax
cd                      # go Home

...

Let's revisit a listing of our Home directory contents. Before we created any files, an ls -l listing looked something like this:

Image RemovedImage Added

Ignoring that "total 77951" line, there are 9 whitespace-separatedcolumns in this long listing:

...

File permissions (and some information about the file type) are encoded in that 1st 10-character field. Permissions govern who can access a file, and what actions they are allowed.

  • character 1 describes the file type (d for directory, - for regular file, l for symbolic link)
  • the remaining 9 characters are 3 sets of 3-character designations
    • characters 2-4: what the owning user account can do
    • characters 5-7: what other members of the associated Unix group can do
    • characters 8-19: what other non-group members (everyone) can do

...

  • read ( r ) access means file contents can be read, and it can be copied
  • write ( w or s ) access means a file's contents can be changed, and directory contents can be modified (files added or deleted)
  • execute ( x )
    • For for files, execute ( x ) means it is a program that can be called/executed (e.g. /usr/bin/ls, the file that performs the ls command)
    • For for directories, execute ( x ) means directory operations may be performed/executed
      • the directorycan be listed and changed into

...