Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:symlinks [2024-12-01 Sun wk48 11:17] – [Simlinks] baumkphome_server:home_server_setup:other_services:symlinks [2025-01-10 Fri wk02 11:55] (current) – [References] baumkp
Line 4: Line 4:
 A symlink is a soft or hard link to a directory location to another directory location or file.  It effectively allows a directory tree (soft link only) to be made for different non-structured directory locations, even across partitions.  It allows configuration file control by having current configuration file pointing to different version or use type configuration files, depending on use case. A symlink is a soft or hard link to a directory location to another directory location or file.  It effectively allows a directory tree (soft link only) to be made for different non-structured directory locations, even across partitions.  It allows configuration file control by having current configuration file pointing to different version or use type configuration files, depending on use case.
  
-Simple use is: ''%%ln -s "path/directory or file" "path/symlink name"%%'', where option ''-s'' is to create a symlink. See ''ln --help'' or ''man ln'' for more information.+Simple use is:  
 +  *''%%ln -s "path/directory or file" "path/symlink name"%%'', where option ''-s'' is to create a symlink. See ''ln --help'' or ''man ln'' for more information. 
 +  *''%%ln "path/file" "path/symlink name"%%'', which creates a hard link to a file. (Where: hard links to directories are not allowed and hard links to files must be on same devices) 
 +Where:
   *To remove symlink ''%%rm "path/symlink name"%%''   *To remove symlink ''%%rm "path/symlink name"%%''
   *To list symlink ''%%ls "path/symlink name"%%''   *To list symlink ''%%ls "path/symlink name"%%''
Line 29: Line 32:
   *Incremental back-ups, use of hard links saves duplicating file data   *Incremental back-ups, use of hard links saves duplicating file data
   *Virtual File systems where source soft link directions do not resolve.  E.g. Docker configuration files.   *Virtual File systems where source soft link directions do not resolve.  E.g. Docker configuration files.
 +
 +----
 +====Link Tools====
 +  *Use the ''stat'' command on a file/directory/symlink/device/pipe to get the statistics of the file.  Remember in link all these are stored as files.
 +  *''find dir  -xdev \! -type d -links +1  -printf '%20D %20i %p\n' | sort -n | uniq -w 42 --all-repeated=separate''  will find and list files that have common inode numbers in the nominated ''dir''
 +
 ---- ----
  
 ====References==== ====References====
-  *[[http://www.thegeekstuff.com/2010/10/linux-ln-command-examples/|Linux Soft and Hard Link Guide]] (10 ln Command Examples) +  *[[http://www.thegeekstuff.com/2010/10/linux-ln-command-examples/|Linux Soft and Hard Link Guide]] (10 ln Command Examples from The geek stuff
-  *[[https://www.geeksforgeeks.org/difference-between-hard-link-and-soft-link/|Difference between Hard Link and Soft Link]]+  *[[https://www.geeksforgeeks.org/difference-between-hard-link-and-soft-link/|Difference between Hard Link and Soft Link]] (Geeks for Geeks) 
 +  *Linux Handbook [[https://linuxhandbook.com/ln-command/|ln Command Examples]] 
 +    *[[https://linuxhandbook.com/hard-link/|Everything Important You Need to Know About Hard Link in Linux]] 
 +    *[[https://linuxhandbook.com/symbolic-link-linux/|What is Symbolic Links in Linux? How to Create Symbolic Links?]] 
 +  *[[https://www.baeldung.com/linux/soft-links-to-directories|How to Create Soft Links to Directories]] (Baeldung) 
 +  *[[https://www.theunixschool.com/|The Unix School]] 
 +    *[[https://www.theunixschool.com/2011/06/inode-all-about-inodes.html| Inode - All about inodes]] 
 +    *[[https://www.theunixschool.com/2012/03/soft-links-hard-links-all-about-inodes.html|Soft Links & Hard Links - All about Inodes - Part 2]] 
 +    *[[https://www.theunixschool.com/2012/08/move-files-and-directories-inodes-part-3.html|Move files and directories : Inodes Part 3]] 
  
 ---- ----
  
 <- home_server:home_server_setup:other_services:systemd|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:fail2ban|Next -> <- home_server:home_server_setup:other_services:systemd|Prev ^ home_server:home_server_setup:other_services:index|Start page ^ home_server:home_server_setup:other_services:fail2ban|Next ->