Home System Tutorial LINUX In-depth analysis of Linux directory structure: root directory, user directory, system configuration, etc.

In-depth analysis of Linux directory structure: root directory, user directory, system configuration, etc.

Jun 03, 2024 pm 09:11 PM

1. Linux directory structure

linux在目录中查找文件_linux搜索文件所在目录_linux搜索目录命令

2. Directory purpose

/Root directory

/rootroot administrator home directory

/boot stores Linux startup files

/etcStorage system and software configuration files

/usr User command program storage directory

/homeGeneral home owner directory

/mnt device/file system mount point

/bin stores the most commonly used operating commands

/optApplication software installation directory, such as database, etc.

/tmp temporary directorylinux searches the directory where the file is located, stores temporary files

/var variable information storage area (system logs, website files, etc.)

/proc virtual file systemThe directory where the Linux search file is located, including process information

/sbin system administrator command storage directory

/dev device file, (hard disk is more common)

/libThe most basic dynamic link shared library

Common files in/etc directory

/etc/sshSSH remote shell configuration directory

/etc/shadow, /etc/passwd user configuration file, user password configuration file

/etc/NetworkManager/Network configuration directory of the NetworkManager program of Unongxin UOS

/etc/group user group configuration file

/etc/servicesService and port information

Common files in/proc directory

/proc/cpuinfo file to view detailed information about the cpu

All file systems currently mounted in the /proc/mounts system

/proc/version The kernel version number currently running on the system

/proc/vmstat Statistics of the current system virtual memory.

Common files in/dev directory

/dev/sda represents the first hard drive

linux在目录中查找文件_linux搜索文件所在目录_linux搜索目录命令

/dev/sda1 represents the first partition of the first hard disk

/dev/sda2 represents the second partition of the first hard disk

/dev/sdb represents the first hard drive

/dev/cdrom represents the hard disk

/dev/zero is used for null character output

/dev/null is used to be input, similar to the trash can

3. Directory path

Pathname

Absolute path: Start with the root directory.

Relative path: Start with the current directory.

Current directory..Superior directory.

[Note] When accessing a file, the user must provide the path where the file is located.

Paths are divided into relative paths and absolute paths.

The absolute path refers to the path starting from the "root" linux system tutorial, also known as the full path;

The relative path is the path starting from the user's working directory.

It should be noted that there is only one absolute path and one relative path to a certain file in the tree directory structure. The absolute path is deterministic and unchanged, while the relative path changes continuously as the user's working directory changes. When users want to access a file, they can refer to it by path name. And you can reference the file to be accessed based on its relative position to the user's working directory, without enumerating the full path name of the file.

Absolute path, relative path

➢Absolute path

Full path starting with /

[admin@linux]$cd/u01/app/oracle

[oracle@OEL64oracle]$pwd

/u01/app/oracle

➢Relative path

Does not start with /, only relative to the current working directory

[oracle@OEL64oracle]$cd/u01/app

[oracle@OEL64app]$cd./oracle

[oracle@OEL64oracle]$pwd

/u01/app/oracle

..Indicates the upper-level directory of the current directory, that is, the parent directory

[root@OEL64tmp]#cd/u01/app/oracle

[root@OEL64oracle]#pwd

/u01/app/oracle

[root@OEL64oracle]#cd..

[root@OEL64app]#pwd

/u01/app

.Indicates the current directory

[root@OEL64app]#pwd

/u01/app

[root@OEL64app]#cd./oracle

[root@OEL64oracle]#pwd

/u01/app/oracle

4. File name

File case resolution

Files starting with "." are implicit files

File name can be up to 255 characters (all characters are valid except forward slashes)

[oracle@OEL64~]$ls-al

total152

drwx------.26oracleoinstall4096Sep1915:59.

drwxr-xr-x.6rootroot4096Jun272013..

-rw-r--r--.1oracleoinstall685Sep1817:35.bash_profile

5. Basic directory file type-flag

File type representative characters:

Normal file-

Directory file d

Linked file l

