Linux common commands and operations

is a system management program used by system administrators.

/selinux:

This directory is unique to Redhat/CentOS. Selinux is a security mechanism, similar to the Windows firewall.

But this mechanism is more complicated, this directory is to store selinux-related files.

/srv:

This directory stores some data that needs to be extracted after the service is started.

/sys:

This is a big change in the Linux2.6 kernel. A new file system sysfs in the 2.6 kernel is installed in this directory.

The sysfs file system integrates the information of the following three file systems: proc file system for process information, devfs file system for devices

filesystem and the devpts filesystem for pseudo-terminals.

The file system is a visual reflection of the kernel device tree.

When a kernel object is created, corresponding files and directories are also created in the kernel object subsystem.

/tmp:

tmp is an abbreviation of temporary (temporary). This directory is used to store some temporary files.

/usr:

usr is the abbreviation of unix shared resources (shared resources), this is a very important directory, many applications of users

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 hypervisors and system daemons used by superusers.

/usr/src:

The directory where the kernel source code is placed by default.

/was:

View the location of the current command pwd

switch path

cd … go back to the previous level

cd / back to the root directory

cd ~ returns to the user directory

If you are a root user, cd ~ is equivalent to cd /root

If it is a normal user, cd ~ is equivalent to cd /home/current user name

cd folder switch directory

View the files in the directory

ls displays the names of folders or files under the current folder without line breaks

ll Newline displays the names of folders or files under the current folder, as well as detailed information about these folders or files

ls -al -a is to display hidden files -l is to display in a more detailed list (list all)

ll -h wrap the file and display its size (with units)

install lrzsz

02. Daily operation order

ping View network status

ifconfig view network configuration

ip addr view network configuration

clear clears the console

03. User operation command

su switch users (root needs to enter a password)

exit log out

04. Directory operation

dir View the folders in the current directory

mkdir creates a folder

rmdir delete folder

05. File operation

touch to create a file

cat view file content

var is the abbreviation of variable (variable). This directory stores things that are constantly expanding. We are used to storing those objects that are often modified

recorded in this directory. Includes various log files.

/run:

It is a temporary file system that stores information since the system was started. When the system restarts, the files in this directory should be deleted or cleared. if

You have the /var/run directory on your system, which should point to run.

Two, common commands


1. Switch path

cd ... go back to the previous level

cd / back to the root directory

cd ~ returns to the user directory

If you are a root user, cd ~ is equivalent to cd /root

If it is a normal user, cd ~ is equivalent to cd /home/current user name

cd folder switch directory

2. View the files in the directory

ls displays the names of folders or files under the current folder without line breaks

ll Newline displays the names of folders or files under the current folder, as well as detailed information about these folders or files

ls -al -a is to display hidden files -l is to display in a more detailed list (list all)

ll -h wraps the file and displays its size (with units)

3. Daily operation commands

ping view network status

ifconfig view network configuration

ip addr view network configuration

clear clears the console

4. Directory operation

dir View the folders in the current directory

mkdir create folder

rmdir delete folder

5. File operation

touch to create a file

echo content > file : add content in the file

cat view file content

Var is the abbreviation of variable (variable). This directory stores things that are constantly expanding. We are used to putting those frequently modified directories in this directory. Includes various log files.

If you continue to perform the above operation, the original content will replaced :

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-6c93vK0K-1651976904592) (https://img-blog.csdnim "Analysis of Java Interview Questions for First-line Manufacturers + Post End-to-end development study notes + latest architecture explanation video + practical project source code handouts "Free open source prestige search public account [programming advanced road] g.cn/8a3c7424749848639cd2d7babcc668ff.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETikBA5pa5pa54ix5 ,size_17,color_FFFFFF,t_70,g_se,x_16)]

If there are two greater than signs , it is to continue editing the file in the file content

/run

It is a temporary file system that stores information since the system was started. When the system restarts, the files in this directory should be deleted or cleared. If you have a /var/run directory on your system, it should point to run.

rm delete files: will ask you to confirm whether to delete

rm -f file : delete the file directly without asking you for confirmation

6. Complicated file operations

**mv move files, **you can modify the name at the same time

**cp copy files

rm -r file:**recursively delete

rm -rf file : delete directly (preferably not used)

**cp copy files

rm -r file:**recursively delete

rm -rf file : delete directly (preferably not used)

Guess you like

Origin blog.csdn.net/AK774S/article/details/124644607