← All commands
Topic hub File Management
Windows Linux File Management Expanded guide File System

Windows mklink equivalent in Linux

Creates symbolic links (shortcuts) or hard links pointing to files or directories.

Windows mklink
→
Linux equivalents
Debian/Ubuntu same command
ln -s
Fedora same command
ln -s
Arch same command
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.

Migration tip: A <strong>symbolic link</strong> (symlink) is like a Windows shortcut. A <strong>hard link</strong> is a second name for the same file data. Symlinks are far more commonly used and shown with <code>ls -la</code> using an arrow (->).

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.

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 optionUse
ln -s target linknameCreate a symbolic link
ln target linknameCreate a hard link
ls -laSee links (shown with -> arrow)
readlink -f linknameShow what a symlink points to
unlink linknameRemove 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Use absolute paths when creating symlinks to avoid broken links if the link is moved.

Keep learning

Related File Management commands