Linux Permissions and Links Cheat Sheet/Replace symlink atomically-ish

Create or update a symlink target with force.

Section: Links and Link Recipes

Replace symlink atomically-ish

bash
bash
ln -sfn /opt/releases/2026-03-07 current

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Links and Link Recipes
Inspect path components
Resolve each path component and symlink along the path.
OpenIn sheetbashsame section
Find files sharing same inode count
Inspect hard link count with ls/stat.
OpenIn sheetbashsame section
Add execute permission for user
Grant user execute permission.
Change owner and group
Set file owner and group together.
Set setuid bit
Set executable to run with owner's effective UID.
Set file to 644
Common mode for normal text or config files.