How-To: Ubuntu System Links

Posted on by on February 16th, 2011 | 0 Comments »

What are System Links?

Similar to Shortcuts

Shorcuts

  • Shortcuts point to a certain location.
  • When you click a shortcut your address changes to that location.
  • If you rename the file the shortcut points to, the shortcut will no longer work.

System Links

Similar to shortcuts

  • They are similar in that they point to some location
  • What is different is they are handles at an OS level, making the folder seem like it exists at that location

Example

  • Real Folder = /media/external/
  • System Link Points to: /home/slayer/Documents/storage/
  • Therefore:
    • a document readme.txt, located /media/external/readme.txt
    • navigating through your system link appears to exist at /home/slayer/Documents/storage/readme.txt
    • rather than a shortcut pointing you to /media/external/readme.txt

Usage

Why Useful?

  • Since System Links are handles in the OS, programs "think" they exist at the location the system link points to
  • So if I open gimp to do some file editing,

My use

  • Restrict users to seeing limited folders.
    • If I give a friend access to a folder, "guest" and I fill it with system links,
      • My friend will only be able to see the system links, and can't see the folders that are a level above the system links in their real lcation.
  • Consolidate all of my folders
    • I have a folder called "Global" and it is filled with system links to other folders such as "Documents" or "Music".
    • Those folders actually exist all on separate hard drives.
    • Because of the System Links, my programs "think" they are actually located in "Global/Documents" and "Global/Music"
      • This gives me a constant point of reference, even if I swap hard drives or change the physical location of the data.

Gimp Ex

  • For example, I open GIMP to edit some art I am working on called picture.jpg.
  • Setup
    • Let's assume my images are located  in some obscure location, say /media/foodrive/namehiearchy/morelocation/images/picture.jpg
    • I have made a system link of the images folder and called it work /home/slayer/Documents/work/picture.jpg
    • I have made a shortcut to the images called it "link to images" in "/home/slayer/Documents/link to images"
  • Differences between the links
    • In Gimp, I select open a file, I navigate to /home/slayer/Documents
    • IF I click /home/slayer/Documents/work
      • It will take me to the location /home/slayer/Documents/work/
    • IF I click "/home/slayer/Documents/link to images"
      • It will take me to the location /media/foodrive/namehiearchy/morelocation/images/picture.jpg

Installation

note: make sure to use the full path (ie /media/external/..../... ) rather than the relative path (/media ) when specifing both the input and output file names and locations.

Folder

Command

  • To make a system link of a directory (folder)
#:/~$ ln -sf /source/folder/ /target/location/newfoldername/

Example

#:/~$ ln -sf /media/external/data/ ~/Documents/archives/
  • This makes a link called data, which when clicked will show the contents of data

File

Command

  • To make a system link of an individual file
#:/~$ ln -s /source/folder/ /target/location/newfoldername/

Example

#:/~$ ln -s /media/external/data/file.txt ~/Desktop/mylink.txt
  • This makes a link to the file called called mylink.txt, which will act like it exists on the desktop

My .emacs
Wallpaper Websites

Categorized Under

GNU/LinuxHOWTO

Post tags

About Nick Guthrie

» has written 38 posts

Leave a Reply

You must be logged in to post a comment.

History