Linux / UNIX create soft link with ln command

How to: Linux / UNIX create soft link with ln command

by NIXCRAFT on SEPTEMBER 25, 2007 · 42 COMMENTS· LAST UPDATED SEPTEMBER 25, 2007

in DEBIAN / UBUNTUFILE SYSTEMFREEBSD

Q. How do I create a soft link (symbolic link) under UNIX or Linux operating system?

A. To make links between files you need to use ln command. A symbolic link (also known as a soft link or symlink) consists of a special type of file that serves as a reference to another file or directory. Unix/Linux like operating systems often uses symbolic links.

Two types of links

There are two types of links

  • symbolic links: Refer to a symbolic path indicating the abstract location of another file
  • hard links : Refer to the specific location of physical data.

How do I create soft link / symbolic link?

To create a symbolic link in Unix or Linux, at the shell prompt, enter the following command:
ln -s {target-filename} {symbolic-filename}

For example create softlink for /webroot/home/httpd/test.com/index.php as /home/vivek/index.php, enter the following command:
ln -s /webroot/home/httpd/test.com/index.php /home/vivek/index.php
ls -l

Output:

lrwxrwxrwx 1 vivek  vivek    16 2007-09-25 22:53 index.php -> /webroot/home/httpd/test.com/index.php

转载于:https://www.cnblogs.com/hackerl/p/3231959.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值