[root@Localhost home]# touch /boot/abc.txt -- create abc file
[root@Localhost home]# ln –s
< Sourced file > < destination path >
[root@Localhost home]# ln -s /boot/abc.txt /home/xyz.txt -- create soft link in home dir and file name
is xyz
---------------------------------------------------------------------------------------------------------------------
[root@Localhost home]# cat /boot/abc.txt ---
check file contain
hello,
how
are you
---------------------------------------------------------------------------------------------------------------------
[root@Localhost home]# cat /home/xyz.tex -- check symlinks file contain
hello,
how
are you
---------------------------------------------------------------------------------------------------------------------
[root@Local]# ls -l /home/xyz.tex - check full details of file like permission,
type, size, etc.
lrwxrwxrwx
1 root root 13 Feb 6 06:24 /home/xyz.tex -> /boot/abc.txt
---------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------
Note
: we can create multiple symlinks
-------------------------------------------------------------------------------------------------------------------------
ORPHAN
FILE : --soft symlink parent file will delete, get the error of symlink file
[root@Localhost
boot]# rm -rf abc.txt --- delete parent file
[root@Localhost
boot]# ls -l /home/xyz.tex
lrwxrwxrwx
1 root root 13 Feb 6 06:24 /home/xyz.txtex -> /boot/abc.txt -- its show -means
-ORPHAN
Soft link / symlink disadvantage ----if parent file
get delete child file will be ORPHAN
Advantage
1 Symlink
can create DIR / Folder
2 We
can create multiples symllinks
Sysmlink
can cross the partition
Symlinks
can’t occupy space
-------------------------------------------------------------------------------------------------------------------------Hardlinks ----- Disadvantage
hardlinks
cannot cross the partition
Both the
file occupy space
Hardlink – types of backup
[root@Localhost
boot]# touch /boot/abc.txt
[root@Localhost
boot]# ln /boot/abc.txt /boot/xyz.txt - create hardlink
[root@Localhost
boot]# ls -l /boot/xyz.txt ---- check
hardlink file
-rw-r--r-- 2 root root 0 Feb 6 07:51 /boot/xyz.txt
[root@ boot]# ln /boot/abc.txt
/home/xyz.txt --- if we try to create
hardlink in different portion
ln: creating hard link
`/home/xyz.txt' => `/boot/abc.txt': Invalid cross-device link --- error massage
------------------------------------------------------------------------------------------------------------------------
hardlinks
cannot cross the partition
-------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment