- 1Linux Topics Index
- 2How to Create a File in Linux
- 3How to Rename a File in Linux
- 4How to Copy a File in Linux
- 5How to Move a File in Linux
- 6How to Delete a File in Linux
- 7How to Create a Directory in Linux
- 8How to Delete a Directory in Linux
- 9How to Copy Directories Recursively in Linux
- 10Delete Directories Recursively in Linux
- 11How to View Hidden Files in Linux
- 12How to Create a Hidden File in Linux
- 13How to Create a Hidden Directory in Linux
- 14How to Find Files in Linux Using find Command
- 15Find Files in Linux Using locate Command
- 16How to View File Contents Using cat in Linux
- 17How to View File Contents Using less in Linux
- 18View File Contents Using the more Command in Linux
- 19Compare Files Using diff Command in Linux
- 20Compare Files in Linux Using cmp Command
- 21Check File Type in Linux with file Command
- 22Create Symbolic Links with ln -s in Linux
- 23How to Archive Files Using tar Command in Linux
- 24Compress Files with gzip in Linux – Beginner Tutorial
- 25How to Compress Files Using bzip2 in Linux
- 26Compress Files in Linux Using zip Command
- 27Extract Compressed Files using tar in Linux
- 28Extract ZIP Files on Linux with unzip
- 29How to Extract .gz Files using gunzip in Linux

- 1Linux Topics Index
- 2How to Create a File in Linux
- 3How to Rename a File in Linux
- 4How to Copy a File in Linux
- 5How to Move a File in Linux
- 6How to Delete a File in Linux
- 7How to Create a Directory in Linux
- 8How to Delete a Directory in Linux
- 9How to Copy Directories Recursively in Linux
- 10Delete Directories Recursively in Linux
- 11How to View Hidden Files in Linux
- 12How to Create a Hidden File in Linux
- 13How to Create a Hidden Directory in Linux
- 14How to Find Files in Linux Using find Command
- 15Find Files in Linux Using locate Command
- 16How to View File Contents Using cat in Linux
- 17How to View File Contents Using less in Linux
- 18View File Contents Using the more Command in Linux
- 19Compare Files Using diff Command in Linux
- 20Compare Files in Linux Using cmp Command
- 21Check File Type in Linux with file Command
- 22Create Symbolic Links with ln -s in Linux
- 23How to Archive Files Using tar Command in Linux
- 24Compress Files with gzip in Linux – Beginner Tutorial
- 25How to Compress Files Using bzip2 in Linux
- 26Compress Files in Linux Using zip Command
- 27Extract Compressed Files using tar in Linux
- 28Extract ZIP Files on Linux with unzip
- 29How to Extract .gz Files using gunzip in Linux

- 1How to Add a New User in Linux
- 2Modify Existing User in Linux
- 3Delete a User in Linux — Step-by-Step for Beginners
- 4Create a User Group in Linux - Step-by-Step Tutorial
- 5Linux: Add User to Group
- 6How to Remove a User from a Group in Linux
- 7Delete a User Group in Linux - Beginner Friendly Tutorial
- 8Linux su Command Tutorial – Switch Users Easily
- 9Linux sudo Command - Execute as Another User
- 10Change a User's Password in Linux Using passwd
- 11Set Password Expiry in Linux using chage
- 12Lock a User Account in Linux
- 13How to Unlock a User Account in Linux
- 14Configure User Login Shell in Linux
- 15How to Configure User Environment Variables in Linux
- 16Edit .bashrc and .profile in Linux - User Startup Files Tutorial
How to Create Symbolic Links Using ln -s
Next Topic ⮕How to Archive Files Using tar Command in Linux
How to Create Symbolic Links Using ln -s
Hey there! 👋 If you're new to Linux, you've probably seen the term "symbolic link" or "symlink" floating around. But what exactly is it? And why would you want to use it?
In simple terms, a symbolic link is like a shortcut or alias to another file or directory. It doesn't hold the actual content, but it *points* to something else—just like how a desktop shortcut opens a file from another location.
🧠 Why Use Symbolic Links?
- To avoid duplicating large files or folders
- To organize files across multiple locations
- To make configurations cleaner and more maintainable
🛠️ Basic Syntax
ln -s [target] [link_name]
Let’s break this down:
- [target] — This is the original file or directory you want to link to.
- [link_name] — This is the name of the symbolic link you’re creating.
📁 Example 1: Linking a File
Let’s say we have a file called report.txt
in our Documents folder, and we want to create a symbolic link to it on the Desktop.
cd ~/Desktop
ln -s ~/Documents/report.txt report-link.txt
Now we can check the link:
ls -l report-link.txt
lrwxr-xr-x 1 user group 25 Jul 2 10:00 report-link.txt -> /home/user/Documents/report.txt
The arrow (->
) confirms that report-link.txt
is a symlink pointing to report.txt
.
📂 Example 2: Linking a Directory
You can do the same for a directory. For example, link a project folder to your home directory:
ln -s ~/projects/myapp ~/myapp-link
ls -l ~/myapp-link
lrwxr-xr-x 1 user group 20 Jul 2 10:15 myapp-link -> /home/user/projects/myapp
🧹 To Remove a Symbolic Link
Just delete it like a regular file:
rm report-link.txt
Don’t worry — this won’t touch the original file.
⚠️ Common Pitfall: Relative Paths
If you use a relative path instead of an absolute one, the link will break if you move it to a different location. Always prefer absolute paths when in doubt.
✅ Recap
- Use
ln -s
to create symbolic (soft) links - They act like shortcuts, saving space and effort
- Work with both files and directories
- Use absolute paths for stability
That’s it! 🎉 Now you know how to use symbolic links to simplify your file and directory management in Linux. Go ahead and try it out!