Introduction to Linux Primer basics
1. Introduction of computer hardware composition
The computer is mainly composed of CPU (calculator, controller), memory, I/O, external storage and so on.
CPU is mainly used for binary data operation, it extracts data from memory, and then perform the corresponding operation. You cannot fetch data directly from the hard disk.
The memory pulls data out of the external storage for the CPU to be stored. The smallest unit of memory is the byte (byte)
Note: Since 32 has a maximum logical addressing capacity of 32 memory units. Therefore, the maximum memory space that the 32-bit CPU can access is: 4GB, the algorithm is as follows:
2^32=2^10*2^10*2^10*2^2
=1024*1024*1024*4bits
=1024*1024*4kbit
=1024*4mbit
=4gbit
32-bit CPUs can have 4Gbit variations, but because the smallest unit of memory is bytes, the memory space that can be accessed is 4GByte
2, operating system composition and system functions
A complete Linux operating system consists of the kernel (kernel) +gun Open source program, so the complete name of Linux is called Gun\linux
The kernel function is to hide the underlying hardware and provide a drive interface (abi:application binary interface) up one level.
3. Linux mainstream distribution and open source agreement
Linux is a product of an open source protocol, which is done by many Linux developers.
The so-called Open source code, the source code needs to be compiled into binary format by the compiler to be recognized by the machine. But not everyone can have the ability to compile the source code, so some vendors or organizations will compile them into binary, providing the user with direct use. The vendor or organization that compiles the source code into a binary is the Liunx publisher, and the released Linux product is the release version.
The mainstream distribution is:
Debian two-time release version Ubuntu\knopix
Redhat two Redhat Enterprise (Rhel Enterprise), and re-release CentOS (Enterprise Edition) based on two Rhel releases
SLS Two release Slack Ware, based on Slackware released S.U.S.E (Enterprise Edition) and openSUSE (Personal Edition).
Where Redhat and SLS are supported by commercial companies, Debian is community support.
All open source products must have an agreement that is adhered to and accepted by all, thus having an open source agreement.
There are several main open source protocols: GPL, LGPL, BSD, APACHE
GPL: All people are free to use the source code, but as long as the code in the GPL is referenced, the source code must be open.
LGPL: If you call only the library file, you do not have to open the source code
BSD and Apache are relatively loose, as long as the software is not published in the name of the author.
4, Package Manager introduction
A complete program includes the following sections: binary executables, library files, configuration files, Help files.
The role of Package Manager is to manage the installation of packages, to inform, upgrade and so on.
Linux Mainstream release Package Manager:
Debian:dpkg
redhat:rpm
suse:rpm
WINODWS package format is an. exe or MSI,LINUX package format elf, view Linux Package command:]# file command path
Such as:
[Email protected] ~]# File/bin/cat
/bin/cat: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs) , for Gnu/linux 2.6.18, stripped
[Email protected] ~]#
5, Linux Operation interface Introduction and classification
There are two types of Linux operating interactive windows: GUI graphical interface (GNOME, KDE), CLI command line interface.
There are several main CLI interfaces:
Physical Terminal: Console
Virtual Terminal: TTYs corresponding directory:/dev/tty#//#代表终端号码, press CTRL+ALT+[F1-F7 in the terminal interface]
Pseudo Terminal: Pty corresponding directory:/dev/pts/, Remote Desktop, graphical interface of the terminal
6. Introduction to Linux Philosophy thought
The philosophy of Linux has the following points:
All documents are followed, and hardware devices are also represented by documents.
Made up of many small programs
7. Introduction to Linux entry commands:
Ifconfig: View IP address, or use IP Addr list
[Email protected] ~]# ifconfig
[[Email protected] ~]# IP Addr List
Echo: Echoing |p>[[email protected] ~]# echo Hello Word
Hello Word
TTY: This command is primarily displayed on which terminal
[[email protected] ~]# TTY
/dev/pts/0
StartX: Start the graphical interface, in Centos7, on which terminal to display
Export
PWD: The path where the output directory resides
[Email protected] ~]# pwd
/root
History: Show historical Command record
Shutdwon: Shutdown command
shutdown [OPTION] ... Time [MESSAGE]
Option
-r:reboot restart
-h:halt shutdown command
-C: Cancel shutdown operation
-K: Send a message and do not execute e 擏
Time
Now: Take action immediately
HH:MM: Perform actions in a few minutes
+m: Operation after a few minutes from the current time
Poweroff: Shutdown or restart command
--verbose: Used for debug information.
Reboot: equivalent to Poweroff
Hwclock: Display system hardware time, equivalent to clock
[Email protected] ~]# Hwclock
Mon-04:06:55 PM CST-0.625266 seconds
[Email protected] ~]# clock
Mon-04:07:09 PM CST-0.500248 seconds
[Email protected] ~]#
Command options for Hwclock:
-S,--hctosys;set the system time from the Hardware Clock. Synchronizing hardware time to System times
-W,--SYSTOHC; Set the Hardware Clock to the current system time. Synchronizing system times to hardware time
Date: Displays, sets the system time, the system starts from the hardware read time, starts will not use the hardware time, but uses the system time.
[[Email protected] ~]# Date
Mon 16:17:10 CST 2017
The command uses the format:
Show time
Date [OPTION] ... [+format]
FORMAT
+%d: Days
+%m: Month
+%y: Year
+%m: Minutes
+%h: When
+%s: Sec
Set the time
Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]
[[Email protected] ~]# date 082816312017.30
Mon 16:31:30 CST 2017
CD: Switch Directory command
] #cd: No parameter, means to cut back to the user home directory
] #cd ~: means to cut back to the user home directory, ~ Indicates the user home directory
] #cd-: Indicates that you are switching back and forth between the current directory and the previous directory. This involves two variables, pwd and oldpwd.
8, Linux Command classification and help information classification
Linux commands are divided into inline commands and external commands.
The view command belongs to an inline command or external command:
]# type command
such as [[email protected] ~]# type cd
CD is a shell builtin//inline command
[[Email protected] ~]# type cat
Cat Is/bin/cat//external commands
Inline command help:] #help command
such as: [[email protected] ~]# Help CD
CD:CD [-l|-p] [dir]
Change the shell working directory.
External command help:
①] #命令--help
such as: [[email protected] pts]# ls--help
Usage:ls [OPTION] ... [FILE] ...
List information about the FILEs (the current directory by default).
Sort entries Alphabetically if none Of-cftuvsux nor--sort.
②] #man command
[[email protected] pts]# Man # command//#表示章节
The man command uses the format:
Man [-ACDFFHKKTWW] [--path] [-M system] [-p string] [-C Config_file] [-M pathlist] [-P pager] [-b browser] [-H HTMLPAG ER] [-s section_list]
[Section] name ...
Man Chapter Introduction
1 user Commands//general users, System user command use Help
2 system Calls//systems invoke use Help
3 C Library Functions//c function Use Help
4 Devices and special files//device and special file use Help
5 file Formats and Conventions//Files format and protocol usage help
6 games et. Al. Game Help
7 Miscella
8 system Administration Tools and deamons//systems Administrator and Daemon Help
9. Linux system directory naming rules
You can use any character other than/, but special characters and spaces are not recommended
Directory names are strictly character-sensitive
Directory name cannot be longer than 255 characters
directories and files under the same directory cannot have the same name.
10. Description of character references in Linux:
": strong reference, the meaning of the character has changed
"": a weak reference, as a variable of a character, displays the value of the variable and changes the value of the original character.
[Email protected] ~]# echo ' $PWD '
$PWD
[Email protected] ~]# echo "$PWD"
/root
Basics of getting Started with Linux and introduction to simple commands