0

Linux常用命令-61:ln

 1 year ago
source link: https://xugaoxiang.com/2022/06/19/linux-cmds-61-ln/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ln 命令是链接的意思, 功能是为某一个文件创建一个链接。这里的链接有两种,一种是硬链接,另一种是符号链接,也叫软链接。

硬链接是源文件的副本,和源文件一样的大小,但是事实上却不占任何空间。软链接可以理解为 windows 中的快捷方式,可以为文件夹创建软链接。

常用参数:

8e29dba82bbb56d4.png
# 为文件test.py创建硬链接文件link.py
ln test.py link.py

# 为test.py创建软链接slink.py
ln -s test.py slink.py

# 通过ls -l来查看文件的链接情况
ls -l slink.py

# 删除链接文件
unlink slink.py

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK