


This article brings you relevant knowledge about the file system in Linux, including some directory descriptions and related issues about file operations. I hope it will be helpful to you.
Memory usage
Partial directory description
-
/bin
- bin is the abbreviation of Binary. This directory stores the most commonly used commands
-
/boot
- Stores some core files used when starting Linux, including some connection files and image files
-
/etc
- is used to store All configuration files and subdirectories required by the system administrator
-
/lib
- store the most basic dynamic link shared libraries of the system. The function is similar to the DLL file in Windows. Almost all applications require these shared libraries.
-
/lost found
- Normally it is empty. When the system is shut down illegally, some files are stored here
-
/media
- The Linux system will automatically recognize some devices, such as U disks, CD-ROM drives, etc. After recognition, Linux will mount the recognized devices. Go to this directory
-
/mnt
- The system provides this directory to allow users to temporarily mount other file systems. You can put the optical drive Mount it to /mnt/, and then enter the directory to view the contents of the optical drive
-
/opt
- This is for the host The directory where additional installed software is placed. For example, if you install an ORACLE database, you can put it in this directory. It is empty by default.
- ##/proc
- This directory is a virtual directory. It is a mapping of system memory. You can obtain the system memory by directly accessing this directory. information.
- The contents of this directory are not on the hard disk but in the memory. Some files in it can be modified directly.
- For example, you can use the following command to block the ping command of the host 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 of the system administrator, also known as the super privileged person
- /sbin
- s means Super user. The system management program used by the system administrator is stored here.
- /srv
- This directory stores Some data that need to be extracted after starting some services
##/sys -
This is a big change in the linux2.6 kernel. In this directory Installed sysfs, a new file system in the 2.6 kernel.
- The sysfs file system integrates the information of the following three file systems, the proc file system for process information, the devfs file system for devices, and the 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
-
This is a very important directory for users Many applications and files are placed in this directory, similar to the program files directory under Windows
-
System Applications used by users
-
Relatively advanced management programs and system daemons used by super users
-
Default placement directory for kernel source code
-
This directory stores ever-expanding things. It is customary to place directories that are frequently modified in this directory, including various log files
-
is a temporary file system that stores information other than system startup. When the system restarts, the files in this directory should be deleted or cleared.
- ll
Linux files are basically divided into 3 attributes: readable (r), writable (w), executable (x) . The sorting order of permission positions is (taking -rw-r--r-- as an example): -rw (user)-r (user group in the same group)--r (other users)--
User can read and write, users in the same group can read, and other users can read
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
The group it belongs to:Each owner can have more than one group, but most users should only belong to the same group group, only when the system administrator wants to give the user special permissions, he may give him another group File size:File size is expressed in bytes. Empty directories are generally 1024byte Creation date:In the format of "month, day and time" Links: Link to Inode Access: The last time the file contents were viewed Modify: The time when the file content was last modified Change: The time when the file permissions or other file attributes were last modified Use stat to make the above three times consistent again 移除yyy后 因为还有一个hyyy指向和yyy一样的Inode,所以 移除hyyy后 再次创建yyy后,并向yyy中追加“hello” 再次向yyy中追加数据 在etc目录及子目录查找a开头a结尾的文件 相关推荐:《Linux视频教程》cd
##cd
Change directory command
cd /
Return to the root directory
cd /home
Switch to the home directory
cd ..
Return to the upper level directory '.' indicates the current directory
cd /var/ftp/pub
Switch to the pub directory at one time
cd /root
Switch to the root user directory (Note: the root user directory is displayed as "~")
Directory operations are available Use absolute paths (starting from the root directory) or relative paths (starting from the current directory). In order to change directories quickly and accurately, directory operations should be good at using the TAB key to automatically complete directory names
cp
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 and rename it to 456
cp -r /var/ftp/pub /home
Copy the pub directory to the home directory
##mv
Move command
mv 123 /var/ftp/pub
Move the file named 123 to pub Under the directory
mv 123 /var/ftp/pub/456
Move the file named 123 to pub directory and rename it to 456
mv /var/ftp/pub /home ##mv 123 456Move the pub directory Go to the home directory
Rename file 123 in the current directory to 456 rm
##rm
Delete Command
rm 123
Delete the file named 123 in the directory (the file exists), you need to press y to confirm
rm -f 123
Delete the file, force deletion, no confirmation required
rm -r abc
Delete the directory named abc under the directory (the directory exists), you need to press y to confirm
rm -fr abc
Forcibly delete the directory without confirmation
rm -f a*
#Forcibly delete all files starting with a in the directory, no confirmation is required
##touch
Create file
touch 123 Create a file named 123
touch a b c
Create multiple files
stat
Inode: File identifier
##ln
Link (shortcut)
##ln -s yyy syyy
Create a link to yyy ( Soft link) syyy, and then use cat syyy to view the content in yyy
ln yyy hyyy
Create The link (hard link) of yyy is hyyy, and then use cat hyyy to view the content in yyy
cat/tac/less
##cat/less
View text content command
cat /etc/passwd
View the text file passwd Content, you can only view the last page, only suitable for viewing small text files within one screen
less /etc/passwd
You can use the up and down cursor keys and page up and down to scroll through the entire contents of the text file passwd. After viewing, press q to exit
tac
is similar to the cat command, except that the content is displayed from back to front
head/tail
head -3 yyy
显示yyy文件的前三行内容
tail -3 yyy
显示yyy文件的后三行内容
head -3 yyy | tail -1
显示yyy文件第三行的内容
tail -f yyy
监控yyy的内容(监控Inode,当文件删除后,监控就停止,再次创建同名文件时,不会继续监控)
tail -F yyy
监控yyy文件的内容(监控文件名,当文件删除后,监控会暂停,再次创建同名文件时,监控会继续)
tail -F yyy停止
tail -f yyy还在继续监控
tail -f yyy停止监控
tail -F yyy追加hello
tail -f yyy没有反应
ping www.baidu.com >> yyy//将ping的内容追加到yyy文件中
tail -F yyy继续追加新的信息
find
find / -name yyy
全局搜索yyy文件的位置
find /ect -name yyy
在etc目录及子目录查找yyy文件
find /etc -name a*a
The above is the detailed content of Linux study notes file system (organized and shared). For more information, please follow other related articles on the PHP Chinese website!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
