Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/practical-tips.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the soledad domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/practical-tips.com/wp-includes/functions.php on line 6114
Create a symlink under Linux: How it works - Practical Tips

Create a symlink under Linux: How it works

by Johannes

Symlinks are often used under Linux to make files or folders accessible at a different location.

Create a symlink under Linux in just a few steps

A symlink, also called a symbolic link, is a shortcut to a file or folder. A symlink points to the target file or folder, but it is not the same file or folder. To create one on Linux:

  • Open a terminal window.
  • Navigate to the directory where you want to create the symlink.
  • Enter the following command: ln -s
  • Example: ln -s /home/user/Desktop/myFile.txt /home/user/Desktop/myFileLink.txt. This command creates a symlink with the name “myFileLink.txt” in the directory “/home/user/Desktop”. The symlink points to the file “myFile.txt”, which is located in the directory “/home/user/Desktop”.
  • Options for the ln command: -s: Creates a symbolic link. -f: Overwrites an existing symlink. -i: Asks before overwriting an existing symlink. -r: Creates a symbolic link relative to the current directory.
  • Delete a symlink: To delete a symlink, enter the following command: rm
  • Example: rm myFileLink.txt. This command deletes the symlink with the name “myFileLink.txt”. The symlink is deleted from the file system, but the target file or folder remains.

Use of symlinks with Linux

Symlinks on Linux can be used in a number of ways. Here are some examples:

  • To make files or folders accessible in another location: You can create a symlink to a file or folder that is located in another directory. This allows you to access the file or folder as if it were in the current directory.
  • Grouping files or folders: You can create several symlinks to files or folders and group them together in one directory. This makes it easier to find files or folders.
  • Files or folders can be hidden: You can create a symlink to a file or folder and then move the symlink to a directory you do not want to show. This makes the file or folder invisible to other users.

Related Articles

Leave a Comment