Skip to main content

What is Symlinks and how to use it

When working with files and directories, you may have heard of symbolic links (often called symlinks). They are widely used in Linux, macOS, and even Windows (via WSL or shortcuts) to make file management smarter and more efficient.

In this guide, we’ll cover:

  1. What is a Symlink?

  2. Why Do We Need Symlinks?

  3. Practical Scenarios Where Symlinks Are Useful

  4. How to Create a Symlink (with macOS Example)

  5. Tips and Best Practices


1. What is a Symlink?

A symbolic link (or symlink) is a type of file that points to another file or directory, much like a shortcut.

  • On Linux/macOS, they’re created via the ln -s command.

  • On Windows, you can create them using mklink.

Unlike copying a file, a symlink doesn’t duplicate data. Instead, it tells the operating system, “when someone opens me, go to that original file.”

So, in short, A symlink is nothing but a path pointer to another file/folder.


2. Why Do We Need Symlinks?

Symlinks exist because sometimes you want files or folders to be accessible in multiple places without duplication. Benefits include:

  • Save storage space by avoiding duplicate copies.

  • Keep consistency: update the original file once, and every symlink reflects it.

  • Flexibility in file paths: if software expects files in a certain directory, you can “redirect” that path.

  • Organization: make large or shared resources accessible without moving them.


3. Real-Life Scenarios for Symlinks

Here are a few examples that show how symlinks help in everyday workflows:

A. Shared Resources in Projects

Instead of copying common assets (like images or scripts) into multiple project folders, you create symlinks pointing to a master folder.

B. Configuration Files

Developers often keep dotfiles (.zshrc, .gitconfig) in a GitHub repo or cloud drive. With symlinks, they can place those files in their home directory without duplication.

C. Storage Management

Move heavy folders (like Videos or Downloads or LLM files) to an external drive but create symlinks in your home folder so apps still think the files are “local.”

D. Backward Compatibility

If you rename or reorganize a folder, you can create a symlink from the old path to the new one so older scripts/programs still work.


4. How to Create a Symlink (Example on macOS/Linux)

Creating a symlink is simple in macOS/Linux using the Terminal:

Syntax

ln -s [source] [destination]
  • source → the original file or directory

  • destination → the symlink you want to create

Example

You have a folder:

  • /Users/mukitulislam/MyFolder

You want a symlink to it to an external SSD folder, so hit this command:

  • ln -s /Users/mukitulislam/MyFolder ~/Volumes/T7/MUKITUL-WORKSPACE/MyExternalFolder

In this way, you can symlink MyExternalFolder on an external SSD to behave like the real folder.


5. Best Practices

  • Verify symlinks: Use ls -l to see where a symlink points.

  • Delete safely: Removing a symlink with rm does not delete the original file.

  • Avoid loops: Don’t point symlinks back to themselves—it can break scripts or cause errors.


Conclusion

Symlinks are a universal concept across Linux, macOS, and Windows. It provides a powerful way to simplify file organization, save space, and make workflows more flexible.

If you’re on macOS or Linux, try creating one using the ln -s command today. If you’re on Windows, check out the mklink command in Command Prompt or PowerShell.

Comments

Popular posts from this blog

Part 1: Connecting AI to My Daily Tools – A Simple MCP-Powered TODO App

