Shell and VI Editor

Source: Internet
Author: User

1.1 What is a shell?

in computer science, Shell commonly known as Shell , used to distinguish from Kernel ( nucleus ), refers to the "User interface " software ( command parser ). It is similar to DOS command and later cmd.exe. It receives the user command and then invokes the appropriate application .

1.2 Shell Classification

1, graphical interface Shell: By providing a friendly visual interface, call the appropriate application, such as the Windows Series operating system,Linux graphical applications on the system GNOME, KDE, etc.

2.command line Shell: Invoke the appropriate application, such as the Cmd.exe of the Windows system , by typing a specific command through the keyboard ,Windows PowerShell,Linux system Bourne Shell (SH), Bourne Again Shell (bash), and more.

1.3 know bash, the Shell .

using bashunder the Window Systemrequires a software that simulates most of the commands that integrate bash .

1.bash command format

Command  [-options] [ parameter ] , such as: Tar zxvf demo.tar.gz

View Help: Command --help

2.bash common commands

PWD (Print working directory) View current directory

CD (change directory) to switch directories, such as cd/etc

LS (list) View the contents of the current directory, such as Ls-al

mkdir (make directory) to create a directory, such as mkdir blog

Touch create files, such as touch index.html

Cat View the full contents of the file, such as cat index.html

More/less viewing files, such as more/etc/passwd,less/etc/passwd

RM (remove) delete files, such as rm index.html,RM-RF Blog

RmDir (remove Directory) to delete folders, only empty folders, not commonly used

MV (move) moves files or renames, such as mv index.html./demo/index.html

CP (copy) copy files,cp index.html./demo/index.html

Head View the first few lines of the file, such as head-5 index.html

Tail View files after a few lines –n–f, such as tail index.html,tail-f-N 5 index.html

tab Auto-complete, double-click to display all matches two times

History View Operation

> and >> redirection , such as echo Hello world! > readme.md,> overwrite >> Append

wget downloads, such as wget https://nodejs.org/dist/v4.4.0/node-v4.4.0.tar.gz

Tar decompression, such as tar zxvf node-v4.4.0.tar.gz

Curl network requests, such as Curl http://www.baidu.com

WhoAmI View Current user

| pipe breaks can be used to connect multiple commands, and the last (command) execution results as arguments for the next (command).

grep matches content, typically combined with pipe breaks

1.1 VI Editor

as Notepad under Windows,vi Editor is The standard under Linux, through which we can create and edit files. It is a text editing software that is installed with the system .

1, three modes

The VI Editor provides 3 modes , namely command mode, insert mode, and bottom line mode, which can be performed differently by the user in each mode.

2. Using vi editor

A) open / create file, VI file path

b) Bottom-line mode: W save,: w filenme save as

c) Bottom-line mode: Q exit

d) Bottom-line mode: Wq save and exit

e) Bottom-line mode: e! undo changes and return to the last saved state

f) Bottom-line mode: q! do not save forced exits

g) Bottom line mode: Set Nu sets line number

h) Command mode ZZ(uppercase) Save and exit

i) Command mode u switch operation, can be used multiple times

j) Command mode DD Delete current line

k) Command mode yy copy current line

L) Command mode p paste content

m) Command mode ctrl+f page forward

n) Command mode ctrl+b page Backward

o) Command mode i enter edit mode, insert at current cursor

P) Command mode a enters edit mode, after the current cursor is inserted

Q) Command mode A enters edit mode and the cursor moves to the end of the line

r) Command mode o into edit mode, insert new row below current line

s) Command mode O Enter edit mode, insert new row above current line

When we are in edit mode, it is similar to our use of the Windows editor.

Shell and VI Editor

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.