Linking files and directories in Linux in Hindi

Linux mein files aur directories ko link karne ka matlab hota hai ki aap unhein ek se adhik sthanon par reference kar rahe hain. Linux mein do prakar ke links hote hain: hard links aur symbolic links (symlinks).

Linking files and directories in Linux in Hindi

1. Hard Links:

  • Hard links ek file ke multiple references hote hain jo ek hi inode (metadata) ko share karte hain.
  • Hard links ka istemal sirf files ke liye hota hai, directories ke liye nahi.
  • Hard links ke liye file aur linked file dono ko ek hi filesystem mein hona chahiye.
  • Agar aap kisi hard linked file mein koi changes karte hain, to ye changes dusre linked files mein bhi dikhai denge, kyun ki ye sab ek hi inode ko point karte hain.

Hard link banane ke liye ln command ka istemal hota hai:

ln [options] source_file link_name

Example:

ln file1.txt link1.txt

Is example mein, file1.txt ko link1.txt ke roop mein hard link banaya gaya hai.

2. Symbolic Links (Symlinks):

  • Symbolic links ek file ya directory ke symbolic reference hote hain, jo ek alag inode ko point karte hain.
  • Symlinks cross-filesystem bhi ho sakte hain, kyunki ye inode ki jagah us file ya directory ka full path store karte hain.
  • Symlinks mein original file ya directory ko delete karne se symlink ka koi asar nahi padta, kyun ki symlink sirf reference hai.

Symlink banane ke liye ln command ke -s option ka istemal hota hai:

ln -s source_file_or_directory symlink_name

Example:

ln -s /path/to/file1.txt symlink1.txt

Is example mein, /path/to/file1.txt ko symlink1.txt ke roop mein symbolic link banaya gaya hai.

Links ka istemal files aur directories ko reference karne aur organization improve karne ke liye hota hai. Aap symbolic links ka istemal kisi specific location ya file ko access karne ke liye bhi kar sakte hain, jisse aapko file system ka better control milta hai.

Leave a Comment