Imagine asking an AI to manage your TODO list, run a local script, or update a file - it does exactly that, like a virtual assistant plugged into your computer. This is now possible thanks to something called MCP ( Model Context Protocol ).  What is MCP?   MCP (Model Context Protocol) is a lightweight protocol proposed by Anthropic that enables AI models to interact with tools in a structured and transparent manner. It lets you define tools in an AI-readable format — including their names, parameters, descriptions, and return types — so that LLMs like Claude, GPT (and others) can understand and call them safely. With MCP, you can turn your scripts, utilities, and services into AI-callable tools, effectively giving the model "extensions" into your local environment or applications.  Image Source: fb.com/devtalks My First Experiment: A TODO List MCP Server   To explore MCP in action, I created a simple MCP server that exposes two tools:   đŸ“ addTodo(day,...

āĻ•িāĻ­াāĻŦে āωāχāύ্āĻĄোāϜ ā§§ā§Ļ āĻ Java/JDK ā§Ž āχāύ্āϏāϟāϞ āĻ•āϰāĻŦেāύ? JDK 8 installation guide!

āĻāχ āĻŦ্āϞāĻ—ে āφāĻŽāϰা āĻĻেāĻ–āĻŦো āĻ•িāĻ­াāĻŦে āĻāĻ•āϟি āωāχāύ্āĻĄোāϜ ā§§ā§Ļ āĻĒিāϏি āϤে Java/JDK āχāύ্āϏāϟāϞ āĻ•āϰāϤে āĻšā§Ÿ। Java āχāύ্āϏāϟāϞ āĻ•āϰা āĻŦāϞāϤে āφāĻŽāϰা āĻŦুāĻāĻŦো JDK āĻŦা Java Development Kit āχāύ্āϏāϟāϞ āĻ•āϰাāĻ•ে। āφāĻŽāϰা āĻāχ āĻŦ্āϞāĻ—ে āϜাāύāĻŦো āĻ•ি āĻ•āϰে Oracle JDK āĻāϰ āĻ­াāϰ্āϏāύ ā§Ž āχāύ্āϏāϟāϞ āĻ•āϰāϤে āĻšā§Ÿ। āϧাāĻĒ ā§§ঃ āĻĄাāωāύāϞোāĻĄ JDK ā§Ž āĻĄাāωāύāϞোāĻĄ āϞিāĻ™্āĻ•ঃ  https://www.oracle.com/java/technologies/downloads/#java8 āĻ…āĻĨāĻŦা  https://www.oracle.com/java/technologies/downloads/  āĻāχ āϞিāĻ™্āĻ• āĻ āĻ—ি⧟েāĻ“ āϏ্āĻ•্āϰāϞ āĻ•āϰে āύিāϚে āύেāĻŽে Java 8 choose āĻ•āϰāϤে āĻĒাāϰেāύ। Available product/file āĻ—ুāϞো āĻĨেāĻ•ে x64 Installer āĻāϰ .exe file āϟা āĻĄাāωāύāϞোāĻĄ āĻ•āϰি (āϤāĻŦে āφāĻĒāύাāϰ āĻĒিāϏি āϝāĻĻি 32-bit āĻ…āĻĒাāϰেāϟিং āϏিāϏ্āϟেāĻŽ āĻāϰ āĻšā§Ÿ, āϏেāĻ•্āώেāϤ্āϰে āφāĻĒāύি āĻĄাāωāύāϞোāĻĄ āĻ•āϰāĻŦেāύ x86 Installer āĻāϰ exe file āϟা-āĻ•ে)। āĻĄাāωāύāϞোāĻĄ āĻ•āϰাāϰ āϜāύ্āϝ Oracle āĻ āĻ…্āϝাāĻ•াāωāύ্āϟ āĻĨাāĻ•āϤে āĻšā§Ÿ। āφāĻĒāύাāϰ āϝāĻĻি āĻ…্āϝাāĻ•াāωāύ্āϟ āύা āĻĨাāĻ•ে āϤāĻŦে āĻ…্āϝাāĻ•াāωāύ্āϟ create āĻ•āϰে āύিāĻŦেāύ। Oracle āĻ āĻ…্āϝাāĻ•াāωāύ্āϟ create āĻ•āϰা āĻāĻ•āĻĻāĻŽ free of cost. āϧাāĻĒ ā§¨ঃ āχāύ্āϏāϟāϞ JDK ā§Ž āĻĄাāωāύāϞোāĻĄ āĻ•āϰা āĻšā§Ÿে āĻ—েāϞে .exe āϟাāϤে double click āĻ•āϰে āχāύ্āϏāϟāϞ āĻ•āϰা āĻļুāϰু āĻ•āϰি। āύিāϚেāϰ āĻ›āĻŦি āĻ—ুāϞোāϰ āĻŽāϤো āĻāĻ•āϟা āĻ•āϰা āωāχāύ্āĻĄো āφāĻĒāύাāϰ āϏাāĻŽāύে āĻ“āĻĒেāύ āĻšāĻŦে āĻāĻŦং āφāĻĒāύি Next button āĻ•্āϞিāĻ• āĻ•āϰে āϏাāĻŽāύে āĻāĻ—ি⧟ে āϝা...

JDK 17 installation guide | āĻ•িāĻ­াāĻŦে āωāχāύ্āĻĄোāϜ ā§§ā§Ļ āĻ Java/JDK ā§§ā§­ āχāύ্āϏāϟāϞ āĻ•āϰāĻŦেāύ? How to install JDK 17 on windows 10?

āĻāχ āĻŦ্āϞāĻ—ে āφāĻŽāϰা āϜাāύāĻŦো āĻ•িāĻ­াāĻŦে āωāχāύ্āĻĄোāϜ ā§§ā§Ļ āĻĒিāϏি āϤে Java/JDK āχāύ্āϏāϟāϞ āĻ•āϰāϤে āĻšā§Ÿ। Java āχāύ্āϏāϟāϞ āĻ•āϰা āĻŦāϞāϤে āφāĻŽāϰা āĻŦুāĻāĻŦো JDK āĻŦা Java Development Kit āχāύ্āϏāϟāϞ āĻ•āϰাāĻ•ে। āφāĻŽāϰা āĻāχ āĻŦ্āϞāĻ—ে Oracle JDK āĻāϰ āĻ­াāϰ্āϏāύ ā§§ā§­ āĻ•িāĻ­াāĻŦে āχāύ্āϏāϟāϞ āĻ•āϰāϤে āĻšā§Ÿ āϏেāχ āϧাāĻĒāĻ—ুāϞো āϜাāύāĻŦো।  āϧাāĻĒ ā§§ঃ āĻĄাāωāύāϞোāĻĄ JDK ā§§ā§­ āĻĄাāωāύāϞোāĻĄ āϞিāĻ™্āĻ•ঃ  https://www.oracle.com/java/technologies/downloads/#java17 āĻ…āĻĨāĻŦা  https://www.oracle.com/java/technologies/downloads/  āĻāχ āϞিāĻ™্āĻ• āĻ āĻ—ি⧟েāĻ“ āϏ্āĻ•্āϰāϞ āĻ•āϰে āύিāϚে āύেāĻŽে Java 17 choose āĻ•āϰāϤে āĻĒাāϰেāύ। Available product/file āĻ—ুāϞো āĻĨেāĻ•ে x64 Installer āĻāϰ .exe file āϟা āĻĄাāωāύāϞোāĻĄ āĻ•āϰি। āĻĄাāωāύāϞোāĻĄ āĻ•āϰাāϰ āϜāύ্āϝ Oracle āĻ āĻ…্āϝাāĻ•াāωāύ্āϟ āĻĨাāĻ•āϤে āĻšā§Ÿ। āφāĻĒāύাāϰ āϝāĻĻি āĻ…্āϝাāĻ•াāωāύ্āϟ āύা āĻĨাāĻ•ে āϤāĻŦে āĻ…্āϝাāĻ•াāωāύ্āϟ create āĻ•āϰে āύিāĻŦেāύ। Oracle āĻ āĻ…্āϝাāĻ•াāωāύ্āϟ create āĻ•āϰা āĻāĻ•āĻĻāĻŽ free of cost. āϧাāĻĒ ā§¨ঃ āχāύ্āϏāϟāϞ JDK ā§§ā§­ āĻĄাāωāύāϞোāĻĄ āĻ•āϰা āĻšā§Ÿে āĻ—েāϞে .exe āϟাāϤে double click āĻ•āϰে āχāύ্āϏāϟāϞ āĻ•āϰা āĻļুāϰু āĻ•āϰি। āύিāϚেāϰ āĻ›āĻŦি āĻ—ুāϞোāϰ āĻŽāϤো āĻāĻ•āϟা āĻ•āϰা āωāχāύ্āĻĄো āφāĻĒāύাāϰ āϏাāĻŽāύে āĻ“āĻĒেāύ āĻšāĻŦে āĻāĻŦং āφāĻĒāύি Next button āĻ•্āϞিāĻ• āĻ•āϰে āϏাāĻŽāύে āĻāĻ—ি⧟ে āϝাāĻŦেāύ। āϏāĻŦāĻļেāώে Close button āĻ•্āϞিāĻ• āĻ•āϰে āχāύ্āϏāϟāϞ āĻ•āϰা āϏāĻŽ্āĻĒāύ্āύ āĻ•āϰāĻŦেāύ। āϧাāĻĒ ā§Šঃ Environment Variable āϏেāϟāφāĻĒ S...