This is the sixth day of my participation in the More text Challenge. For details, see more text Challenge
First, basic introduction
Version 1.
- The server
- RedHat
- Centos: a free version of RedHat with fewer system management tools than RedHat
- RedHat 7 —— centos 7
- Suse
- openSuse
- Suse Enterprise
- RedHat
- Personal PC
- Ubantu
2. Linux directory structure
/root directory /bin Linux commands are also called shell /boot driver-related /dev device Device-related /home Stores user information /usr user resource Stores the software installed by the user /root root Super administrator folderCopy the code
3. “Line breaks”
- Replace Windows newline with Linux newline in shell scripts under Linux:
sed -i 's/\r//' filename
- The default value is in window
\r\n
- Under Linux is
\n
- Unix is
\r
4. Three installation modes
- RPM tool: RPM -ivh [RPM complete package name] This tool is similar to the Offline installation package EXE in Windows
- Yum install -y [Package name for short] The python tool operates RPM packages
- The source code package:./confifure –> make –> make install (.Needs to be compiled into an executable file)
Linux and Unix
- Unix commercial cores are not exposed to hardware and cannot be installed on X86 and PERSONAL computers
- Linux free source code open free use of hardware requirements are relatively low
- Centos is a free version of redhat recompiled and fixed, using the same source code
- Redhat is a paid commercial version; Centos Free Trial
3. Common commands
Viewing the Kernel Version
cat /proc/version
uname -a
Check the memory
Free -m Displays the memory usage in MB
Check the hard disk
df -hl
Viewing Resource Consumption
top
- M sorted by memory usage
Viewing Resource Information
cat /proc/cpuinfo
cat /proc/meminfo
df -h
Hard link, soft link
Java hello hard link ln -s hello. Java Hello soft link
To find the command
- The which directive looks for files that match the criteria in the directory set by the environment variable $PATH.
- File search
find / -name xxx*
Find all files starting with XXX from/and directory by filenamefind / -size 8k
Find files by size
- File content search
grep "aa" xx.txt
Specify file xx.txt to find the AA string
Compression and packing
- The compression
tar -czvf my.tar.gz /etc
- -z Calls the gzip command to compress
- -C Packaging is common
- -v Displays the processing process
- -f Specifies the file name
- packaging
tar -xvzf my.tar.gz
tar -xvzf my.tar.gz -C /tmp
- -x: unpack;
- -f: specifies the file name of the compressed package.
- -v: displays the file packaging process.
- -t: test, which is to check what files are in the package without packaging.
- -c directory: specifies the unpacking location.