The Tufts High Performance Compute (HPC) cluster delivers 35,845,920 cpu hours and 59,427,840 gpu hours of free compute time per year to the user community.

Teraflops: 60+ (60+ trillion floating point operations per second) cpu: 4000 cores gpu: 6784 cores Interconnect: 40GB low latency ethernet

For additional information, please contact Research Technology Services at tts-research@tufts.edu


7. Files and File Names

A file is the basic unit of storage for data and is typically stored on physical storage media such as a disk (hard drive, flash disk, etc...) or tape. Every file must have a name as the operating system identifies files by its name; all software and data are stored on the storage media as files. File names may contain any characters, although some make it difficult to access the file. You should avoid spaces, quotes, and parenthesis. File names can be long and descriptive, up to 255 characters. Files can hold any sequence of bytes; it is up to the user to correctly interpret the contents in a file by using appropriate applications. Files can be human readable ascii text organized line by line, a structured sequence only readable by a specific application, or a machine readable sequence byte by byte. Many programs interpret the contents of a file as having some special structure, such as a pdf or postscript file. In scientific computing, binary files such as C or Fortran binary (unformatted) files, or other scientific data formats like NetCDF or HDF which have specific formats and provide application programming interfaces (APIs) for reading and writing, are often used for efficiency in storage and data access.

A directory is a special type of file. Linux uses a directory to hold information about other files, the equivalent of a folder in Windows. You can think of a directory as a container that holds other files or directories. The working directory is the directory where you are currently working. When you first login to a Linux system, your working directory will be your home directory. To view which directory you are currently in, issue the pwd command; this displays the present working directory.

$ pwd
/cluster/tufts/a/u/auser01

 

To list the files that are contained in your present working directory, use the ls command. $PWD is an environment variable that holds the path to the present working directory.

$ ls $PWD
myfile myfile2 otherfile

 

In Linux the directory structure is an 'upside down tree' as illustrated in Figure 1. The top level directory in any Linux system is called the root directory represented by the forward slash /. All directories are organized inside the root directory. Users can create directories inside of directories--these are called sub directories. Each file has a name which has to be unique in its containing directory. Files in different directories can have the same name, but they are distinguished by different directories. For example, one could have a file named foo in the folder /home/jolo/ and another file named foo in the directory /home/jolo/temp/.

cd will change your current working directory to a new location, given a path. For example, to move to the bin subdirectory of the usr directory:

$ cd /usr/bin

To move up one directory, to the parent directory of the current working directory:

$ cd ..

If you ever get lost while moving around the directory structure you can use one of three methods to get back to your default home directory. Issue the cd command with no arguments, the default action is to return to your home directory. Use the tilde ~ user name notation or the$HOME environment variable. For example, if my username is jolo, to return to my home directory I could do one of the following:

$ cd
$ cd ~auser01
$ cd $HOME

 

$HOME is an environment variable which contains the path to your home directory. There are several environment variables which are defined for you; to view all of them issue the env command.

Some other useful file commands are:

ls, list the files that exist in the current directory. Alternatively, one can give ls a different directory to display the files that reside in there.

$ ls /etc

 

mv moves a file to another location. For example, to move a file from netprog  in the home directory to the unix directory in the home directory:

$ mv ~/netprog/myFile ~/unix

This can also be used to rename a file in the same directory. For example, to rename myFile to myFile.old:

$ mv myFile myFile.old

cp copies files or directories. To copy a file from /home/jolo/unix to /home/jolo/netprog:

$ cp ~/unix/myOtherFile ~/netprog

rm removes files:

$ rm ~/netprog/myOtherFile

When discussing files and the file system, it is important to note the difference between a "relative path" and the "absolute path". The absolute or full path is the entire directory structure pointing to a file. A relative path is the path from where you are now (your present working directory) to the file in question. An easy way to know if a path is absolute is to check if it contains the "/" character at the beginning of the path. For example, assume there is a file in my home directory called foo. Since my home directory is /home/jolo, I could list the file using "ls" with the absolute path:

$ ls /home/jolo/foo
/home/jlockman/foo

 

If I was already in my home directory, I could use a relative path, which starts from my current working directory:

$ pwd
/home/jlockman

$ ls foo
foo

The construct "./" explicitly specifies the base path the current working directory: in the above example, the same could also be achieved with:

$ pwd
/home/jlockman

$ ls ./foo
foo

Lastly, a path starting with "../" starts in the parent directory of the current working directory

 

Comments

Systems may also define $SCRATCH, $TMP, $TEMP, $STORAGE, etc.

 

Page 11

Exercise: List files, Change Directory, copy, move, delete
 

Try these commands to get more familiar with Linux files and directories.

ls lists the contents of a directory. It will display the files in the current working directory or the directory specified. What is listed is not everything that is there. It does not display files that begin with a dot ("."), called dot files. Using the -a option (all) will display them. Check the man pages for more options when listing files.

$ ls -l /etc

 

The change directory command will take you to the /tmp directory.

$ cd /tmp

 

This one will take you up one directory, in this case the root directory /, and then over to the var directory.

$ cd ../var

 

With no arguments, cd will take you back to your home directory.

$ cd

 

Use ls to make sure file1 does not already exist. If it does, choose a different file name, and use that. The purpose of touch is to change a file's modification timestamp. However, it is also useful for creating an empty file.

$ touch file1

 

The make directory command creates a new directory, as permissions allow. It will not affect an existing directory.

$ mkdir anewdir

 

The move command. This command essentially does a rename, but it is capable of moving one or more files from one directory to another. Do an ls to see if it moved the file.

$ mv file1 anewdir

 

Make sure file2 does not exist first. Use a different name if it does. Make sure you do this one from your home directory. This will copy file1 from the anewdir directory to the current directory as file2.

$ cp anewdir/file1 ./file2

 

Some commands that affect directories (for example, cp and rm) have a -R option available to recurse through subdirectories. In this case, both the source and the destination are directories, and must already exist. Here we make use of a predefined environment variable for your scratch directory.

$ cp -r anewdir $SCRATCH

 

The remove command removes files. With the -r or -R option, it will also remove/delete entire directories recursively and permanently. Be very careful with that, and avoid using wildcards (*).

$ rm -r anewdir

 

For instance, rm -r * will remove all of the files and subdirectories within your current directory.

 

To remove an empty directory, use rmdir .

 


For additional information, please contact Research Technology Services at tts-research@tufts.edu