Article Title: how to create a link in a Linux operating system. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories 1: Use the cd command as the main directory
Cd
2: Use touch to create a file named aa
Touch aa
3: run the ls-l command to query the file you just saw.
Ls-l
Shown as follows:
-Rw-r -- rr -- 1 user usergroup 0 otc 22 10: 20 aa
4: Use the ln command to create a hard link named bb:
Ln aa bb
5: Use the ln-s command to create a soft link for aa, called cc:
Ln-s aa cc
6: Use the echo command and output to redirect to aa and add "Yes ".
Echo "Yes"> aa
7. Run cat aa and ls-l respectively to observe the changes of the three files.
Working principle: these links reference the same file, but they appear in different ways on the system. Both soft link and hard link point to the same file, and editing them will modify the content of the original file. The difference between a soft link and a hard link is that when a file is deleted, the processing method is different. When the link and the file are located on different file systems, they are used in different ways.
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.