Centos Linux Basics Primer Class

Source: Internet
Author: User
Tags symlink

Centos Linux Basics Primer Class

1.1Linux Terminal Introduction
1.2 Use of BASIC commands: LS, pwd, CD.
1.3 View system and BIOS hardware time.
1.4 Linux How to get help, Linux shutdown command: Shutdow, INIT, etc.
1.5 Yum Local source configuration and boot auto mount disc

Objective:
Many students learn Linux more or less know that Linux is a command line under the operating system, because the online environment is basically not using graphical installation, so the system is basically through the command to complete the operation of the system, I will introduce some simple basic commands.
Word collation:
Terminal Terminal network-scripts Network script passwd password file shutdown shutdown nologin Disable login reboot restart Poweroff Shutdown localhost native grep filter useradd add user
1.1Linux Terminal Introduction shell prompt Bash Shell basic syntax

1 Linux Terminal introduction
TTY Console Terminal
PTS Virtual Terminal

TTY Console Terminal:

Linux to the POSIX standard to use the personal computer as a minicomputer, then on the console through the Getty software Virtual Six Characters dummy terminal (or call console terminal Tty1-tty6)
(Quantity can be adjusted in/etc/inittab) and a graphic terminal,

TTY (collectively referred to as terminal equipment):
The word "TTY" originates from teletypes, or teletypewriters, which originally refers to a telex typewriter, which is used to read and send information via a printer keyboard through a serial line, which is later replaced by a keyboard and a display, so it is now more appropriate to call the terminal.

Tty1-tty6
The first entry is the graphical surface: Tty1 is the graphical interface.

Graphical interface switch to character interface terminal: Ctrl+alt+f2-6

Switch to the image interface Alt+f1

PTS Virtual Terminal
Pty (Virtual Terminal):
If we telnet to the host remotely, do we need a terminal interaction?
Yes, this is the Virtual Terminal Pty (Pseudo-tty)

  1. PTS/PTMX (PTS/PTMX combined to achieve pty):
    PTS (pseudo-terminal Slave) is an implementation of Pty, implemented in conjunction with PTMX (Pseudo-terminal Master) Pty

Ctrl+shift+t New Pseudo Terminal
ALT + Digital Key terminal switch
ALT + F4 Close Terminal
Use Who am I to query the PTS number of the current terminal
Magnification: ctrl+shift+ +
Zoom Out: Ctrl +-

Experiment: Use SSH remote to view pts

SSH [email protected]
[Email protected] ~]# Ps-aux | grep pts
PTS (pseudo-terminal slave) pseudo-terminal: After connecting via the SSH related tool, the terminal is displayed as: pts650) this.width=650; "alt=" alt text "title=" "src=" https:// Maxiang.io/f7f5ffa2-be26-48a6-877a-09591bdba0c5 "style=" border:0px; "/>

1.1.2 Shell prompt:

[[email protected] ~]# root
[[Email protected] ~]$ ordinary users
User name-host name-current directory-root/normal user
SU User Switch Su–user
Normal User: No
Switch Root: Required

1.1.3 Shell Basic Syntax

How to enter a command:
Shell: Interpreter
User--shell-– kernel-hardware
To view all the interpreters:
Cat/etc/shells
Format of the command:
command word [options] [parameters]
[Email protected] ~]# ls-a/root/
Command word: LS (what to do) view
Option:-A (conditional) Show hidden files
Parameters:/root (object processed by command) directory

For example:
Useradd-s/sbin/nologin-m War
[Email protected] ~]# useradd-s/sbin/nologin-m War
Useradd: User "war" already exists
[Email protected] ~]# tail-1/etc/passwd
War:x:1001:1001::/home/war:/sbin/nologin
[Email protected] ~]#

1.2 Basic command operation:

LS pwd CD
ls command
function: See what files are in the current directory
Syntax: LS directory, if you do not add a directory to view the current directory
Parameters:
-L display the shortcut in the detailed information system #ll=ls-l
-A Show hidden files
-D View directory (without viewing the contents)
-H Enhanced Readability

For example:

[Email protected] ~]# ls-l/etc/passwd
-rw-r–r–1 root root 2047 Nov 20:43/etc/passwd
[Email protected] ~]# LS-LH/ETC/PASSWD
-rw-r–r–1 root root 2.0K Nov 20:43/etc/passwd

Different colors in the –linux system represent different file types
Blue Directory/etc
Black file/etc/passwd
Light blue link/etc/grub2.cfg
Red Compress Package boot.tar.gz
Green executable file/etc/init.d/network
Black bottom Yellow word device file/dev/sda

1.2.2 pwd Command

Current working directory
[Email protected] ~]# cd/etc/sysconfig/network-scripts/
[Email protected] network-scripts]# pwd
/etc/sysconfig/network-scripts

