(Fancy) "symlinks" (create a link to a file in a different directory)
Some of your assignments will have "symbolic links" (symlinks) that show a file or directory that are not actually located in your directory. Symlinks are useful when you want to have one copy of a file, but have it accessible from different directories (e.g., when we want to have one class read-only file that everyone wants to look at).
When you do a long-format ls of the directory, you see where the original
file is located:
$ ls -l
total 11
drwx------ 3 cgregg operator 2048 Sep 6 12:06 assign0
drwx------ 4 cgregg operator 2048 Sep 6 08:42 assign1
drwx------ 3 cgregg operator 2048 Sep 6 08:43 assign2
drwx------ 2 cgregg operator 2048 Sep 6 09:44 assign3
-rw------- 1 cgregg operator 18 Sep 6 11:54 file1.txt
-rw------- 1 cgregg operator 46 Sep 6 11:55 file2.txt
lrwxr-xr-x 1 cgregg operator 29 Sep 6 14:49 samples -> /afs/.ir/class/cs107/samples/
$
The samples directory is actually located in the cs107 directory, but linked
to you so you have direct access to it.
To create a symlink:
ln -s /afs/.ir/class/cs107/samples/ .
The ln -s indicates that we are creating a symbolic link.
The /afs/.ir/class/cs107/samples/ is the location of the actual file or
directory.
The . says to put the link in the current directory.