Block device file b

Character device c

6. Directory file type-color

File type color:

Normal file--------------------Black

Directory file--------------------Black

linux搜索目录命令_linux搜索文件所在目录_linux在目录中查找文件

Symbolic link file--------------black

Device File--------------------Black

Executable file-----------------green-red

Picture file--------------------Pink green

Compressed file---------------------black

7. Common commands

Basic command: lspwd

Directory operation command: cdmkdirrmdirrmcpmv

File operation command: lessmorelessnanocattouchfile

Basic command: ls

ls command is used to display the target list, which is a highly used command in Linux.

The output information of the ls command can be displayed with color highlighting to partition different types of files.

Sentence pattern

ls(options)(parameters)

usage:

ls only lists visible files in the current directory

ls-l lists detailed information about files visible in the current directory

ls-hl lists detailed information and displays file size in readable size

ls-al lists detailed information of all files (including hidden)

Basic commands: pwd, cd

pwd displays the current path

$cd/u01/app/oracle

$pwd

/u01/app/oracle

cd changes the current working directory

$pwd

/u01/app/oracle

$cd/etc

$pwd

/etc

linux在目录中查找文件_linux搜索文件所在目录_linux搜索目录命令

Create and delete directory commands: mkdirrmdir

mkdir creates new directory

rmdir delete empty directory

Delete command: rm

rm delete files and directories

Note: Be careful when using the rm command. Because once a file is deleted, it is difficult to recover it.

For example: rm-rf/

Sentence pattern

rm(option)(parameter)

Options

-d: Delete the directory;

-f: Forcefully delete files or directories;

-i: Ask the user before deleting existing files or directories;

-r or -R: Recursive processing, processing all files and subdirectories in the specified directory together;

-v: Display the detailed execution process of the command.

Common usage:

rm-rf does not ask, delete all files under directory a

Copy command: cp

The cp command is used to copy one or more source files or directories to the specified destination file or directory.

Sentence pattern

cp(option)(parameter)

Options

-f: Forcefully copy files or directories, regardless of whether the target file or directory already exists;

-i: Ask the user before overwriting existing files

-R/r: Recursive processing, processing all files and subdirectories in the specified directory together;

-v: Display the operations performed by the command in detail.

Common usage:

cp-rf/a/b

or

cp-r-f/a/b

Commands: mv, touch, file

linux在目录中查找文件_linux搜索目录命令_linux搜索文件所在目录

mv Unicom or rename file

#mv/tmp/b.txt/home/oracle/.

#cd/home/oracle

#ls-alb.txt

-rw-r--r--.1rootroot0Sep2216:30b.txt

touch creates an empty file

#cd/tmp

#touchc.txt

#ls-alc.txt

-rw-r--r--.1rootroot0Sep2216:36c.txt

file detection file type

#filec.txt

c.txt:ASCIItext

Text display command: catlessmore

cat displays file content

#cat/tmp/alert.log

less displays the file content line by line. The function of the less command is very similar to that of more. Both can be used to browse the contents of text files. The difference is that the less command allows the user to browse the file forward or backward, while the more command can only browse the file forward. Browse before.

When using the less command to display a file, use the PageUp key to page down and the PageDown key to page up. To exit the less program, press the Q key.

#less/tmp/alert.log

moreDisplay file content screen by screen

#more/tmp/alert.log

Text editing command: nano

nano is a character terminal text editor. It is much simpler than vi/vim and is more suitable for Linux beginners. (You can use the nano editor in the early stage, and you must be able to use vi in ​​the middle and later stages, which is more common in Linux text control)

Sentence pattern:

nano file name

control:

Use Ctrl+O to save changes

Press Ctrl+X to exit

If you change the file, you will be asked if you need to save the changes. Enter Y to confirm saving, enter N not to save, and press Ctrl+C to cancel and return. If you enter Y Chinese linux operating system, the next step will ask you to enter the file name you want to save. If you do not need to change the file name, just press Enter; if you want to save it under another name (that is, save as), enter the new name and confirm. At this time, you can also use Ctrl+C to cancel the return.

