The ln command for Linux

Source: Internet
Author: User

First, Introduction

The ln command is used to create a link between a file, a soft link (similar to a shortcut in a Windows system), and a hard link (equivalent to a source file copy), which uses hard links by default.

Ii. Methods of Use
Syntax: ln [options] [file] option:-S creates a soft link to the source file

Third, the case:

1. Creating a soft link to a file

[[email protected] ~]# ln-s/root/student.sql/root/db/ln.sql[[email protected] ~]# ls-lh db/ln.sql lrwxrwxrwx 1 root ro OT 17 February  15:31 Db/ln.sql-/root/student.sql

2. Create a soft link to the catalog

[[email protected] ~]# ln-s db data[[email protected] ~]# ll-h data/lrwxrwxrwx 1 root root 17 February  15:31 ln.sql-&G T /root/student.sql[[email protected] ~]# ln student.sql db/

3. Create a hard link to a file

[[Email protected] ~]# ln student.sql db/[[email protected] ~]# ls-lh db/lrwxrwxrwx 1 root root   17 February  15:31 Ln . sql-/root/student.sql-rw-r--r--2 root root 2.9K February  10:17 student.sql

Third, soft and hard link description

Soft Link: Can not delete the source file, delete the source file causes the link file cannot be found, the file appears red flashing
Hard Link: Can delete source file, link file can open normally

 

The ln command for Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.