Symbolic Links On Linux Obtener enlace Facebook X Pinterest Correo electrónico Otras aplicaciones - febrero 08, 2022 Symbolic Links On LinuxCONTENTSLinks TypesHow to Use the ln CommandCreating Symlink To a FileCreating Symlinks To a DirectoryOverwriting SymlinksRemoving Symlinks--------------------------------------------------------------------------------------------------------Definition:A symbolic link, also known as a symlink or soft link, is a special type of file that points to another file or directory.ln command to create symbolic links.----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Links TypesThere are two types of links in Linux/UNIX systems:Hard links. You can think a hard link as an additional name for an existing file. Hard links are associating two or more file names with the same inode . You can create one or more hard links for a single file. Hard links cannot be created for directories and files on a different filesystem or partition.Soft links. A soft link is something like a shortcut in Windows. It is an indirect pointer to a file or directory. Unlike a hard link, a symbolic link can point to a file or a directory on a different filesystem or partition.--------------------------------------------------------------------------------------------How to Use the ln Commandln is a command-line utility for creating links between files. By default, the ln command creates hard links. To create a symbolic link, use the -s (--symbolic) option.The ln command syntax for creating symbolic links is as follows:ln -s [OPTIONS] FILE LINK--------------------------------------------------------------------------Creating Symlink To a FileTo create a symbolic link to a given file, open your terminal and type:ln -s source_file symbolic_link CopyReplace source_file with the name of the existing file for which you want to create the symbolic link and symbolic_link with the name of the symbolic link.----------------------------------------------------------------------------------------Creating Symlinks To a Directory ln -s /mnt/my_drive/movies ~/my_movies--------------------------------------------------------------------------------------------Overwriting SymlinksIf you try to create a symbolic link that already exists , the ln command will print an error message.ln -s my_file.txt my_link.txtCopyln: failed to create symbolic link 'my_link.txt': File existsCopyTo overwrite the destination path of the symlink, use the -f (--force) option.ln -sf my_file.txt my_link.txt----------------------------------------------------------------------Removing SymlinksTo delete/remove symbolic links use either the unlink or rm command.The syntax of the unlink is very simple:unlink symlink_to_remove CopyRemoving a symbolic link using the rm command is the same as when removing a file:rm symlink_to_remove--------------------------------------------------------------------------------------------For more information about the ln command, visit the ln man page or type man ln in your terminal.------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Referencia: Linuxize 2022 https://linuxize.com/post/how-to-create-symbolic-links-in-linux-using-the-ln-command/ Obtener enlace Facebook X Pinterest Correo electrónico Otras aplicaciones Comentarios
Comentarios
Publicar un comentario