Introduction to Linux
Linux is a free and open-source operating system with many different versions, all of which use the Linux kernel. Linux can be installed on various computer hardware devices, such as phones, tablets, routers, and desktop computers.

Linux Overview
Linux was introduced in 1991 and was developed by Linus Torvalds, a student at the University of Helsinki in Finland, along with many enthusiasts who joined later.

Features of Linux
-
Multi-user
-
Multitasking
-
Rich networking capabilities
-
Reliable system security
-
Good portability
-
Standard compliance
-
Good user interface
-
Excellent speed performance
-
Open source

CentOS
Mainstream: Currently, the Linux operating system is mainly used in production environments, and the mainstream enterprise-level Linux systems are still RedHat or CentOS.
Free: RedHat and CentOS are not much different; CentOS is an enterprise-level Linux distribution based on the freely available source code provided by Red Hat Linux.
Easy to update: CentOS has a unique yum command that supports online upgrades, allowing for immediate system updates, unlike RedHat, which requires purchasing support services!

Linux Directory Structure
-
bin (binaries) stores binary executable files.
-
sbin (super user binaries) stores binary executable files that only root can access.
-
etc (etcetera) stores system configuration files.
-
usr (unix shared resources) stores shared system resources.
-
home stores user files’ root directory.
-
root super user directory.
-
dev (devices) used to store device files.
-
lib (library) stores shared libraries and kernel modules required for running programs in the file system.
-
mnt (mount) the mount point for temporarily mounted file systems by system administrators.
-
boot stores various files used during system boot.
-
tmp (temporary) used to store various temporary files.
-
var (variable) used to store files that need to change data at runtime.

Common Linux Commands
Command format: command -option argument
For example: ls -la /usr
ls: displays the list of files and directories (list)
Common options:
-l (long)-a (all) Note hidden files, special directories . and .. -t (time)

Classification of Linux Commands
Internal commands: part of the Shell parser
cd change directory (change directory)
pwd display current working directory (print working directory)
help help
External commands: file programs independent of the Shell parser
ls display list of files and directories (list)
mkdir create directory (make directory)
cp copy files or directories (copy)
View help documents:
Internal commands: help + command (help cd)
External commands: man + command (man ls)
Common commands for operating files or directories:
pwd display current working directory (print working directory)
touch create empty file
mkdir create directory (make directory) -p create parent directory if it does not exist (parents)
cp copy files or directories (copy) -r recursively copy files and subdirectories under the specified directory (recursive)
mv move files or directories, rename files or directories (move)
rm delete files (remove) -r delete all files in the directory (recursive) -f force delete files or directories (force)
rmdir delete empty directories (remove directory)
cat display text file content (catenate)
more, less paginate display text file content
head, tail view the beginning or end of the text
head -n 5 a.log view the first 5 lines of a.log
tail -F b.log follow the log file
Common commands:
wc count lines, words, characters in text (word count)
-m count characters in text
-w count words in text
-l count lines in text
find search for specified files in the file system
find /etc/ -name "aaa"
grep search for specified strings in specified text files
ln create link files (link) -s create symbolic links to source files instead of hard links (symbolic)
top display the processes consuming the most resources in the current system
ps display the instantaneous status of processes -e /-A display all processes, environment variables -f full format -a display all processes for all users (including other users) -u display processes in order of username and start time -x display processes without controlling terminal
kill kill a process
kill -9 pid
df display disk space usage of file systems
du display the total disk space used by specified files (directories)
-h display file sizes in K, M, G (human-readable)
-s only display the total size of each file (summarize)
free display current memory and swap space usage
netstat display network status information -a display all connections and listening ports -t (tcp) only display tcp-related options -u (udp) only display udp-related options -n refuse to display aliases, display all conversions to numbers.
-p display the name of the program that establishes the relevant link
ifconfig detailed network configuration of network card
ping test network connectivity
Backup and compression commands:
gzip compress (decompress) files or directories, compressed file suffix is gz
bzip2 compress (decompress) files or directories, compressed file suffix is bz2
tar package (unpackage) files and directories
gzip command:
Command format: gzip [options] file name to compress (decompress)
-d decompress the compressed file
-l display the size of the compressed file, the size of the uncompressed file, and the compression ratio (list)
-v display file name and compression ratio (verbose)
-num adjust the speed of compression with specified number num, -1 or --fast indicates the fastest compression method (low compression ratio), -9 or --best indicates the slowest compression method (high compression ratio). The system default is 6
bzip2 command:
Command format: bzip2 [-cdz] document name -c output the data generated during the compression process to the screen
-d decompress parameter (decompress)
-z compression parameter (compress)
-num adjust the speed of compression with specified number num, -1 or --fast indicates the fastest compression method (low compression ratio), -9 or --best indicates the slowest compression method (high compression ratio). The system default is 6
tar command:
-c create a compressed file parameter instruction (create)
-x extract a compressed file parameter instruction (extract)
-z whether to use gzip for compression
-j whether to use bzip2 for compression
-v display files during compression (verbose)
-f use file name, immediately after f should be the file name (file)
Shutdown/reboot commands:
shutdown system shutdown
-r immediately reboot after shutdown
-h shut down without restarting
halt shut down and power off
shutdown -h reboot restart
shutdown -r
Good habits for learning Linux:
-
Be good at checking man pages (manual) and other help documents
-
Utilize the Tab key well
-
Master some shortcut keys
ctrl + c (stop current process)
ctrl + r (view command history)
ctrl + l (clear screen, same effect as clear command)

The best time was 10 years ago
The second best time is now
Learning is the same

Source: Internet. Please delete if infringed.