实例:ln -s /home/gamestat    /gamestat

linux下的软链接类似于windows下的快捷方式

ln -s a b 中的 a 就是源文件,b是链接文件名,其作用是当进入b目录,实际上是链接进入了a目录

如上面的示例,当我们执行命令   cd /gamestat/的时候  实际上是进入了 /home/gamestat/

值得注意的是执行命令的时候,应该是a目录已经建立,目录b没有建立。我最开始操作的是也把b目录给建立了,结果就不对了

删除软链接:

   rm -rf  b  注意不是rm -rf  b/

ln  a b 是建立硬链接

建立链接的使用方法如下:

[root@WEB_YQ_64_79 /]# 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)

In the 1st form, create a link to TARGET with the name LINK_NAME.

In the 2nd form, create a link to TARGET in the current directory.

In the 3rd and 4th forms, create links to each TARGET in DIRECTORY.

Create hard links by default, symbolic links with --symbolic.

When creating hard links, each TARGET must exist.

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

-n, --no-dereference        treat destination that is a symlink to a

directory as if it were a normal file

-i, --interactive           prompt whether to remove destinations

-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

-v, --verbose               print name of each file before linking

--help     display this help and exit

--version  output version information and exit

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.

The version control method may be selected via the --backup option or through

the VERSION_CONTROL environment variable.  Here are the values:

none, off       never make backups (even if --backup is given)

numbered, t     make numbered backups

existing, nil   numbered if numbered backups exist, simple otherwise

simple, never   always make simple backups

Report bugs to <bug-coreutils@gnu.org>.

转自:http://biyutong.iteye.com/blog/1445699

【转】linux建立软链接的更多相关文章

  1. linux ln 建立软链接-- 基于dubbo-zookeeper服务的 服务jar 引用公共的 lib

    对于ln命令网上有很多的教程,这里不再复述, 其基本目的是:多个文件夹公用一个文件夹的里的文件. 其基本命令格式: ln [option] source_file dist_file (source_ ...

  2. linux建立动态库的软链接

    复制动态库: /home/wmz/anaconda3/lib/ 删除原链接: 建立新链接: /home/wmz/anaconda3/lib/libstdc++.so. 问题的起源是,安装anacond ...

  3. Linux 建立文件夹的链接

    linux下的软链接类似于windows下的快捷方式 建立软链接 ln -s a b a 就是源文件,b是链接文件名,其作用是当进入b目录,实际上是链接进入了a目录 example:ln -s /ho ...

  4. Windows 下对目录建立软链接

    在Linux下,可以很方便的通过ln命令创建对文件和对文件夹的软链接.在Windows下,通过快捷方式,可以创建到文件和文件夹的链接,但是这软链接不是一个层面的上东西.软链接是底层文件系统层面的,而快 ...

  5. linux下软链接与硬链接及其区别

    linux下创建链接命令 ln -s 软链接 这是linux中一个非常重要命令,请大家一定要熟悉.它的功能是为某一个文件在另外一个位置建立一个不同的链接,这个命令最常用的参数是-s, 具体用法是:ln ...

  6. linux 创建软链接和硬链接

    Linux 系统中有软链接和硬链接两种特殊的“文件”. 软链接可以看作是Windows中的快捷方式,可以让你快速链接到目标档案或目录. 硬链接则透过文件系统的inode来产生新档名,而不是产生新档案. ...

  7. [转帖]Linux 下软链接和硬链接的区别

    Linux 下软链接和硬链接的区别 http://os.51cto.com/art/201911/605267.htm 软连接 文件是小的 只是一个链接 删除和其他处理不影响 原始文件的计数 删除源文 ...

  8. Linux下软链接与硬链接的区别

    由于下面会说到inode,所以如果没有了解过,请务必搞懂inode的真正含义,厚颜无耻的推荐我的一篇博客:Linux磁盘与文件系统管理 如果我们在系统中新建一个文件,我们看到的文件名实际上只是表面现象 ...

  9. linux建立文件夹软连接

    linux建立文件夹软连接,并强制覆盖 ln -sfn /home/var/log/httpd/logs logs 这将在当前目录下建立logs软连接,指向/home/var/log/httpd/lo ...

随机推荐

  1. Filter基金会

    一个.总结 简单的说,Filter的作用就是拦截(Tomcat的)service(Request,Response)方法.拿到Request.Response对象进行处理.然后释放控制.继续自己主动流 ...

  2. Smarty模板引擎的使用

    Smarty模板引擎的使用 Smarty是PHP中一个基于MVC模式的模板引擎. Download: http://www.smarty.net/download   特点 1.  最快速度的程序开发 ...

  3. 创建和关联内容数据库到指定Web应用程序和站点集

    创建和关联内容数据库到指定Web应用程序和站点集         一个Web应用程序不限于使用单个内容数据库.SharePoint同意你关联多个内容数据库到Web应用程序.原因之中的一个是基于内容数据 ...

  4. WPF如何获得变量异步回调函数时产生的异步回调

    有这样的问题,WPF当使用异步回调,需要使用产生的异步变量中的回调函数.数据库中查询诸如异步函数来获得一DataTable.怎样传递给回调函数呢? [方案一]使用全局变量 非常easy想到的是用全局变 ...

  5. 【Linux驱动】TQ2440 LED驱动程序

    ★整体介绍 LED驱动程序主要实现了TQ2440开发板上的4个LED灯的硬件驱动,实现了对引脚GPIOB5.GPIOB6.GPIOB7.GPIOB8的高低电平设置(common-smdk.c中已经实现 ...

  6. 局域网连接SQL Server数据库配置

    首先要保证两台机器位于同一局域网内,然后打开配置工具→SQL Server配置管理器进行配置.将MSSQLSERVER的协议的TCP/IP的(IP1.IP2)TCPport改为1433,已启用改为是. ...

  7. 远程连接到vultr vps的mysql服务器

    实验环境 vultr centos 6.7 x64 1. 首先要打开远程 vps的3306端口用于 mysql的连接 修改/etc/sysconfig/iptables 文件,添加3306端口的支持 ...

  8. 【互动问答分享】第15期决胜云计算大数据时代Spark亚太研究院公益大讲堂

    "决胜云计算大数据时代" Spark亚太研究院100期公益大讲堂 [第15期互动问答分享] Q1:AppClient和worker.master之间的关系是什么? AppClien ...

  9. Cocos性能优化工具的开发介绍Visual Studio内存泄漏检测工具——Visual Leak Detector

    然后,Windows下有什么好的内存泄漏检測工具呢?微软提供Visual Studio开发工具本身没有什么太好的内存泄漏检測功能.我们能够使用第三方工具Visual Leak Detector(下面简 ...

  10. 于iOS跳转到应用程序AppStore

    1.找到应用程序的叙述原文链接,实例: https://57324.api-01.com/serve? action=click&publisher_id=57324&site_id= ...