link examples

ln is used to make links from one file or directory to another. For example, suppose you have a large data file in /scratch/dduck1, but you want it to look like it’s in your home directory:

ln -s /scratch/dduck1/largedatafile /home/dduck1/.

The -s option is for a soft link. The dot (.) at the end of that command gives the linked file the same name (largedatafile) in the home directory. Here’s what it now looks like:

$ ln -s /scratch/dduck1/largedatafile /home/dduck1/.
$ ls -l largedatafile
lrwxrwxrwx 1 dduck1 users 28 Jun  4 12:09 largedatafile -> /scratch/dduck1/largedatafile

So it looks like largedatafile is in your current/home directory, but it really lives on /scratch (and doesn’t count against your quota!).

The ln command works for both files and directories. Common directories I’ve linked out to /scratch include:

Any large data or software that you could easily download again from the web is probably better off being stored in /scratch or one of the /local directories.

see also: scratch/local

Back to SwatCS Help Docs