50%

🚀

4

Linux .

Merion Academy


, ln Linux.

 Ln

Ln

ln, :

ln [-sf] [source] [destination]
  • ln hard link ( ).
  • -s, , soft link.
  • -f .
  • Source - , .
  • Destination - - , .

, :

ln -s test_file.txt link_file.txt

link file.text, testfile.txt.

, , ls:

ls -l link_file.txt
ls -l link_file.txt

Linux

. Linux:

ln -s /mnt/external_drive/stock_photos ~/stock_photos

stock_photos ~ /. stock_photos external_drive.

ln -s /mnt/external_drive/stock_photos ~/stock_photos
. , , .

, :

File exists

, link_file.txt. -f, :

ln -sf test_file.txt link_file.txt
ln -sf test_file.txt link_file.txt
. -f .

, (, ), . , rm (remove) unlink:

rm link_file.txt
unlink link_file.txt	
No such file

Soft Links Hard Links

ln :

  • Hard Links ( )
  • Soft Links ( )

(Soft Links)

, soft link, . .

:

  • , .
  • , .
  • .
  • .

(Hard Links)

, :

  • .
  • , , .
  • inode.

, inode . .

:

  • , .
  • , - .
  • .
  • , .

>