Linux Basic Command Notes (iii)

Source: Internet
Author: User

Summarize some Linux commands for easy memory and learning


Common command format for Linux commands

command word [options] [parameters]

Example: ls-l/etc


Several auxiliary operations for command line editing

Tab key: Auto-completing

Backslash "\": Force line break

Shortcut key ctrl+u: Empty to the beginning of the line

Shortcut key ctrl+k: Empty to end of line

Shortcut key ctrl+l: Clear Screen

Shortcut keys CTRL + C: cancel this command edit


Help commands (you can see the relevant usage and description of the command)

Commands to be viewed by Help (internal command)

Example: Help pwd

Command--help (external command)

Example: LS--help


Man help manual command

Man needs to see the commands for example: Man ls

Export the man Help manual to a text document to learn

Man Command | Col-b > Ysf.txt

Pipe: with "|" Indicates that the previous command result is the input object of the following command

REDIRECT output: Use ">" to save the previous command result to the file specified later

Cat command

Purpose: Displays the contents of the file


More commands

Usage: Full screen mode to display the contents of the file (display percentage), press "Enter" key, a line down; Press SPACEBAR, PAGE DOWN; press the B key to page up; press the Q key to exit and return to the original command environment.


Less command

Purpose: The same as the more command, but the extension function more, press "up and down" arrow key to Line; Press PAGE up and PAGE down key to page; Press "/" key to find content, n next content, n previous content


Head command

Purpose: View part of the beginning of the file (default is 10 lines)

-n Specifies how many rows need to be displayed (n is the exact number of rows)

Tail command

Purpose: View a small portion of the end of the file (default is 10 lines)

-n Specifies how many rows need to be displayed (n is the exact number of rows)


WC command

Purpose: Information such as the number of words in the statistics file (Word Count)

Option:-L: Count rows

-W: Count the number of words

-C: Statistics of bytes

Format: WC option destination File

grep command

Purpose: Finds and displays lines containing the specified string in the file, retrieves, filters the contents of the file

Common Command Options

-I: Ignore case when finding

-V: Reverse lookup, output rows that do not match the lookup criteria

Find conditional settings

The string to find is enclosed in double quotation marks.

"^init" means start with init, "ftp$" means end with FTP

"^$" indicates a blank line

Format: grep option to find a conditional target file

Example: Grep-v "^#"/etc/inittab


This article is from the "Yang Shufan" blog, make sure to keep this source http://yangshufan.blog.51cto.com/13004230/1945672

Linux Basic Command Notes (iii)

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.