For those who don’t know, symlinks are files that link to other files. also known as soft links because they’re only links to the original files. If these links are deleted, the original files won’t be impacted since they’re only link references to them. There’s also a hard link that functions more as copies of the files they reference than just literal links. In most instances, hard links are avoided since their copy original files and may not be suitable since you’re duplicating the original files. Symlinks are handy in many ways. Instead of restructuring the underlying filesystems to support applications and other services, developers can use symlinks without having to move files around or change file structure. Symlinks only work if they’re pointing to the files that already exist and spell out a clear path to the files they’re referencing. If the original files are deleted or moved, these symlinks will not function. To setup symlinks in Ubuntu follow the steps below:
Create Symlinks in Ubuntu
To create a symlink in Ubuntu, make sure the symlink tool is installed. By default, it should be. If not, run the commands below: After installing the symlinks tool, you can then run the commands below to create a symlink.
ln ==> command to create a symlink -s ==> command option which represents symlink original-file.txt ==> the original file linkname ==> the link name that points to the original file
That’s how one creates a simple symlink to files.
Find Symlinks
One can use the symlinks command to find symlink references in a given directory. However, the command may not come installed by default on Ubuntu. Run the commands below to install symlinks. Now that symlinks are installed, use the commands below to search for symlinks. If you want to search for all symlinks in a particular directory, you run the commands below The commands above will display all symlinks in the specified directory. If you want to search for all symlinks in a particular directory recursively, you use the -r command option. That should help you find symlinks in a specified directory. That’s should do it! Congratulations! You have learned how to create and search symlinks and references on Ubuntu You may also like the post below: