Windows mklink equivalent in Linux
Creates symbolic links (shortcuts) or hard links pointing to files or directories.
mklink
ln -s
ln -s
ln -s
Overview
What this command does
On Windows, "mklink" is used to create symbolic and hard links. On Linux, the closest practical mapping shown here is "ln -s". Creates symbolic links (shortcuts) or hard links pointing to files or directories. This reference is grouped under File Management → File System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows mklink maps to ln -s for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Command-specific caution
Use absolute paths when creating symlinks to avoid broken links if the link is moved.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
Practical tasks
Common use cases
Create symbolic and hard links
Creates symbolic links (shortcuts) or hard links pointing to files or directories.
ln -s target linkname
Create a symbolic link
ln target linkname
Create a hard link
ls -la
See links (shown with -> arrow)
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
ln -s /var/www/html ~/www
ln -s /etc/nginx/nginx.conf ~/nginx.conf
ls -la ~/www
Walkthrough
Examples with explanations
# Windows: mklink link.txt target.txt
ln -s /var/www/html ~/www # symlink to a directory
ln -s /etc/nginx/nginx.conf ~/nginx.conf # symlink to a file
# View what it points to:
ls -la ~/www
lrwxrwxrwx ... www -> /var/www/html
Reference
Common options and variations
| Command or option | Use |
|---|---|
ln -s target linkname | Create a symbolic link |
ln target linkname | Create a hard link |
ls -la | See links (shown with -> arrow) |
readlink -f linkname | Show what a symlink points to |
unlink linkname | Remove a symbolic link |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "ln -s" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | ln -s |
Same command on this distribution. |
| Fedora | same command | ln -s |
Same command on this distribution. |
| Arch | same command | ln -s |
Same command on this distribution. |
Important
What to watch out for
Keep learning