m0_ sixty-four million eight hundred and sixty-seven thousand o 2022-01-26 18:29:33 阅读数:502
/lost+found: This directory is usually empty , When the system is shut down illegally , Here are some files .
/media:linux The system will automatically identify some devices , for example U disc 、 Optical drive and so on , When identified ,linux Will mount the identified device to this directory .
/mnt: The system provides this directory for users to temporarily mount other file systems , We can mount the CD-ROM drive on /mnt/ On , Then enter the directory and you can view the contents of the CD-ROM drive .
/opt: This is the directory where the additional software is installed for the host . For example, you install a ORACLE The database can be placed in this directory . The default is empty .
/proc: This directory is a virtual directory , It's a mapping of system memory , We can get system information by directly accessing this directory . The contents of this directory are not on the hard disk but in memory , We can also modify some files directly , For example, you can use the following command to shield the host ping command , Make it impossible for others to ping Your machine :
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
/root: This directory is for system administrator , Also known as the user's home directory for super users .
/sbin:s Namely Super User It means , Here is the system management program used by the system administrator .
/selinux: This directory is Redhat/CentOS Unique directory ,Selinux It's a security mechanism , Be similar to windows The firewall of , But this mechanism is more complicated , This directory is for storing selinux Related documents .
/srv: This directory stores some data that needs to be extracted after the service is started .
/sys: This is a linux2.6 A big change in the kernel . This directory has 2.6 A new file system in the kernel sysfs .sysfs The file system integrates the following 3 File system information : For process information proc file system 、 For equipment devfs File system and for pseudo terminal devpts file system .
/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 in this directory , Be similar to windows Under the program files Catalog .
/usr/bin: Applications used by system users .
/usr/sbin: Super users use more advanced hypervisors and system daemons .
/usr/src: The default placement directory for kernel source code .
/var: There is something expanding in this catalog , We are used to putting the frequently modified directories in this directory . Including various log files .
/run: It's a temporary file system , Information since the storage system started . When the system restarts , The files in this directory should be deleted or erased . If you have /var/run Catalog , It should point to run.
stay Linux In the system , There are several directories that are more important , Usually, you need to be careful not to delete or change internal files by mistake :
/etc: It's also mentioned above , This is the configuration file in the system , If you change a file in this directory, the system may fail to start .
/bin, /sbin, /usr/bin, /usr/sbin: This is the system's default location directory for execution files , such as ls Is in the /bin/ls In the catalog .
It is worth mentioning that ,/bin, /usr/bin Is an instruction for system users ( except root External users ), and /sbin, /usr/sbin It's for root Instructions used .
/var: This is a very important
《 A big factory Java Analysis of interview questions + Back end development learning notes + The latest architecture explanation video + Practical project source code handout 》
【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 Full content open source sharing
Catalog , There are a lot of programs running on the system , Then every program will have corresponding log generation , And these logs are recorded in this directory , Specific in /var/log Under the table of contents , in addition mail The pre-set placement is also here .
ubuntu16 The version's menu bar is at the top , You have to move the mouse to the top bar to display
① Study Linux The reason for the order
Because the development process can only pass through long-range Connect to server , Operate on the server , It has no graphical interface , All deployment and maintenance work must rely on Linux command ; And back-end programmers also need to master some more or less Linux command
② Terminal tips
Enlarge the font Ctrl + Shift + =
Reduce the font size Ctrl + -
Automatic completion Knock out file name 、 After the first few letters of the directory name or command , Press down Tab key
1. If you enter the first letter , There is no ambiguity , The system will automatically complete
2. If you enter the first letter , Corresponding to multiple results , Then click on the Tab key , The system will prompt multiple existing results
History commands Press On / Next The direction key can switch between the commands that have been knocked
If you want to exit the selection and do not want to execute the current command , Press Ctrl+c
③Linux Basic commands
Serial number command Corresponding to English effect
01 ls list View the contents of the current folder
02 pwd print working directory View the current folder
03 cd [ Directory name ] change directory Switch folders
04 touch [ file name ] touch If the file doesn't exist , New file
05 mkdir [ Directory name ] make directory Create directory
06 rm [ file name ] remove Delete the specified file name
07 clear clear Clear the screen
④ Command format
command [-option] [parameter]
command [ Options ] [ Parameters ]
[ ] Optional content in
⑤ Check the help information of the terminal command
1. Baidu search
2. Command name --help Review the command Command help information
3.man Command name Review the command Command help information ,man yes manual: manual
man Show more details , Use man Look up the help information of the command and use the operation keys
Operation key function
Space bar Display the next screen of the manual page
Enter key Scroll one line of the man page at a time
b(back) Roll back one screen
f(forward) Roll one screen forward
q(quit) sign out
/word Search for “word” character string
⑥Linux Detailed command
1、ls command
linux In the system . The beginning is a hidden file , When displayed separately ,. Represents the current directory ,… On behalf of the parent directory
Options meaning
-a Displays all subdirectories and files in the specified directory , Including hidden files
-l Show the details of the file as a list
-h Only cooperate with -l It works , Display the file size in a popular way
Extra mastery :
Linux Use... Under the system ls The command will find that the displayed files or directories have different colors , By default, the system sets different colors for different file types .
The light blue : Represents a linked file ;
gray : Represents other files ;
green : Represents an executable file ;
Red : Represents a compressed file ;
Blue : Presentation directory ;
Flashing red : Indicates that there is a problem with the linked file ;
yellow : Represents a device file , Include block,char,fifo.
use "dircolors -p" Command to see the default color settings , Including all kinds of colors and " bold ", Underline , Flicker, etc .
2、cd command
Options meaning
cd Switch to the current user's home directory (home/ The user directory )
cd ~ Switch to the current user's home directory (home/ The user directory )
cd . Continue in the current directory
cd … Switch to the parent directory
cd - You can switch between the last two working directories
Absolute path : From Root directory or current working directory ~ Start , for example /home/xxxx,~/Desktop/xxx
Relative paths : be relative to Current directory Start , for example ./,…/
3、touch command
If the file doesn't exist , You can create a new file
If the file already exists , You can modify the last modification date and time of the file
It can be used in this way :touch xxx/yyy/zzz.txt
4、mkdir command
Create a new directory
Options meaning
-p You can create multi-level directories directly
for example :mkdir -p aaa/bbb/ccc/ddd
Be careful : New catalog name Cannot be associated with Existing directory or file The same name
for example : The file named 123, You can't build a 123 The directory name of , If the file name is 123.txt, It has no effect
5、rm command
Be careful :rm The command will directly delete , No prompt
Options meaning
-f Force deletion , There's no hint , Including the file does not exist
-r Delete the folder and all contents under it
6、 Copy and move files
Serial number command Corresponding to English effect
01 tree [ Directory name ] tree List the file directory structure in a tree view
02 cp Source file Target file copy Copy files or directories
03 mv Source file Target file move Move files or directories / File or directory renaming
tree: List the file directory structure in a tree view
Options meaning
-d Show only directories
If not installed tree, Then input. sudo apt install tree Installation
Direct input tree The tree view of the current directory is listed
Input tree Directory name , Then the tree view under this directory will be listed
cp command
Options meaning
-i Prompt before overriding the file
-r If the given source file is a directory , be cp Copy all subdirectories and files under this directory , The destination must be a directory name
When copying a directory , If the destination directory exists , Then put the source directory under the target directory , If the target directory does not exist , Then rename the source directory to the name of the target directory
Be careful : It's best to add -i In case of accidents
mv command
Options meaning
-i Prompt before overriding the file
mv You can rename files and directories
Be careful : It's best to add -i In case of accidents
7、 View file contents
Serial number command Corresponding to English effect
01 cat file name concatenate View file contents 、 create a file 、 File merge 、 Tracing file content and other functions
02 more file name more Display the contents of the document in separate screens
03 grep Search text file name grep Search for text file content
cat command
cat All the contents of the file will be displayed at once , Suitable for viewing Less content Text file for
Options meaning
-b For non empty output line number
-n Number all lines of output
Add :Linux One more nl And cat -b equivalent
more command
more The contents of the file will be displayed in separate screens , Only one page at a time , Therefore, it is suitable to view More content text file
Operation key function
Space bar Display the next screen of the manual page
Enter key Scroll one line of the man page at a time
b(back) Roll back one screen
f(forward) Roll one screen forward ( test Ubuntu Skipping will occur xx That's ok )
q(quit) sign out
/word Search for “word” character string ( test Ubuntu Can only search down )
grep command
Linux In the system grep Command is a powerful text search tool
grep Allows pattern lookup of text files , Regular expressions
Add : When searching for strings with spaces in the middle, you have to enclose them in quotation marks
Options meaning
-n Identify the line number before the line that matches the style
-v Display does not contain matching text of all lines ( It's like asking for the opposite )
-i Ignore case
Two common search modes
copyright:author[m0_ sixty-four million eight hundred and sixty-seven thousand o],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201261829304352.html