ln: Shortcut method to create a directory or file

Construct a symbolic link file abc in the directory /usr/liu so that it points to the directory /usr/mengqc/mub1

ln-s/usr/mengqc/mub1/usr/liu/abc

The above is the detailed content of In-depth analysis of Linux directory structure: root directory, user directory, system configuration, etc.. 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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Mastering Text Manipulation With the Sed Command Mastering Text Manipulation With the Sed Command Mar 16, 2025 am 09:48 AM

The Linux command line interface provides a wealth of text processing tools, one of the most powerful tools is the sed command. sed is the abbreviation of Stream EDitor, a multi-functional tool that allows complex processing of text files and streams. What is Sed? sed is a non-interactive text editor that operates on pipeline inputs or text files. By providing directives, you can let it modify and process text in a file or stream. The most common use cases of sed include selecting text, replacing text, modifying original files, adding lines to text, or removing lines from text. It can be used from the command line in Bash and other command line shells. Sed command syntax sed

How To Count Files And Directories In Linux: A Beginner's Guide How To Count Files And Directories In Linux: A Beginner's Guide Mar 19, 2025 am 10:48 AM

Efficiently Counting Files and Folders in Linux: A Comprehensive Guide Knowing how to quickly count files and directories in Linux is crucial for system administrators and anyone managing large datasets. This guide demonstrates using simple command-l

How To Add A User To Multiple Groups In Linux How To Add A User To Multiple Groups In Linux Mar 18, 2025 am 11:44 AM

Efficiently managing user accounts and group memberships is crucial for Linux/Unix system administration. This ensures proper resource and data access control. This tutorial details how to add a user to multiple groups in Linux and Unix systems. We

How To List Or Check All Installed Linux Kernels From Commandline How To List Or Check All Installed Linux Kernels From Commandline Mar 23, 2025 am 10:43 AM

Linux Kernel is the core component of a GNU/Linux operating system. Developed by Linus Torvalds in 1991, it is a free, open-source, monolithic, modular, and multitasking Unix-like kernel. In Linux, it is possible to install multiple kernels on a sing

How To Type Indian Rupee Symbol In Ubuntu Linux How To Type Indian Rupee Symbol In Ubuntu Linux Mar 22, 2025 am 10:39 AM

This brief guide explains how to type Indian Rupee symbol in Linux operating systems. The other day, I wanted to type "Indian Rupee Symbol (₹)" in a word document. My keyboard has a rupee symbol on it, but I don't know how to type it. After

What is the Linux best used for? What is the Linux best used for? Apr 03, 2025 am 12:11 AM

Linux is best used as server management, embedded systems and desktop environments. 1) In server management, Linux is used to host websites, databases, and applications, providing stability and reliability. 2) In embedded systems, Linux is widely used in smart home and automotive electronic systems because of its flexibility and stability. 3) In the desktop environment, Linux provides rich applications and efficient performance.

How To Easily Configure Flatpak Apps Permissions With Flatseal How To Easily Configure Flatpak Apps Permissions With Flatseal Mar 22, 2025 am 09:21 AM

Flatpak application permission management tool: Flatseal User Guide Flatpak is a tool designed to simplify Linux software distribution and use. It safely encapsulates applications in a virtual sandbox, allowing users to run applications without root permissions without affecting system security. Because Flatpak applications are located in this sandbox environment, they must request permissions to access other parts of the operating system, hardware devices (such as Bluetooth, network, etc.) and sockets (such as pulseaudio, ssh-auth, cups, etc.). This guide will guide you on how to easily configure Flatpak with Flatseal on Linux

Linux Kernel 6.14 RC6 Released Linux Kernel 6.14 RC6 Released Mar 24, 2025 am 10:21 AM

Linus Torvalds has released Linux Kernel 6.14 Release Candidate 6 (RC6), reporting no significant issues and keeping the release on track. The most notable change in this update addresses an AMD microcode signing issue, while the rest of the updates

See all articles