In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to use commands to connect files in CentOS, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
After a long time of learning CentOS system, you may encounter CentOS connection problems, here will introduce the solution to the CentOS connection problem CentOS connection file and Windows system "shortcut" is similar, but in the Linux system CentOS connection file is divided into hard CentOS connection and symbol CentOS connection.
For a hard CentOS connection, only one more associated data is written to the block under a certain directory, and the incode and disk space are not used up. (it is only when the block of the directory is used up that an additional block can be added to complete the connection, resulting in a change in disk space, which is highly unlikely). The symbol CentOS connection can be understood as a shortcut such as Windows. The symbol CentOS connection is a separate new file, so it takes up inode with blocks. (note: in the ext2 file system, a file consists of a file attribute block (that is, indoe talbe) and a file content block.
Now to test the difference between a hard CentOS connection and a symbolic CentOS connection, first understand the use of the CentOS connection file ln command:
-blike-- backup but does not accept an argument
-d,-F,-- directory establishes a hard CentOS connection to the directory.
Allow the superuser to attempt to hard link directories (note: will probably
Fail due to system restrictions, even for the superuser)
-s,-- symbolic make symbolic links instead of hard links establishes a symbolic CentOS connection to the source file instead of a hard CentOS connection
Actual operation:
[root@CentOS4 tmp] # du-sb; df-I / / shows the capacity occupied by the current directory and the size of disk space
36100131.
Filesystem Inodes IUsed IFree IUse% Mounted on
/ dev/sda1 917504 113524 803980 13% /
None 129323 1 129322 1 per dev/shm
[root@CentOS4 tmp] # vi test / / create a test file test using vi
Hello everyone!
"test" [New] 1L, 16C written
[root@CentOS4 tmp] # du-sb; df-I / / shows the capacity occupied by the current directory and the size of disk space
36100147.
Filesystem Inodes IUsed IFree IUse% Mounted on
/ dev/sda1 917504 113525 803979 13% /
None 129323 1 129322 1 per dev/shm
[root@CentOS4 tmp] # ln test test-hd / / create a hard CentOS connection file test-hd for test
[root@CentOS4 tmp] # du-sb; df-I / / View the directory capacity and disk size after establishing the hardware CentOS connection file
Here we can find that the directory capacity disk size has not changed.
36100147.
Filesystem Inodes IUsed IFree IUse% Mounted on
/ dev/sda1 917504 113525 803979 13% /
None 129323 1 129322 1 per dev/shm
[root@CentOS4 tmp] # ln-s test test-so / / create a symbolic CentOS connection file for test test-so file
[root@CentOS4 tmp] # du-sb; df-I / / when checking directory capacity and disk size, we can find here
The data has changed.
36100151.
Filesystem Inodes IUsed IFree IUse% Mounted on
/ dev/sda1 917504 113526 803978 13% /
None 129323 1 129322 1 per dev/shm
[root@CentOS4 tmp] # vi test-hd / / use vi to modify the contents of the test-hd file here, and then check test,test-hd
, whether test-so has changed.
Hello everyone!
Hello baby!
"test-hd" 2L, 28C written
[root@CentOS4 tmp] # cat test
Hello everyone!
Hello baby!
[root@CentOS4 tmp] # cat test-so
Hello everyone!
Hello baby!
[root@CentOS4 tmp] # cat test-hd
Hello everyone!
Hello baby!
[root@CentOS4 tmp] #
The above is how to use commands to connect files in CentOS. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.