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)05/31 Report--
This article mainly explains "what are the directories and operations of Linux file system". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and study and learn "what are the directories and operations of Linux file system" together!
memory usage
Part of the catalog description/bin
bin is short for Binary, and this directory holds the most frequently used commands.
/boot
Storage is used when booting Linux core files, including some connection files and image files
/etc
Used to store all configuration files and subdirectories required by system administrators
/lib
Store the system's most basic dynamic connection shared library, its role is similar to the DLL file in windows. Almost all applications require these shared libraries.
/lost+found
Generally empty, when the system is illegally shut down, some files are stored here.
/media
Linux system will automatically identify some devices, such as U disk, optical drive, etc., when identified, Linux will mount the identified devices to this directory.
/mnt
The system provides this directory to allow users to temporarily mount other file systems. You can mount the optical drive to/mnt/, and then enter this directory to view the contents of the optical drive.
/opt
This is the directory where additional software is installed for the host. For example, if you install an ORACLE database, you can put it in this directory. The default is empty.
/proc
This directory is a virtual directory that is a mapping of system memory and can be accessed directly to obtain system information.
The contents of this directory are not on the hard disk but in memory, and some files can be modified directly.
For example, you can block the ping command of the host by the following command, so that others cannot ping your machine.
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all/root
This directory is the user home directory for system administrators, also known as super-privileged
/sbin
s is the meaning of Super User, where the system administrator is stored in the system management program used by the administrator.
/srv
This directory stores data that needs to be extracted after some services are started
/sys
This is a big change from linux 2.6 kernel, and it houses sysfs, a file system that was new in linux 2.6 kernel.
The sysfs file system integrates information from three file systems: proc file system for process information, devfs file system for devices, and devpts file system for pseudo-terminals. The file system is a visual reflection of the kernel device tree.
When a kernel object is created, the corresponding files and directories are also created in the kernel object subsystem
/tmp
This directory is used to store some temporary files
/usr
This is a very important directory, many of the user's applications and files are placed in this directory, similar to the program files directory under windows
/usr/bin
Applications used by system users
/usr/sbin
More advanced management programs and system daemons used by superusers
/usr/src
Default directory for kernel source code
/var
This directory stores things that are constantly expanding. It is customary to put directories that are frequently modified in this directory, including various log files.
/run
A temporary file system that stores information other than system startup. Files in this directory should be deleted or cleared when the system restarts.
file operation ll
File attributes: Linux files are basically divided into three attributes: readable (r), writable (w), executable (x). The sorting order of permission positions is (take-rw-r--r--as an example):
-rw (user)-r (group of users)--r (other users)--
Readable and writable by users, readable by group users, readable by other users
Number of files: if it is a file, the number of files is 1; if it is a directory, the number of files is the number of files in the directory
Groups: Each owner can have more than one group, but most users should belong to the same group, and only if the system administrator wants to give users special permissions may they be given another group
File size: file size in bytes, empty directory is generally 1024 bytes
Date Created: in Month, Day, Time format
cd cd Change directory command cd /Return to root cd /home Switch to home directory cd.. Go back to previous directory '. 'indicates that the current directory cd /var/ftp/pub switches to the pub directory cd /root switches to the root user directory at one time (note: the root user directory is displayed as "~")
Directory operations can use absolute paths (starting from the root directory) or relative paths (starting from the current directory). In order to be able to quickly and accurately change the directory, Directory operation should be good at using TAB key to automatically complete the directory name cpcp copy command cp 123 /var/ftp/pub copy the file named 123 to the pub directory cp 123 /var/ftp/pub/456 copy the file named 123 to the pub directory at the same time renamed 456cp -r /var/ftp/pub /home copy the pub directory to the home directory mvmv move command mv 123 /var/ftp/pub pub Move the file named 123 to the pub directory mv 123 /var/ftp/pub/456 Move the file named 123 to the pub directory and rename it mv /var/ftp/pub /home Move the pub directory to home mv 123 456
Renaming file 123 to 456 in the current directory
rmrm delete command rm123 delete the file named 123 under the directory (file exists), press y to confirm rm -f 123 delete the file, forcibly delete, do not need to confirm rm -r abc delete directory named abc under the directory (directory exists), press y to confirm rm -fr abc forcibly delete the directory, do not need to confirm rm -f a* forcibly delete all files starting with a under the directory, no need to confirm touchtouch create file touch 123 create file named 123 touch a b c create multiple files stat
Inode: File identifier
Links: Links to Inode
Access: The last time the file contents were viewed
Modify: the last time the file was modified
Change: The last time file permissions or other file attributes were modified
Stat can be used to reconcile these three times
lnln link (shortcut) ln -s yyy syyy Create a link to yyy (soft link) syyy, then use cat syyy to also view content in yyy ln yyy hyyy Create a link to yyy (hard link) hyyy, then use cat hyyy to also view content in yyy
cat/tac/lesscat/less view text content command cat /etc/passwd view text file passwd content, can only view the last page, only suitable for viewing small text files within one screen less /etc/passwd can use the up and down cursor keys and up and down pages to scroll through the text file passwd all content, after viewing, press q exit tac and cat command similar, only the content displayed is from back to front
head/tailhead -3 yyy Display the first three lines of yyy file tail -3 yyy Display the last three lines of yyy file head -3 yyy| tail -1 displays the contents of the third line of yyy file tail -f yyy monitors the contents of yyy (monitors Inode, stops monitoring after file deletion, and does not continue monitoring when file with the same name is created again) tail -F yyy monitors the contents of yyy file (monitors file name, stops monitoring after file deletion, and continues monitoring when file with the same name is created again)
After removing yyy
tail -F yyy Stop
Because there is also a hyyy pointing to the same Inode as yyy, so
tail -f yyy is still monitoring.
After removing hyyy
tail -f yyy Stop monitoring
Create yyy again and append "hello" to yyy
tail -F yyy Add hello
tail -f yyy No response
Add data to yyy again
ping www.baidu.com>> yyy//Add ping to yyy file tail -F yyy Continue adding new information
findfind / -name yyy Global search for yyy file location find /ect -name yyy Find yyy file in etc directory and subdirectories find /etc -name a*a
Find files beginning with a and ending with a in etc directory and subdirectories
Thank you for reading, the above is "Linux file system directory and operation what" content, after the study of this article, I believe that we have a deeper understanding of the Linux file system directory and operation what this problem, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
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.