实例: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. php中页面跳转部分方法论述

    假设当前页面:http://localhost:80/index.php 1.include echo “include t1.php”; 跳转后,url地址栏http://localhost:80/ ...

  2. 一个极其简洁的Python网页抓取程序,自己主动从雅虎財经抓取股票数据

    本程序使用Python 2.7.6编写,扩展了Python自带的HTMLParser,自己主动依据预设的股票代码列表,从Yahoo Finance抓取列表中的数据日期.股票名称.实时报价.当日变化率. ...

  3. Linux 命令 快捷命令综合

    FTP开机启动 启动要让FTP每次开机自动启动,运行命令:  chkconfig --level 35 vsftpd on linux 关机 1.halt linux 注销 1.logout linu ...

  4. git笔记之解决eclipse不能提交jar等文件的问题

    今天用git托管了一个java web项目,由于是web项目,所以要上传jar文件(此项目未使用maven管理),一直使用git commit and push,就是在server上看不到jar文件上 ...

  5. STM32W108无线传感器网络嵌入式uCOS-II的移植及实时环境监測

    基于STM32W108无线开发板,将ucos-ii v2.86内核移植到其上,并加入用户任务.实现对温湿度.超声波.声音.光敏等传感器的控制及实时数据採集. 14.1开发环境说明 硬件:STM32W1 ...

  6. HDU5086Revenge of Segment Tree(数论)

    HDU5086Revenge of Segment Tree(数论) pid=5086" target="_blank" style="">题目 ...

  7. WPF Media 简单的播放器

    <Window x:Class="PlayTest.MediaControl" xmlns="http://schemas.microsoft.com/winfx/ ...

  8. 编译联想A820内核源码

    编译平台:Fedora 20 x64 交叉编译工具链:arm-linux-androideabi-4.6 话说这个编译工具我研究了两天,Fedora自带一个arm-none-eabi的ToolChai ...

  9. Lua语言在Wireshark中使用(转)

    1.       检查Wireshark的版本是否支持Lua 打开Wireshark,点击“HelpàAbout Wireshark”菜单,查看弹出的对话框,如果有“with Lua 5.1”表示支持 ...

  10. Hbase结构简单、作法

    Hbase架构简单介绍.实践 版权声明:本文博主原创文章,博客,未经同意不得转载.