First knowledge of Linux (I.)

Source: Internet
Author: User
Tags clear screen

1, Linux understanding2. File System3. Directory Structure

4, RHEL7 basic Operation



1, Linux understanding

The birth of Unix, January 1, 1970

User--------> Kernel-------"Hardware

? The name/version of the release is determined by the issuer

Some common Linux systems

–red Hat Enterprise Linux 5/6/7

–suse Linux Enterprise 12

–debian Linux 7.8

–ubuntu Linux 14.10/15.04

? is a complete Linux system

–linux Core + various peripheral software

? CentOS, community Enterprise operating system

Relative path: (relative) relative path means "the path to the current working directory!"

Absolute path: Absolute position under (absolute) directory

Linux operating system provides users with three kinds of interfaces, graphical interface, terminal interface (console interface) and API interface


2. File System

Definition: In space, the rules of the data permutation combined storage

? Traditional MBR Partitioning mode

–1~4 a primary partition

–0~3 Primary partition + one extended partition (n logical partitions)

? Precautions

–MBR partition table can only record 4 primary partitions, number range 1-4

– when it is necessary to use more than 4 partitions, you need to establish an extended partition ( the primary partition number), and the extended partition can have up to 1

– Extended partition as a container of intermediate properties, from which it is then divided The partition space is a logical partition

? Typical file system types

–EXT4, fourth generation extended file system, RHEL6 series default

–XFS, advanced log file system, RHEL7 series default

–swap, swap space (virtual memory)

Linux File System

Role: Defines methods and data structures for storing documents on disk media, and rules for reading documents.

Swap: Swap space, when the physical disk is not available, the CPU will put unused data processes on the virtual disk.

The disk format that Windows uses is: nfts

The format of the USB flash drive is: FAT


3. Directory Structure

Root directory/: All data is stored in this directory (starting point of Linux system)

Mans hier

/bin/sbin//Store basic command parameter information

/dev (device)//storage file

/etc//Storage System various configuration files

/boot///system boot file, including kernel, boot configuration

/root//admin Root home directory

/home//Store all ordinary users ' homes (not the home directory of ordinary users, is stored)

Partition representation

HD, indicating IDE device

SD, indicating SCSI device

/dev/sda5


4, RHEL7 basic Operation

4.1 Linux Commands

– An instruction or program used to implement a certain type of function

– Execution of the command depends on the interpreter (default interpreter:/bin/bash)

Poweroff----> Interpreter (Shell)--------> Kernel--------> Hardware

After the installation of the RHEL7 system is completed, the initial setup is required for the first boot.

When prompted to view protocol information or create a user, enter 1 and return.

Next enter 2 and enter to indicate acceptance of the license agreement.

Input two times C means continue, press ENTER will enter the Welcome screen.

? Virtual Console Toggle (Ctrl + Alt + Fn key combination)

–tty1: Graphical Desktop

–TTY2~TTY6: Character Console

? Meaning of the command-line prompt identification

–[Current user @ Host name Current Location]$

– If the current user is root, the last character is #

[[Email protected] Desktop]#

– Otherwise, the last character is $

[[Email protected] Desktop]$


Ls-list

– Format: ls [options] ... [directory or filename] ...

-all//Show details of all lists

-A//all files, including hidden files (files starting with.) also include. These two files

-L//Display the current list in long bytes

-A//display with. All files beginning with, not including. These two files

-d//Display the property itself instead of the content

-h//show file size

? Shortcut

Ctrl+u empty to First line

Ctrl+k empty the cursor after the

Ctrl+l Clear Screen (the new input line is not clear)

Ctrl+w Empty the word

CTRL + C Stop this place

? Instructions for viewing a text file: Cat

-a-b-e-n-t-v

? Viewing the system version

[[email protected] desktop] #cat/etc/redhat-release

Red Hat Enterprise Linux Server Release 7.2 (MAIPO)

[[email protected] Desktop]#lsb_release-d #yum-y install REDHAT-LSB

Red Hat Enterprise Linux Server Release 7.2 (MAIPO)

[[Email protected] Desktop]#uname-a //view kernel details

[[email protected] desktop] #uname-r//view kernel version

3.10.0-327.el7.x86_64

[[Email protected] Desktop]#uname-m //View the number of system bits

[email protected] Desktop]#ifconfig #用于显示 or configure a command for a network device (network interface card)

[Email protected] Desktop]# hostname #查看当前主机名

The TAC is displayed backwards from the last line, and you can see that the TAC is the backward write of cat!
NL display, the output line number!
More page-by-page display file contents
Less is similar to more, but better than more, he can page forward!
Head's just a few lines.
Tail only look at the tail a few lines
OD reads the contents of the file in a binary way!

View Text file contents

Cat: Small File

Less: Large files Press Q to exit

View text File part content

Head-3/etc/passwd #显示头多少行

Tail-4/etc/passwd #显示尾多少行

LESS/ETC/PASSWD #按键盘上下键, can be scrolled

more/etc/passwd

4.2 File Color Meaning:

Blue: Directory

Black: Text File

Red: Compress Package

Green: Programs that can be executed

White: General files, such as text, configuration files, source files

Light blue: Link File/Shortcut

Flashing red: There is a problem with the linked file

XXX: Device files

Grey: Other Files


? List CPU Processor information

[[Email protected] Desktop]# LSCPU

Cat/proc/cpuinfo//View CPU Information

? Check memory size, idle condition

Cat/proc/meminfo//View memory information

mkdir (make directory) #创建文件夹

RmDir//Delete an empty directory

Mount Umount//Mount

View and switch directories

? Pwd-print Working Directory

– Purpose: View current working directory

? Cd-change Directory

– Purpose: Switch working directory

– Format: CD [Destination folder location]

~user: Represents the user's home directory

How to quickly access user Lisi's home directory CD ~lisi

[Email protected] Desktop]# pwd #显示当前所在位置

[Email protected] Desktop]# cd/#切换路径

[Email protected]/]# pwd #显示当前所在位置

[[email protected]/]# ls/root #查看/root Directory contents

[Email protected]/]# Ls/root/boot

Output information hint: command not found

Reason:

1. Wrong order

2. The command is not installed


Command-Complete format

Command Word option parameter

Cat-n/etc/passwd

.. Represents the parent directory

[Email protected]/]# CD.

Absolute path with/start

Relative path with current reference (no/start path)

[Email protected]/]# Cd/etc/pki

[Email protected] pki]# Cd/etc/pki/ca #绝对路径

[Email protected] ca]# pwd

[Email protected] ca]# CD.

[Email protected] pki]# CD CA #相对路径

[Email protected] ca]# pwd

[Email protected]/]# cat-n/etc/redhat-release

[Email protected]/]# cat-n/etc/passwd

4.3 Temporarily set the IP address

[[Email protected] Desktop]# ifconfig

[Email protected] Desktop]# ifconfig eth0 #查看eth0的IP

[Email protected] Desktop]# ifconfig eth0 192.168.1.168 #临时更改

[Email protected] Desktop]# ifconfig eth0 #查看eth0的IP

? Shutdown: Poweroff

[Email protected] ~]# Poweroff

? Restart: reboot

[email protected] ~]# reboot

Shutdown:

Shutdown

Shutdown-h now

Poweroff

Halt

Init0

Restart:

Reboot

Init6

Shutdown-r now


First knowledge of Linux (I.)

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.