1.2.3 CD command

Role: Switch Directories
Syntax: CD directory Name
Cases:
CD back to the user's own home directory
CD ~ Back to the user's own home directory
CD-Back to previous directory
[Email protected] ~]cd/etc/
[Email protected] ~]pwd
/etc

1.3 System Time Management:

View system time
[[Email protected] ~]# Date
View current month and month date
[Email protected] ~]# date +%y-%m-%d
2017-03-25
View Help
Date–-help
Change Time Date-s 2017-03-25
Refers to the BIOS time (Griniz Observatory)
[Email protected] ~]# Hwclock
Thu 05:34:24 AM CST-0.943039 seconds

1.4.1 Linux how to get help

[Email protected] ~]# Date–help
[Email protected] ~]# fdisk–h
[[email protected] ~]# man find
Help View Internal command assistance information
Help viewing external command help information
Mans
What is the difference between an internal command and an external command?

1.4.2 Shutdown Command:

Poweroff shutdown init 0 halt
Shutdown
Function: Shutdown, restart, timer shutdown
Syntax: Shutdown [options]
-R = Restart the computer
-H = power off
-H + time = Timer off
-C +-Cancel the pre-timer shutdown or CTRL + C

init command
Role: Switching the system operating level
Syntax: Init 0-6
Linux 7 Boot levels:
0 System shutdown mode, the system default operation level cannot be set to 0, otherwise it will not start normally, the machine shuts down. Shutdown
1 single-user mode, root privilege, for system maintenance, prohibit remote login, like Safe mode login under Windows. Character interface
2 Multi-user mode, no NFS network support. Character interface is not available online
3 full multi-user text mode with NFS, login to console command line mode. Full character
4 The system is unused, reserved for general use, and in some special cases it can be used to do something. For example, you can switch to this mode to do some setup when your laptop's battery is running out.
5 graphical mode, after landing into the graphical GUI mode, X window System.
6 Restart mode, the default run level cannot be set to 6, otherwise it will not start normally. Running the init 6 machine will restart.

1.4.3 Boot level configuration:

RHEL7 no longer uses the/etc/inittab file for the default boot level configuration
The SYSTEMD uses a more free target substitution than the sysvinit run level.
The 3rd run level is replaced with Multi-user.target.
The 5th run level is replaced with Graphical.target.
Runlevel3.target and Runlevel5.target respectively are
Symbolic links to Multi-user.target and graphical.target.

Switch to the 3rd run level
[Email protected] ~]# Systemctl isolate Multi-user.target
Or
[Email protected] ~]# Systemctl isolate Runlevel3.target

Switch to the 5th run level
[Email protected] ~]# Systemctl isolate Graphical.target
Or
[Email protected] ~]# Systemctl isolate Runlevel5.target

Set the default run-level
Setting the default third boot level is the character interface
[Email protected] ~]# Systemctl set-default multi-user.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/multi-user.target.

Setting the default fifth boot level is graphical
[Email protected] ~]# Systemctl set-default graphical.target
Removed Symlink/etc/systemd/system/default.target.
Created symlink from/etc/systemd/system/default.target To/usr/lib/systemd/system/graphical.target.

View the current default startup level
[Email protected] ~]# Systemctl Get-default
Graphical.target

1.5yum Local source configuration and boot auto-mount disc

[[email protected] ~]# mount/dev/sr0/mnt Mount CD to the MNT directory
[Email protected] ~]# Df-h | grep sr0 using the DF command to see if the disc file was successfully mounted
/dev/sr0 3.8G 3.8G 0 100%/mnt

If you see the result is not/mnt, then execute the uninstall command, first uninstall
[[email protected] ~]# umount/dev/sr0 unmount disc
[[email protected] ~]# echo "/dev/sr0/mnt iso9660 defaults 0 0" >>/etc/fstab set boot auto Mount

Yum Source
[Email protected] ~]# Vim/etc/yum.repos.d/rhel7.repo
[Rhel7-source]
Name=rhel7-source
Baseurl=file:///mnt
Enabled=1
Gpgcheck=0

Clear cache with Yum clean all
[[email protected] ~]yum Clean all Clear Cache

650) this.width=650; "alt=" alt text "title=" "src=" HTTPS://MAXIANG.IO/200FD1D3-5B54-40C9-809E-6FF4B5416CAA "style=" border:0px; "/>

[[email protected] ~]yum Makecache Load Cache

650) this.width=650; "alt=" alt text "title=" "src=" Https://maxiang.io/3971699a-bb33-432d-b687-187f895f3a14 "style=" border:0px; "/>
To this Yum local source successfully established


This article is from the "Night sky" blog, be sure to keep this source http://firstshell.blog.51cto.com/8761954/1910690

Centos Linux Basics Primer Class

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.