Getting Started with Linux basics

Source: Internet
Author: User
Tags clear screen echo command locale

From a 0-based rookie of mine, slowly touching the Linux operating system

Some basic small commands:

Normal user switch root command:

su-

Password: ************

Install the interface into the graphical interface command: StartX &

Setting the locale: Local

Localectl-h

Localectl List-locales

English: Zh_cn.utf8

Localectl Set-locale Lang=zh_cn.utf8

Make sure the firewall is turned off: Iptables-l-N

CentOS 7:systemctl Disable Firewalld.service temporarily disable firewall

: Systemctl stop Firewalld.service Permanently shuts down the firewall


CentOS 6:service iptables Stop temporarily disable firewall

: Chkconfig iptables off permanently shuts down the firewall

Virtual Terminal: Ctrl+alt+f{1-6}

Graphics Terminal: CentOS 6:ctrl+alt+f7

CentOS 7: Which virtual terminal is launched at that virtual terminal

Physical Terminal:/dev/console

Virtual Terminal:/dev/tty[1-6]

Serial terminal:/dev/ttys[1-6]

Pseudo Terminal:/dev/pts/[1-6]

View End devices: TTY

Viewing interface programs: Echo $SHELL echo Echoes

Start GUI: Run command on a virtual Terminal interface: STARTX $

CLI Interface: Command line interface: [[email protected] ~]# command

Root: currently logged in user

Makang: Host name of the current host, not in full format. The full format here is: Makangbo

~: The directory where the user is currently located (current Directoru), also known as the Working directory (working directory)

#: Command Prompt

#: Administrator account, root, with the highest privileges, able to perform all operations

$: Normal user, non-root user, no administrative rights, cannot perform system management class operation

Note: It is recommended to log in with a non-admin account;

The executive administrator temporarily switches to the administrator and returns when the operation is complete

Configure IP:

Vim/etc/sysconfig/network-scripts/ifcfg-erh0


Temporarily modify host name: hostname ****** effective command: Bash


Shortcut keys:

Ctrl+f1 graphical interface 2-6 character interface

CHVT: Switch terminal commands, for example chvt1-6

Hostnam: View current host name

Lsb_release-a viewing the current system version

Cat/etc/issue Login Prompt language information

LSCPU viewing CPUs

Nuame-r View Kernel version Unix

Who am I view and user groups

INIT3 Closing the graphical interface

Systemctl Poweroff CentOS 7 shutdown

Systenctl reboot Restart command

Poweroff General Command shutdown

Reboot Universal Restart

Halt shut down the machine

TTY View current terminal equipment

Ifconfig or IP Addr List view the IP address of the active interface

Echo Echoes

Ping probes the connectivity between the target host of the network and the current host

CTRL + C terminating command execution

History Management Command Histories

Clear Clear Screen


Terminal Terminal Equipment Console Console

Physical Terminal: Direct access to the local display and keyboard equipment/dev/console


Shell Translator

The shell is the user interface of the Linux system and provides an interface for users to interact with the kernel. It receives the command entered by the user and feeds it into the kernel to execute.

The shell is also known as the Linux command interpreter (interpreter)

Shell is a high-level programming language

CLI command line Shell Common Bash

Cat/etc/shells shows all shell types supported by the current system

Echo $SHELL shows the SHELL currently in use


[[email protected] ~]# echo $PS 1 View variables

[\[email protected]\h \w]\$


There are two types of commands that can be executed in the shell:

Internal command: The shell comes with, and the Enable Divas can be enabled or disabled by a command

External command: There is a corresponding executable program file under a file system path of the current system; Which,whereis

Type * * * * distinguish the command currently in use as an internal or external command

Hash view external command path cache displays the number of command executions clear cache Hash-r

ENABLE-N * * * * For example: cd disable internal command

Enable CD to open the Forbidden command

which * * * * can only view external command paths

Alias ****=**** View alias command information

Unalias Deleting aliases

Whereis viewing programs and help document paths


Command + options + parameters


Date and time displayed

Two clocks: by the Linux kernel through the CPU's operating frequency


Clock Display hardware clocks

-S,--hctosys to calibrate the system clock, whichever is the hardware clock

-W,--SYSTOHC with system always, correct hardware clock

Cal Display Calendar view which year which month the way Cal 2 2016 view 2016 February

Nano Text Editor


Small entertainment in the graphical interface: appear small fish alt+f2 input Free the fish


Open NEW: Screen create user screen-s MKB join user screen-x MKB

Exit and Close: Exit

Stripping Current: Ctrl+a,d

Show all open: Screen-ls

Restore a: screen-r [session]


echo command

Function: Display characters

Syntax: Echo [-nee][string]

Description: Echo will send the input and exit strings to standard output. The output string is separated by a blank character, and a newline number is added at the end

Ceho "$VAR _name": Variables are replaced, double quotes indicate weak references

Echo ' $VAR _name ': variable does not replace, strong reference

$echo-E "file Name:\c"

Echo needs to use the-e parameter to print escape characters


echo Command options:

-N does not wrap characters at the end of the line

-E If the following character appears in the string, it is handled in particular, not as a general text output:

\a issued a warning sound;

\b Backspace key

\c finally not add the line break symbol;

\ n Wraps and the cursor moves to the beginning of the line;

\ r The cursor moves to the beginning of the line, but does not wrap;

\ t Insert tab;

\ \ insert \ character;

\onnn Insert nnn (octal) represents the ASCII character echo-e "\033[43;31mred Color\033[om"

\XHH Insert the ASCII represented by HH (hex)


command-line extensions, enclosed collections

command-line Extension: $ () or ' '

Print the output of a command to the soul parameters of a command

$ echo "*****$ (hostname)"

$ echo "I am ' whoami '"

Bracket extension: {}

Print a simplified form of a repeating string

Echo file{1,3,5}

File1 File3 File5

Rm-f file{1,3,5}


Tab

Command completion

Internal command:

External command: Bash defines the path according to the paths environment variable, from left to right in each

The path searches for a file named after the given command, which is the command to be executed the first time it is found

The user-given string has only one unique command, which is directly complementary otherwise, the tab will give the list

Path Completion:

Takes the user-given string as the beginning of the path and searches for the file name at the beginning of the specified string, under its specified ancestor directory

If only: the direct complement

Otherwise: tab to the list again


Reset command Line interface

Touch "file name" to create a file


Centos7:mandb Creating a Help database

Centos6:makewhatis Creating a Help database


Novice summary, Feel good chaos, forgive 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0057.gif "alt=" J_0057.gif "/>

Brother Pony

This article is from the "Linux Operating System" blog, reproduced please contact the author!

Getting Started with Linux basics

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.