Linux system introduction and file operation commands

The blog content is mostly collected from the Internet and summarized based on personal learning. If there is any infringement, please contact immediately and delete it immediately (〃'▽'〃)
It is not easy to organize, please ask for advice with an open mind, and welcome your guidance ( • ̀ω•́ )✧

Linux system introduction

What is an operating system?

Operating system is a computer program that manages computer hardware and software resources. The
most basic and important basic system software in modern computer systems. It
is the first layer of software configured on computer hardware and is the first expansion of hardware systems.
Mainstream operating systems:
Windows
Large user group, simple operation
Linux is
safe, stable, open source, mostly used for server
MacOS
security, suitable for developers
Common Linux versions:
RedHat, Centos, Ubuntu, Debian, SuSE, Mandrake, Caldera, Turbo, Gentoo, Linpus
insert image description here

Linux system installation

centos7 mirror
link: https://pan.baidu.com/s/1dKWEt45X2N7zxjqA_Mn04w?pwd=adef
Extraction code: adef

Linux directory structure

There is no concept of drive letter in Linux system, all files are under the root directory /

insert image description here
Absolute path : Starting from the root directory, fully expresses the path to the target file or directory.
For example: _/home/hyf/1.txt, indicates the relative path of 1.txt in the hyf directory under the home directory under the root directory : starting from the current directory, it completely indicates the path to the target file or directory. For example: ./hyf/1.txt, which means 1.txt in the hyf directory in the current directory

Common directory

insert image description here

/bin: basic program, which stores the most frequently used commands
/boot: stores the boot file when linux starts
/dev: device information
/etc: stores the configuration files required for system management
/home: ordinary user home directory
/lib: stores The most basic dynamic link shared library, similar to the dll file in windows.
/media: Some U disks, CD-ROMs and other devices recognized by the system are mounted to this directory
/mnt: The default temporary mount directory
/opt: This is the directory where additional software is installed for the host
/proc: Process information

Common operation commands

1. pwd command (display the current directory)
pwd: display the absolute path of the current directory
insert image description here

2. cd command (switch directory)
cd command: change the current working directory
"cd ~" //Enter the home directory, ~ represents the home directory, each user's home directory is different, the root user's home directory is /root, other users' home directory The home directory defaults to /home/username
"cd /" back to the root directory
"cd ..." back to the previous directory

3. ls command (list directory)
The ls command displays the contents of the specified working directory. If no parameters are provided, ls will run on the current directory.
Options and parameters:
-a: List all files and subdirectories in the specified directory (including hidden files starting with ".").
-l: Display detailed attribute information of a file or directory in long format.
ls -al: List hidden files using formatting

Fourth, touch command (create a new file)
touch command is used to create a new empty text file
Command format: touch file name

Five, mkdir (create a new directory)
mkdir command to create - a new directory
mkdir dir to create a directory dir
mkdir -p dir/dir1/dir2/dir3/dir4 to create a multi-level directory

6. cp (copy file or directory)
copy command cp
cp [option] source file target file
If it is a directory, it cannot be copied directly, you need to add the -r parameter.
Option function description
-r Copy the directory, realize the files and subdirectories in the source directory Copy the directory together into the target directory
-p : In addition to copying the contents of the file, also copy the modification time and access rights to the new file

Seven, mv (moving files and directories, or modifying the names of files and directories)
mv command is used to move or rename directories or files
mv [options] source file or directory target file or directory
-b: if you need to overwrite the file, overwrite Backup first;
-f : Force means, if the target file already exists, it will not be asked and overwritten directly

8. rm (delete a file or directory)
rm command: used to delete a file or directory
rm file
delete file file
rm -r dir
delete directory dir, and the following files are also deleted one by one
rm -f file
force delete file
rm -rf dir
forcibly deletes the directory
rm -i file
to prompt the user, which can be confirmed with the letter y, and other letters are denied

Guess you like

Origin blog.csdn.net/qq_53571321/article/details/123306599