Computer Fundamentals and computer system composition
The computer system consists of two parts: hardware (Hardware) system and Software (software) system.
Second, von Neumann system
Server Storage Type
DAS: Direct attached storage, storage directly connected to the server, similar to the server directly into the storage, with the IDE, SATA and other cables connected
NAS: Network-attached storage, through the local area network, directly on multiple servers for file sharing, similar to NFS, Windows sharing mode
San: A storage area network, a client of a San's server and SAN,
Iv. Abi and API
ABI: Application Binary interface, between application and operating system
API application calls the interface between the underlying and the operating system.
V. File system
NTFS, FAT, ISO9660
EXT2, EXT3, EXT4 CentOS 6.X system Default File system
XFS, BTRFS CentOS7 default to XFS file system
VI. subregional programmes
Mbr:
Primary partition : The number of primary partitions of a disk ≤4, the system to be installed on the primary partition, if there are two disks on the server, then one of the disks can have no primary partition
Extended partition : One disk can only have one extended partition, the number of extended partitions + the number of primary partitions ≤4, the extended partition cannot store data, can only be used to partition logical partitions
logical partition : The logical partition number is numbered starting with 5, for example: Sda5
The number of primary and extended partitions can be considered specified, but the logical partitions inside the extended partition are automatically specified by the system and must be mounted after partitioning to be used
Swap partition in the memory of the previous era, generally twice times the memory, the server memory is relatively large, the test environment is 2G, production environment 8G or more memory, to 10G is enough.
Vii. Philosophy of Linux
1, all documents;
2, a small, single program;
3, linking procedures, to complete complex tasks;
4, avoid the confusing interface;
5. The configuration data is stored in the text.
Viii. Types of shells
SHELL: Functions can be interpreted as translating commands into translators that the computer can recognize binary code
Shell types: sh, csh, tcsh, ksh, bash, zsh
The shell types supported by the current system are saved in the/etc/shell configuration file
Ix. Common Commands
lscpu: viewing system CPU Information
1.[[email protected] ~]# lscpu2. Architecture: x86_643.cpu Op-mode (s): 32-bit, 64-BIT4. Byte Order: Little endian5.cpu (s): 26.on-line CPU (s) List: 0,17.thread (s) per core: 18.Core (s) per Socket: 19.Socket (s): 210.NUMA node (s): 111.Vendor ID: genuineintel12.cpu family: 613.Model: 3714.Model Name: Intel (R) Core (TM) i5 CPU M 480 @ 2.67ghz15.stepping: 516.CPU MHz: 2660.03917.BogoMIPS: 5320.0718.Hypervisor Vendor: vmware19.virtualization Type: full20. L1D cache: 32k21. L1i cache: 32k22. L2 cache: 256k23. L3 cache: 3072k24. NUMA node0 CPU (s): 0,1
md5sum XXX: Can calculate the MD5 value of the specified file
1.[[email protected] ~]# md5sum/testdir/file2.bfbcfaf6416f7f3a4ea72b2ec3c2e939 /testdir/file
WhoAmI: can show which user is currently logged in
1.[[email protected] ~]# whoami2.root
TTY: can show which user is currently logged in
1.root[[email protected] ~]# tty2./dev/pts/0
CHVT 1-6: Indicates the use of the terminal switching interface
Hostname: Full host name can be displayed
Lsb_release-a: View version information for the current operating system
Uname-r: View kernel version
Id-u: View the UID of the currently logged on user
Id-u USERNAME: View the UID of the specified user
echo $SHELL: View the default SHELL type
Getent passwd ftp: Can view entries in the FTP user's/etc/passwd
Type command: You can see whether the specified command is an external command or an internal command
Hash: The path result of the external command can be cached
Ten, the relevant command detailed
CD: Changing the working directory
Syntax: Cd/path/to/somedir switch to the specified directory
CD: Switch home directory
cd~: Switch back to your home directory
CD ~username switch to the home directory of the specified user (only administrators have permission to switch to other users ' home directories)
CD-: Switch back and forth between the last directory
PWD: Environment variables used to record the current working directory
OLDPWD: The environment variable used to record the last working directory
LS: Supports content in the specified directory
Syntax: ls[option] ... [FILE] ...
Common options:
-A: Show All Files
-A: Displays except. and. All files except the
-L: Long format list, indicating detailed property information for displaying files
For example:
-rw-r-x-1 root root 8827 October 20:34 testa.log
File type: the
-: Indicates an ordinary file
D: Indicates directory
C: Represents a character device file that supports linear access in "character" units
L: Indicates symbolic link (soft link) file
P: Indicates pipeline file, pipe file with name
S: Indicates a socket file
1: Number of times a file has been hard-linked
Root: Indicates the owner of the file
Root: Represents a group of files
8827: Indicates the size of the file
But if the ll/dev is showing two numbers, like BRW-RW —-. 1 root cdrom 11, 0 July 00:34 sr0
Here the number before one represents the main device number, the latter represents the secondary device number, one identifies the device type, the latter identifies the same class of different devices
October 15 20:34: Indicates the last time the file was modified
-H indicates a unit conversion of the file size, the converted result may be a non-accurate value (difference between 1000 and 1024)
-d means to display only the directory itself, not the properties of each file below the directory, to be used with-l to display the property information of the directory itself
-R, –reverse indicates the display is displayed in reverse order, the default is ascending display
-R, –recursive indicates recursive display
Cat: Display the file contents of a text file
Syntax: Cat [OPTION] ... [FILE] ...
Options:
-N to the displayed text line number
-e display line terminator, Linux line terminator is $
File can have more than one file, when it is displayed, all the files are listed.
Echo: Echoing command
Syntax: Echo [OPTION] ... [STRING] ...
Options:
-n display does not automatically wrap after completion
-E Let the signifier take effect, not show it
Turn the signifier:
\ n = line break
\b Means backspace
\ t represents a tab
\0nnn Insert nnn (octal) represents the ASCII encoding
Using the above can be changed color, color profile in/etc/dir_colors
ECHO-E "\033[background color, font color m string \033[0m" background color can be omitted
Echo-e "\033[43;31m Nihao \033[0m"
43;31 represents the foreground and background colors
Font color: 30-37: Black, red, green, yellow, blue, violet, sky blue, white
Background color: 40-47: Black, red, green, yellow, blue, purple, sky blue, white
\033[0m is the control option, 0m for no attributes, 1m for high brightness, 4m for underscores, 5m for flashing, 7m for reverse, 8m for hidden display
Echo-e "\033[5m\033[44;32m*\033[0m" display as * number flashing, if written to the last face \033[0m here,
The command prompt flashes after the line breaks after the display is complete.
STRING: can use quotation marks, both single and double quotation marks can be used
Single quotes: Strong references, variable references do not perform substitutions;
Double quotes: Weak references, variable references perform substitutions;
such as: echo "$SHELL"
The information displayed is/bin/bash
[[email protected] ~]# echo ' SHELL ' shell[[email protected] ~]# echo ' $SHELL ' $SHELL [[email protected] ~]# echo Echo $USERec Ho Root[[email protected] ~]# echo "Echo $USER" echo root[[email protected] ~]# echo ' echo $USER ' root
Note: The normal reference notation in a variable reference is ${shell}, but many times {} can be omitted
Shutdown: Shutdown or restart command
Syntax: Shutdown [OPTIONS ...] [TIME] [WARNING ...]
Options:
-H: Indicates shutdown
-R: Indicates restart
-C: To cancel the shutdown or restart operation that was previously defined
Time:
Now: Table immediately
HH:MM represents a specified point in time
+m indicates how many minutes after the current moment
WARNING:
Indicates a prompt message
Example: Shutdown-r +10 "System is going-reboot after minutes"
Date-related commands: date, clock, Hwclock, Cal
Linux has two sets of time, one set is the hardware clock, the system clock, the system starts from the hardware to read the date and time information; After the reading is done, it is not related to the hardware
Date: Displays or sets the system time (displays and sets the system clock)
Syntax: Date [OPTION] ... [+format] used to display time and date
Date [MMDDHHMM[[CC]YY][.SS]] to set the time date
Date-d "string": Displays the date of the specified string
Example: date-d yesterday
Date-d "days ago" shows the date 10 day ago
date-d "1 month ago" Showing 1 months 10 days ago Date
Date-d "Days" displays the date after 20 day
Date–set 20160725 You can set the date to July 25, 2016
Date–set "20160726 17:25:26" to set the date and time
+format: Represents a date displayed as a specified format, plus a fixed format
The common formats supported by format are:
%F: Displayed as a date format for example 2016-07-20
%T: Displays a time display format such as 08:58:15
%Y: Show year
%M: Show Month
%d: Display Day
%H: Show several points
%M: Show a few
%s: Display for a few seconds
%j: Displays the number of days in the current year, with a value of 1-356
%d: Displayed as 07/22/16 such as month/day/year format
%s: Displays the timestamp, which is the number of seconds from January 1, 1970 0:0 0 seconds to the current time
Multiple formats are separated by spaces, and the entire format can be enclosed in double quotation marks
Example: Date + "%F%T"
Example: Date + "%y%m%d%h%m%s"
Date + "Year:%y month:%m"
Example of setting the time:
Date 072008522016.25 Indicates the modification time is July 20 08:52 2016 25 seconds
Clock,hwclock: Query and set hardware clock (hardware clock, can be understood as BIOS clock)
Clock and Hwclock for the same set of commands, clock is the hard link of hwclock
Clock does not follow any information, indicating that the hardware clock is displayed
-s,–hctosys indicates that the system time is set to the same time as the hardware time
-W,–SYSTOHC indicates that the hardware time is set to the same time as the system time
Cal: Show Calendar
Cal indicates that the current month's calendar is displayed
Cal 2016 represents the year-round calendar that displays the specified year
Cal 07 2016 indicates a calendar that displays the specified month of the specified year
Type: Displays the type of command, whether it is a built-in command or an external command
For example: type ls
If the original command is hidden, you can use \LS&NBSP if you want to use the original command;
Whatis command can display the approximate function description of the
which: the full path for displaying the command;
syntax: which [OPTION] ... command
For example: which ls
option:
–skip-alias ignores command aliases and directly displays the command itself
Whereis: Displays the path to the command and the path information for the associated Help file
Syntax: Whereis [options] name
For example: Whereis ls
Options:
- b displays only the path of the binary program
-M only displays the path to the Help file's program
who: Shows which logged-on users the system today;
Syntax: who [options]...
Displays information for all logged-on users of the current system
Who-b Displays the time the system started,
Who-r the time the system started, and the current system runlevel
who-d display information about the system's death process
Who-u Displays information for each logged-on user, including the process number that displays logon persistence and login
W: Enhanced who command to display details of all currently logged-in users, their actions, etc.
Command aliases:
Alias can display command alias information on the current system
To define a command alias:
Alias Name= ' COMMAND ' is valid only for the current shell, effective immediately, fails after reboot
For example alias cds= ' cd/etc/sysconfig/network-scripts/'
To revoke an alias:
Umalias NAME
For example Unalias CDs
Hash command: The path to the command can be cached in memory
Hash to see the list of caches
hash-d command can delete an entry that contains a command in the hash cache
Hash-r can empty the cache table of the hash path cache
Screen command: The character interface enables Remote Assistance (provided that you connect to the same machine, use the same account) and need to install the software, yum install
Open a new Shared desktop: The name of the Screen-s shared session
Show list of shared desktop sessions: Screen-ls
Connecting to a shared session established: Screen-x Session Name
Exit Session Ctrl+a,d
The process number of the Screen-r session is connected again after exiting
Exit and close the session completely exit
When you log in remotely, run a program that executes longer (such as a backup), in order to prevent the network from being disconnected,
Program disconnected, unable to know the state of the program running, you can open a screen to run the program
Command execution Priority: command alias > Internal > External Command Cache (hash) > External command
Xi. homework After class
1, with echo display flashing, color inverted triangle
ECHO-E "\033[background color, font color m string \033[0m" background color can be omitted
43;31 represents the foreground and background colors
Font color: 30-37: Black, red, green, yellow, blue, violet, sky blue, white
Background color: 40-47: Black, red, green, yellow, blue, purple, sky blue, white
\033[0m is the control option, 0m for no attributes, 1m for high brightness, 4m for underscores, 5m for flashing, 7m for reverse, 8m for hidden display
Echo-e "\033[5m\033[40;32m *******\n *****\n ***\n *\033[0m" Display as * number flashing, if written to the last side \033[0m here,
The command prompt flashes after the line breaks after the display is complete.
[Email protected] ~]# echo-e "\033[5m\033[40;32m *******\n *****\n ***\n *\033[0m" ******* * * * ** *** *
To show a green, flashing inverted triangle
2, date displays the date before 10 days, and the last 20 days of the day information
Showing dates 10 days ago
[Email protected] ~]# date-d "Ten days Ago" +%f2016-11-27
Displays the date after 20 days
[Email protected] ~]# date-d "Days" +%f2016-12-27
3, Screen command: The character interface for Remote Assistance (provided that: connected to the same machine, using the same account) need to install the software, yum install
Open a new Shared desktop: The name of the Screen-s shared session
Show list of shared desktop sessions: Screen-ls
Connecting to a shared session established: Screen-x Session Name
Exit Session Ctrl+a,d
The process number of the Screen-r session is connected again after exiting
Exit and close the session completely exit
When you log in remotely, run a program that executes longer (such as a backup), in order to prevent the network from being disconnected,
Program disconnected, unable to know the state of the program running, you can open a screen to run the program
Learning linux-Foundation One (computer basis)