Chapter 2 Introduction to Linux and Chapter 2 Introduction to linux

Source: Internet
Author: User
Tags network function

Chapter 2 Introduction to Linux and Chapter 2 Introduction to linux
The linux kernel version consists of three parts:

  • Major version number
  • Minor version number

  • Last Version
[root@centos7 ~]#uname -r3.10.0-693.el7.x86_64

Separated by "." means:

Major version number, minor version number, last version number, compiled version number, vendor version, CPU architecture

The latter part is added to the issuer's release version.

Linux philosophy:

1. Everything is a file;
Organize almost all resources, including hardware devices, into file formats;
2. It is composed of many small programs with a single purpose. One program only implements one function and must be well done;
Combine applets to complete complex tasks;
3. Avoid interaction with users as much as possible;
Objective: To implement Script Programming to automatically complete some functions;
4. Use a plain text file to save configuration information;
Objective: A text programmer can complete system configuration;

[root@centos7 ~]#sha1sum  /dev/sr0b9d9feace8d3b01527114f15eda5b29c64a7a60c  /dev/sr0

Check whether the image downloaded from the website is complete, and compare it with the encrypted file on the website.

Three Network modes of virtual machines:

Bridged (bridging mode): Like a real machine, the network function of a virtual machine is the closest to a real host. data exchange between a virtual machine and a host requires a router. The IP address of a virtual machine may conflict with the IP address of another real machine.

NAT (address translation mode): when data is accessed and exchanged through the host machine, the IP address of the host machine changes and the virtual machine changes. At the same time, the public network does not have the 192.169.163.131 (my virtual machine ip address) address,

The outbound IP address needs to be converted to a LAN address and then to a public IP address.

Host-only: the Host machine does not provide the Internet routing service for virtual machines, and cannot access the Internet. It can only exchange data with the real Host or between internal virtual machines.

[root@centos7 ~]#cat /proc/meminfo

Shift + pageup to view system information

[root@centos7 ~]#cat /proc/partitionsmajor minor  #blocks     name   8        0  209715200 sda   8        1    1048576 sda1   8        2   52428800 sda2   8        3   20971520 sda3   8        4          1 sda4   8        5    2097152 sda5  11        0    8491008 sr0

Run the command to view partition information. The sda4 extended partition cannot store data and has a small capacity.

[root@centos7 ~]#lsblkNAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTsda      8:0    0  200G  0 disk├─sda1   8:1    0    1G  0 part /boot├─sda2   8:2    0   50G  0 part /├─sda3   8:3    0   20G  0 part /app├─sda4   8:4    0    1K  0 part└─sda5   8:5    0    2G  0 part [SWAP]sr0     11:0    1  8.1G  0 rom  /run/media/root/CentOS 7 x86_64

View disk size and partition mounting information

Terminal:
  • Device Terminal

Keyboard and mouse display

  • Physical terminal (/dev/console)

Console (usually unavailable, console displayed in rescue mode)

  • Virtual terminal (tty: teletypewriters,/dev/tty # [1-6])

Tty can contain n, Ctrl + Alt + F [1-6]

  • Graphics terminal (/dev/tty7) startx, xwindows

CentOS6: Ctrl + Alt + F7

CentOS7: on which terminal is started, that is, on which virtual terminal

Close graphical interface: init 3. If it is a graphic interface that is at the level and enabled with startx, it can be done directly in the graphic interface logout.

  • Serial terminal (/dev/ttyS #)

TtyS

  • Pseudo Terminal (pty: pseudo-tty,/dev/pts /#)

Pty, SSH remote connection

  • View the current terminal device: # tty
[root@localhost ~]#whoamiroot

View Current User

[root@centos7 ~]#who am iroot     pts/2        2017-11-09 13:09 (192.168.27.1)

View the user and terminal number of the current terminal

[root@centos7 ~]#whoroot     :0           2017-11-09 08:51 (:0)root     pts/1        2017-11-09 13:01 (:0)root     pts/2        2017-11-09 13:09 (192.168.27.1)

Check the number of users on which terminal to log on.

[root@centos7 ~]#who -r         run-level 5  2017-11-09 08:51[root@centos7 ~]#runlevelN 5

View the current running level and from which the running level is switched

[root@centos7 ~]#echo $SHELL/bin/bash

View the Current shell

[root@centos7 ~]#cat /etc/shells/bin/sh/bin/bash/sbin/nologin/usr/bin/sh/usr/bin/bash/usr/sbin/nologin/bin/tcsh/bin/csh

View all the shells. If you want to use other shells, enter the path directly.

What is Shell?

Shell is the user interface of the Linux system. It provides an interface for users to interact with the kernel. It accepts user input commands and sends them

Run the command in the kernel.

Shell is also called the Linux command interpreter (command interpreter)

Shell is a high-level programming language.

There are two types of commands that can be executed in Shell:
Built-in commands: these commands are provided by shell and in a command form;
External command: an executable program file exists under a file system path of the current system;
Which, whereis

Differences between internal and external commands:
# Type COMMAND

[root@centos7 ~]#strace cat[root@centos7 ~]#lstrace cat

Strace is used to view the system library called by the program, and lstrace is used to view the function library called by the program.

[root@centos7 ~]#cat /etc/profile.d/env.shPS1="\[\e[1;35m\][\u@\h \w]\\$\[\e[0m\]"

Create a file ending with. sh in the/etc/profile. d directory, that is, control the prompt format, which is valid for all users.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.