linux ln创建目录软连接

简介: ln 软连接目录

ln 帮助说明

ln --help

Usage: ln [OPTION]... [-T] TARGET LINK_NAME   (1st form)

 or:  ln [OPTION]... TARGET                  (2nd form)

 or:  ln [OPTION]... TARGET... DIRECTORY     (3rd form)

 or:  ln [OPTION]... -t DIRECTORY TARGET...  (4th form)



Mandatory arguments to long options are mandatory for short options too.

     --backup[=CONTROL]      make a backup of each existing destination file

 -b                          like --backup but does not accept an argument

 -d, -F, --directory         allow the superuser to attempt to hard link

                               directories (note: will probably fail due to

                               system restrictions, even for the superuser)

 -f, --force                 remove existing destination files

 -i, --interactive           prompt whether to remove destinations

 -L, --logical               dereference TARGETs that are symbolic links

 -n, --no-dereference        treat LINK_NAME as a normal file if

                               it is a symbolic link to a directory

 -P, --physical              make hard links directly to symbolic links

 -r, --relative              create symbolic links relative to link location

 -s, --symbolic              make symbolic links instead of hard links

 -S, --suffix=SUFFIX         override the usual backup suffix

 -t, --target-directory=DIRECTORY  specify the DIRECTORY in which to create

                               the links

 -T, --no-target-directory   treat LINK_NAME as a normal file always

 -v, --verbose               print name of each linked file

     --help     display this help and exit

     --version  output version information and exit

记录意义

每次使用ln -s创建软连接的时候都会忘记哪个是source,哪个是dst


#目的地 /home/mep/xml/

#源目录 /home/gsta/xml/

#期望:目的地里面的文件指向是源目录里面的文件

ln -s /home/gsta/xml /home/mep

备注:

创建目录软连接的时候,会把源目录,的一个软连接放到目的地的里面,而不是类似于copy,所以目的地不可以写/home/mep/xml,要写xml的上层目录即/home/mep


目录
相关文章
|
20天前
|
Linux 数据安全/隐私保护 Windows
Linux共享Windows目录
Linux共享Windows目录
|
13天前
|
Linux 应用服务中间件 nginx
|
19天前
|
Linux
linux如何去掉目录背景颜色
linux如何去掉目录背景颜色
17 1
|
23天前
|
JSON Linux 网络安全
【Azure 应用服务】如何从App Service for Linux 的环境中下载Container中非Home目录下的文件呢?
【Azure 应用服务】如何从App Service for Linux 的环境中下载Container中非Home目录下的文件呢?
|
25天前
|
Ubuntu Linux 测试技术
在Linux中,已知 apache 服务的访问日志按天记录在服务器本地目录/app/logs 下,由于磁盘空间紧张现在要求只能保留最近7天的访问日志,请问如何解决?
在Linux中,已知 apache 服务的访问日志按天记录在服务器本地目录/app/logs 下,由于磁盘空间紧张现在要求只能保留最近7天的访问日志,请问如何解决?
|
25天前
|
Shell Linux 开发工具
在Linux中,如何编写shell脚本将当前目录下大于10K的文件转移到/tmp目录下?
在Linux中,如何编写shell脚本将当前目录下大于10K的文件转移到/tmp目录下?
|
25天前
|
Linux Shell 网络安全
在Linux中,rsync同步时,如何删除目标数据多出来的数据,即源上不存在,但目标却存在的文件或者目录?
在Linux中,rsync同步时,如何删除目标数据多出来的数据,即源上不存在,但目标却存在的文件或者目录?
|
25天前
|
Linux
在Linux中,如何使用xargs和exec实现把当前目录下所有后缀名为.txt的⽂件的权限修改为777。
在Linux中,如何使用xargs和exec实现把当前目录下所有后缀名为.txt的⽂件的权限修改为777。
|
25天前
|
Linux
在Linux中,Rsync 同步时,如果要同步的源中有软连接,如何把软连接的目标文件或者目录同步?
在Linux中,Rsync 同步时,如果要同步的源中有软连接,如何把软连接的目标文件或者目录同步?
|
25天前
|
Linux
在Linux中,如何删除/a/b下的所有文件及目录?
在Linux中,如何删除/a/b下的所有文件及目录?