Table of Contents
Memory usage
Partial directory description
/bin
/boot
/etc
/lib
/lost found
/media
/mnt
/opt
cd
rm
 head/tail
find
Home Operation and Maintenance Linux Operation and Maintenance Linux study notes file system (organized and shared)

Linux study notes file system (organized and shared)

Feb 07, 2022 pm 05:45 PM
linux

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.

Linux study notes file system (organized and shared)

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
Copy after login
  • /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
  • /usr
  • 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
  • /usr/bin
  • System Applications used by users
  • /usr/sbin
  • Relatively advanced management programs and system daemons used by super users
  • /usr/src
  • Default placement directory for kernel source code
  • /var
  • This directory stores ever-expanding things. It is customary to place directories that are frequently modified in this directory, including various log files
  • /run
  • 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.
File operations

    ll

File attributes:

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"

  • 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

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

##mvMove commandmv 123 /var/ftp/pubMove the file named 123 to pub Under the directory mv 123 /var/ftp/pub/456Move the file named 123 to pub directory and rename it to 456mv /var/ftp/pub /homeMove the pub directory Go to the home directory##mv 123 456Rename 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

##touchCreate filetouch 123Create a file named 123touch a b cCreate multiple files
    stat

Inode: File identifier

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

  • ln

##ln##ln -s yyy syyyln yyy hyyy
Link (shortcut)
Create a link to yyy ( Soft link) syyy, and then use cat syyy to view the content in yyy
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文件的内容(监控文件名,当文件删除后,监控会暂停,再次创建同名文件时,监控会继续)

移除yyy后

tail -F yyy停止
Copy after login

因为还有一个hyyy指向和yyy一样的Inode,所以

tail -f yyy还在继续监控
Copy after login

 移除hyyy后

tail -f yyy停止监控
Copy after login

 再次创建yyy后,并向yyy中追加“hello”

tail -F yyy追加hello
Copy after login

tail -f yyy没有反应
Copy after login

 再次向yyy中追加数据

ping www.baidu.com >> yyy//将ping的内容追加到yyy文件中
Copy after login
tail -F yyy继续追加新的信息
Copy after login

  • find

find / -name yyy 全局搜索yyy文件的位置
find /ect -name yyy 在etc目录及子目录查找yyy文件
find /etc -name a*a

在etc目录及子目录查找a开头a结尾的文件

相关推荐:《Linux视频教程

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1263
29
C# Tutorial
1236
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

vscode Previous Next Shortcut Key vscode Previous Next Shortcut Key Apr 15, 2025 pm 10:51 PM

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

See all articles