current position:Home>Introduction to Linux system installation and Linux connection finalshell

Introduction to Linux system installation and Linux connection finalshell

2022-01-26 21:51:53 Bo childe

operating system (Operating System, OS) It's part of the software , It's the first layer of software based on hardware , It's a bridge between hardware and other software ( Or interface 、 A middleman 、 Agency, etc ).

The operating system will control other programs , Manage system resources , Provide the most basic computing functions , Such as managing and configuring memory 、 Determine the priority of supply and demand of system resources , It also provides some basic service procedures , for example : file system 、 Device drivers 、 The user interface 、 System services, etc .

The operating system makes it impossible for applications to deal directly with hardware , Instead, it must pass through the kernel of the operating system , Coordinate the running of multiple programs to prevent malicious programs from damaging other processes and monopolizing resources , Ensure the smooth operation of multi tasks .

The operating system provides external system calls , Then the system call is encapsulated into a library, and the library call is provided to the outside , The programmer only needs to base the library on API Interface to program , Don't care about the difference of the underlying hardware , It is convenient for program transplantation .

Linux Main characteristics of the system

Installation preparation

*Centos 7

Download address : http://isoredirect.centos.org/centos/7/isos/x86_ 64/CentOS-7-x86_ 64- DVD-1708.iso

*VMware workstation 15

First step : Create a virtual machine

The second step : Set the virtual machine file location : 

The third step : Configure processor and memory

Step four : Configure network and hard disk

 

Step five : Set the memory size of the virtual machine

Step six : Choose install image  

 

Step seven : Click on the install , Set up root password : 

 

Linux Characteristics

It consists of small programs with single purpose ; Combining applets to accomplish complex tasks ;

Everything is a document ;

Try to avoid capturing user interfaces ;

The configuration file is saved in plain text format ;

Linux Of shell, Man machine interface .Linux Of shell Include GUI and CLI Two types of .

GUI Refers to the graphical interface , And windows similar . The more common ones are gnome、KDE and xface etc. .

CLI It's the command line interface . The more common ones are bash、csh、zsh、ksh and tcsh etc. , We usually use bash.

The first 2 course - Command line Basics
We can press Ctrl + Alt+ F2 Switch to the command line . When switching to command line login , Note that when entering the password , The screen is not echoed .

We can press Ctrl + Alt+ F1 Switch back to the GUI .

Linux The prompt at the end of the command line is “#” and ”$” Two different symbols

  • $ No. is the prompt after logging in with an ordinary user
  • # Number is to use super user root Prompt after login

Command line shortcuts

  • CtrI+C: Terminate the current input , If you enter a lot of content on the command line , Incorrect input found , Or perform other tasks . Press down Ctrl+C after , Will automatically terminate the current input , Jump to the next line .
  • TAB key : Complete the current command ,Linux There are many commands or long paths in , Beginners can't remember , We can use TAB Key to complete .
  • Ctrl+A: Move the cursor to the front ;
  • Ctrl+E: Move the cursor to the last ;
  • Ctrl+D: Exit the current terminal ;
  • Ctrl+L: Clear current screen ;
  • Ctrl+Z: Pause the current process , And CtrI+C No - What it looks like is Ctrl+ Z After pausing, the process can be resumed .

Log in through the network Linux

  • ifconfig: View the current interface status , The default is auto get IP, The default network port name is ens33
  • Centos7 Has been allowed by default SSH Sign in , We can go through .ss -Int: View the currently open tcp port , It already includes 22 Port no. , By allowing SSH Sign in .

Finalshell Use

Linux Command basic syntax format

  • Sometimes commands have one or more options .
  • Usually options consist of a single letter , And add a connector before the letter "-"
  • Sometimes because there are too many options , We can use simpler expressions such as :
    Is -a -l -t and Is -alt Is a meaning
  • Some options can also be a continuous word , We call it the long option , Use two connectors to add a complete word, such as :Is --help
  • --help Most commands Help options for , You can view the basic usage of the command
  • meanwhile , Most commands can be followed by arguments , Parameters usually refer to file names 、 Catalog 、 user name 、 equipment . It can be interpreted as The order is to
  • The object of the operation .
  • To sum up , The option is to tell the command ” What about? ” perform , Parameters tell the command " To whom ” perform

linux Command history

  • Shell History Is a list of previously entered commands
  • adopt history Command to view previously executed commands
  • ! Numbers   perform history Command number specified in
  • !! Execute the last order
  • !?is? perform history Contained in the is The order of
  • You can also select historical commands from the top and bottom of the key head

The first 3 course - File system and directory

/ yes Linux Start of all paths , Is the root of all directories

