![]() ![]() ![]() If we ever change the directory name “alex” in the future, to something else, this soft link will break. Why would this be useful? Assume we stored an absolute path here with this command: ln -s /home/alex/Pictures/family_dog.jpg absolute_shortcut For example, if our current directory is /home/alex, we could create a “shortcut” to our dog picture with the following comand: ln -s Pictures/family_dog.jpg picture_shortcut In our first command, ln -s /etc/fstab fstab_shortcut, we used an absolute path. If you’d try to write to “fstab_shortcut”, this would be denied because the permissions of the destination file apply, and /etc/fstab does not allow regular users to write here. That’s because the permissions of the soft link do not matter. You may also notice that all permission games:x:20:bits, rwx (read, write, execute) seem to be enabled for this file. So in our case, it would be: readlink fstab_shortcut Soft Link Permissions An alternative command to see the path stored in a soft link is: readlink path_to_soft_link If this path is long, ls -l might not show the entire path. And ls -l even displays the path that the soft link points to. Now if we list files and directories in a long list format, we’ll see: ls -l path_to_link_file: Our soft link file will be created hereįor example, to create a symbolic link that points to the /etc/fstab file, we can enter: ln -s /etc/fstab fstab_shortcut.path_to_target: Our soft link will point to this path (location of a file or directory).The syntax of the command to create a soft link is the same as before, but we add the -s or –symbolic option: ln -s path_to_target path_to_link_fileīelow is a breakdown of the command above: It’s almost like a text file, with a path to a file or directory inside. But a soft link is nothing more than a file that points to a path instead. Simply put, double-clicking on that shortcut redirects you to the file C:\Program Files\M圜oolApp\application.exe, which gets executed. And when you double-click the shortcut, this only points to an executable file at C:\Program Files\M圜oolApp\application.exe. It may have its files stored in C:\Program Files\M圜oolApp directory. The application is obviously not installed on your desktop. You double-click on that shortcut, and that application gets launched. ![]() Know how when you install a program on Windows, you might get a shortcut on your desktop. To learn more about hard links in Linux, check out this blog post: Linux - Create and Manage Hard Links. ![]()
0 Comments
Leave a Reply. |