作者:vbppn65853 | 来源:互联网 | 2023-05-18 04:46
Whenwecreateasymlink,thenumberofbytesthesymlinktakesupisexactlythelengthoftheorig
When we create a symlink, the number of bytes the symlink takes up is exactly the length of the origin it points to. For instance,
当我们创建一个符号链接时,符号链接占用的字节数就是它指向的原点的长度。例如,
$ ln -s dest link1
$ ln -s longer_dest link2
$ ls -l
lrwxrwxrwx 1 username 4 Mar 26 20:21 link1 -> dest
lrwxrwxrwx 1 username 11 Mar 26 20:21 link2 -> longer_dest
where link1
takes up 4 bytes, which is the length of dest
; link2
takes up 11 bytes, which is the length of longer_dest
. Therefore, symlinks are in fact no more than the destination path stored in plain text. So I am wondering if it is possible to edit (the destination) of a symlink in text editors, preferably Emacs. I googled for a while and couldn't find anyone talking about this. Note that this question is purely out of curiosity; I know full well that I can overwrite a symlink by ln -f -s
.
其中link1占4字节,即dest的长度;link2占用了11个字节,即最长的字节。因此,符号链接实际上并不仅仅是存储在纯文本中的目标路径。所以我想知道是否有可能在文本编辑器(最好是Emacs)中编辑符号链接(目标)。我在谷歌上搜索了一会儿,没发现有人在谈论这件事。注意,这个问题纯粹出于好奇;我很清楚我可以用ln -f -s覆盖一个符号链。
4 个解决方案