在Linux系统中,我们有可能会在多处用到一个相同的文件,如何做到多份同一份文件的同步?这时我们就可以使用软链接来同步这一份文件。软链接也称为symbolic links

软链接参数

常用参数

 -s, --symbolic              make symbolic links instead of hard links
 -f, --force                 remove existing destination files
 -n, --no-dereference        treat LINK_NAME as a normal file if
                                it is a symbolic link to a directory

软链接语法

创建软链接

使用-s参数
软链接文件
ln -s sourceFile targetFile

软链接目录
ln -s sourceFile targetDir
如/usr/local/mysql/bin/mysql需要将mysql在/usr/bin也能使用,我们可以通过软链接:
ln -s /usr/local/mysql/bin/mysql /usr/bin

修改软链接

使用-snf参数
ln -snf /usr/local/mysql/bin/mysql /usr/bin/test

相关文章:

  • 2021-04-22
  • 2021-05-10
  • 2021-11-07
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2021-04-04
  • 2021-08-07
  • 2021-10-23
相关资源
相似解决方案