Commit d15ec2a6 authored by Éamonn Murray's avatar Éamonn Murray

Expand info on links

parent ae18318f
......@@ -208,8 +208,9 @@ be used in the same way as the file itself. They are useful for many reasons:
has quite a long path. You can create a link to it in your home directory
and use the link in exactly the same manner as the original path.
- Saving space: For example, when working with a code that expects a certain
file as input in the current directory, you can make a link instead of
copying the file.
file as input in the current directory. If the file is very large you might
want to avoid making copies of it, so you can instead make a link to the
file.
- If a parameter file is used in several places, you can use links so that
when you update when file, they are all updated, instead of having to update
several copies manually.
......@@ -240,6 +241,17 @@ files.
- `cp -s ../results/*dat .` would create symbolic links from all the `.dat`
files in the results directory to the current directory.
If you create a link to a directory, one thing that may not be immediately
obvious is how to delete it. Say your link is called ``tmpdir``. If you
try `rm tmpdir/` you'll get the error
`rm: cannot remove 'tmpdir': Is a directory`. Then if you try
`rmdir tmpdir/` you'll get the error
`rmdir: failed to remove 'tmpdir/': Not a directory`. What you need to do
is use `rm` but ensure you don't have a trailing slash following the link
name: `rm tmpdir`. **NB** if you use `rm -r tmpdir/`, this will delete the
contents of the directory you have linked to which is likely not what you
want to do, so be careful.
#### Useful Options
- `ln -sf`: the additional `-f` option forces the link to overwrite any
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment