Skip to content

Both.org

News, Opinion, Tutorials, and Community for Linux Users and SysAdmins

Primary Menu
  • About Us
  • Computers 101
    • Hardware 101
    • Operating Systems 101
  • End of 10 Events
    • Wake Forest, NC, — 2025-09-20
  • Linux
    • Why I use Linux
    • The real reason we use Linux
  • My Linux Books
    • systemd for Linux SysAdmins
    • Using and Administering Linux – Zero to SysAdmin: 2nd Edition
    • The Linux Philosophy for SysAdmins
    • Linux for Small Business Owners
    • Errata
      • Errata for The Linux Philosophy for SysAdmins
      • Errata for Using and Administering Linux — 1st Edition
      • Errata for Using and Administering Linux — 2nd Edition
  • Open Source Resources
    • What is Open Source?
    • What is Linux?
    • What is Open Source Software?
    • The Open Source Way
  • Write for us
    • Submission and Style guide
    • Advertising statement
  • Downloads
  • Home
  • How to update a Linux symlink
  • Linux
  • System Administration

How to update a Linux symlink

UNIX and Linux users find many uses for links, particularly symbolic links. One way that I like to use symbolic links is to manage configuration backups of various IT equipment.
Alan Formy-Duval April 5, 2024 4 minutes read
Heavy chain links in rows.

Heavy chain links in rows.

Image by: Paul Lewin. Modified by Opensource.com. CC BY-SA 2.0

UNIX and Linux users find many uses for links, particularly symbolic links. One way that I like to use symbolic links is to manage configuration backups of various IT equipment.

I have a directory structure to hold everything related to documentation, updates, and other files for the computers and devices on my network. Devices can include routers, access points, NAS servers, and laptops, often of different brands and versions. The configuration backups themselves might be deep within the directory tree, e.g. /home/alan/Documents/network/device/NetgearRL5000/config.

To simplify the backup process, I have a directory in my home called Configuration. I use symbolic links from this directory to point to the specific device directory:

$~/Configuration/ $ ls -F1
Router@
Accesspoint@
NAS@

Note: The -F option of the ls command appends special characters to each file name to represent its type. As shown above, the @ symbol indicates that these are links.

Creating a link

The symbolic link Router points to the config directory of my Netgear RL5000. The command to create it is ln -s:

$ ln -s /home/alan/Documents/network/device/NetgearRL5000/config Router

Then, take a look and confirm with ls -l:

$~/Configuration/ $ ls -l
Router -> /home/alan/Documents/network/device/NetgearRL5000/config
NAS -> /home/alan/Documents/network/device/NFSBox/config
...

The advantage is that when performing maintenance on this device, I simply browse to ~/Configuration/Router.

The second advantage of using a symbolic link becomes evident if I decide to replace this router with a new model. I might re-task the old router to be an access point. Therefore, its directory does not get deleted. Instead, I have a new directory that corresponds to the new router, perhaps an ASUS DF-3760. I create the directory and confirm its existence:

$ mkdir -p ~/Documents/network/device/ASUSDF-3760/config
$~/Documents/network/device/ $ ls
NetgearRL5000
ASUSDF-3760
NFSBox
...

Another example could be if you have several access points throughout your offices. You can use symbolic links to represent each one logically with either a generic name, such as ap1, ap2, and so on, or you can use descriptive words such as ap_floor2, ap_floor3, etc. This way, as the physical devices change over time, you do not have to continuously update any processes that might be managing them as they are addressing the links rather than the actual device directories.

Updating a link

Since my main router has changed, I want the router’s symbolic link to point to its directory. I could use the rm and ln commands to remove and create a new symbolic link, but there is a way to do this in one step using only the ln command with a few options:

$~/Configuration/ $ ln -vfns ~/Documents/network/device/ASUSDF-3760/config/ Router
'Router' -> '/home/alan/Documents/network/device/ASUSDF-3760/config/'
$~/Configuration/ $ ls -l
Router -> /home/alan/Documents/network/device/ASUSDF-3760/config
NAS -> /home/alan/Documents/network/device/NFSBox/config

The options, according to the man page, are as follow:

-v, –verbose

print name of each linked file

-f, –force

remove destination file (necessary since a link already exists)

-n, –no-dereference

treat LINK_NAME as a normal file if it is a symbolic link to a directory

-s, –symbolic

make symbolic links instead of hard links

Wrap up

Links are one of the most powerful features of UNIX and Linux file systems. Other operating systems have tried to mimic this capability, but those never worked as well or were as usable due to the lack of a fundamental link design in their file systems.

The demonstration above is only one possibility of many to take advantage of links for seamlessly navigating an ever-changing directory structure in a living production environment. Links provides the flexibility needed in an organization that is never static for long.

Tags: Soft links Symlinks

Post navigation

Previous: Using tar and ssh for backups
Next: Using rsync for Backup

Related Stories

Typewriter-lead
  • Books
  • Linux
  • Printing
  • Using and Administering Linux

Book Update — Chapter 26, Printers

David Both May 1, 2026
connections_wires_sysadmin_cable
  • Linux
  • Networking
  • Router

How to Make your Linux Box Into a Router

David Both April 29, 2026
f44-01-day-cropped
  • Fedora
  • Linux
  • Upgrades

Fedora 44 Released

David Both April 28, 2026

System upgrades this Sunday, May 3

Tools illustrationFedora 44 was released this week and I’ve upgraded all my systems except for the two that directly affect Both.org. I’ll be upgrading the hosts for my server and firewall to Fedora 44 this Sunday afternoon, May 3.

Both.org will be down for most of the afternoon for these upgrades.

Thanks for your patience.

Random Quote

Unix was not designed to stop its users from doing stupid things, as that would also stop them from doing clever things.

— Doug Gwyn

Why I’ve Never Used Windows

On February 12 I gave a presentation at the Triangle Linux Users Group (TriLUG) about why I use Linux and why I’ve never used Windows.

Here’s the link to the video: https://www.youtube.com/live/uCK_haOXPFM 

Why there’s no such thing as AI

Last October at All Things Open (ATO) I was interviewed by Jason Hibbits of We Love Open Source. It’s posted in the article “Why today’s AI isn’t intelligent (yet)“.

Technically We Write — Our Partner Site

Our partner site, Technically We Write, has published a number of articles from several contributors to Both.org. Check them out.

Technically We Write is a community of technical writers, technical editors, copyeditors, web content writers, and all other roles in technical communication.

Subscribe to Both.org

To comment on articles, you must have an account.

Send your desired user ID, first and last name, and an email address for login (this must be the same email address used to register) to subscribe@both.org with “Subscribe” as the subject line.

You’ll receive a confirmation of your subscription with your initial password as soon as we are able to process it.

Administration

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

License and AI Statements

Both.org aims to publish everything under a Creative Commons Attribution ShareAlike license. Some items may be published under a different license. You are responsible to verify permissions before reusing content from this website.

The opinions expressed are those of the individual authors, not Both.org.

You may not use this content to train AI.

 

Advertising Statement

Both.org does not sell advertising on this website.


Advertising may keep most websites running—but at Both.org, we’re committed to keeping our corner of the web ad-free. Both.org does not sell advertising on the website. Nor do we offer sponsored articles at this time. We’ll update this page if our position on sponsorships changes.

We want to be open about how the website is funded. Both.org is supported entirely by David Both and a few other dedicated individuals.

 

 

Copyright © All rights reserved. | MoreNews by AF themes.