Linux The whole directory is a tree structure , Pictured

System start-up must be

  • /boot: Start of storage Linux The kernel file used when , Including connection files and image files .
  • /etc: Store all configuration files and subdirectories required by the system , Changing the files in the directory may cause the system to fail to start .
  • /lib: Store the base code base ( such as C++ library ), Its function is similar to Windows Inside DLL file . These shared libraries are required for almost all applications .
  • /sys: This is a linux2.6 A big change in the kernel . This directory has 2.6 A new file system in the kernel sysfs.sysfs The file system integrates the following 3 File system information : For process information proc file system 、 For equipment devfs File system and for pseudo terminal devpts file system . The file system is an intuitive reflection of the kernel device tree . When a kernel object is created , The corresponding files and directories are also in the kernel object subsystem .

Instruction sets and :

  • /usr/bin: Application programs and instructions used by system users .
  • /usr/sbin:s Namely Super User It means , yes Superuser Binaries( Super user binaries ) Abbreviation , Here is the system management program used by the system administrator .

External document management :

  • /dev:Device( set up To prepare ) Abbreviation , Deposit is Linux External equipment of . Be careful : stay Linux The way to access devices and files in is the same .
  • /media: class windows Other equipment , for example U disc 、 Optical drive and so on , After identification linux Will put the device in this directory .
  • /mnt: Temporarily mount other file systems , We can mount the CD-ROM drive on /mnt/ On , Then enter the directory and you can view the contents of the CD-ROM drive .

The temporary file :

  • /run: It's a temporary file system , Information since the storage system started . When the system restarts , The files in this directory should be deleted or erased . If you have /var/run Catalog , It should point to run.
  • /lost+found: It's usually empty , After the system is shut down illegally , Here are some files .
  • /tmp: This directory is used to store some temporary files .

Account :

  • /root: System administrator's user home directory .
  • /home: User's home directory , Named after the user's account .
  • /usr: Many of the user's applications and files are in this directory , Be similar to windows Under the program files Catalog .
  • /usr/src: The default placement directory for kernel source code .

Use... During operation :

  • /var: Store frequently modified data , For example, the log file of program running (/var/log Under the table of contents ).
  • /proc: Manage memory space ! Virtual directory , Is a mapping of system memory , We can access this directory directly , Get system information . The contents of this directory are not on the hard disk but in memory , We can also directly modify some of the files to make changes .
  • proc The contents of the directory are not on the hard disk, but in memory , We can also modify some files directly , For example, you can use the following command to shield the host ping command , Make it impossible for others to ping Your machine :echo 1 > /proc/sys/net/ipv4/icmp_ echo. ignore_ all; recovery ping Same as :echo 0 > /proc/sys/net/ipv4/icmp_ echo. ignore_ all

Create and delete :

  • Create directory :mkdir
  • Delete directory or file :rm
  • Delete non empty directory :rm -rf file Catalog
  • Delete log rm *log ( Equivalent $find ./ -name“*log" -exec rm {} ;)
  • Move ( shear ):mv The original document Target file
  • Copy file :cp The original document Target file
  • duplicate catalog :cp -r Original catalogue Target directory

Directory switching :

  • file found / Directory location :cd
  • Switch to the previous working directory :cd -
  • Change to parent directory :cd
  • Switch to home Catalog :cd or cd ~
  • Switch to /root Catalog :cd /root
  • Show current path :pwd
  • Change the current working path to path:$cd path

Absolute path : from Linux Root directory / Start writing , such as /var/log, Get into /var/log

Relative paths : The path is not written from the root directory , But relative to the current pwd The catalog of

For example, enter /var/log Catalogues can be written

cd /var: here /var It's the absolute path

cd log:log Is a relative path , be relative to var/ for

List the contents :

  • ls: Show files in current directory , Common options :
  • -a   List all files , Contains hidden files
  • -l   It is displayed as a list
  • -1 ( Numbers 1) Display in branches
  • -t  Sort by time
  • -r  Reverse order
  • -R  Include subdirectories and files of the directory

Sort by time , Show directory entries as a list ls -lrt

If ls -lrt Use it very often , We can give him an alias , stay .bashrc Set command alias in :alias lsl='ls -lrt'

View file type :ls -l

ln command : Create link file

ln -s file A file B

file type :

  • -: Represents a common file
  • d: Represents a catalog file
  • b: Represents a block device file , such as /dev/sda
  • C: Represents a character device file , such as /dev/tty
  • l: Represents a soft link file , such as /etc/rc.local
  • p: Represents a pipeline file
  • s: Represents a socket file

copyright notice
author[Bo childe],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262151511170.html

Random recommended