Linux Learning Essay II

Source: Internet
Author: User
Tags echo command echo display

First, how to use the View Help document

Ii. differences between internal commands and external commands

Three, the study of several common basic commands

The command is divided into internal command and external command, internal command is shell command, external command is User command, ordinary user can use. Getting commands to use help is not the same, but it's important to note that internal commands show bash explanations when viewing help with man. The understanding of internal and external commands can be divided into chapters:

1. User command (/bin,/usr/bin,/usr/local/bin)

2. System call

3. Library Call

4. Special documents (equipment files)

5. File format (configuration file syntax)

6. Games

7. Miscellaneous (Miscellaneous)

8. Management Order (/sbin,/usr/sbin,/usr/local/sbin)

Tip: If the help document is garbled, you can perform export lang=en(character format) to process it, meaning that the language is set to English.

To view the help command:

Internal command:

Help Command (Specific commands)

External command:

Command--help(brief help information)

Command manual: Manual (Public command) man


Get man's own use Help:

Man Mans

Help document format and introduction information:

[] enclosed in brackets can be omitted (optional)

<> what must be given (not optional)

... You can use multiple

| Choose one More

{} grouping

name: Command name feature brief description

Synopsis: Usage notes, including available options

DESCRIPTION: A detailed description of the command function, which may include the meaning of each option

options: Explaining the meaning of each option

FILES: The configuration associated with this command

BUGS: Vulnerability

EXAMPLES: Using the example

See Also: Another reference

Flip Screen:

Turn back one screen: SPACE

Turn One screen forward: b

Turn back one line: ENTER

Turn One line forward: K

Find Features:

/KEYWORD from front to back (current position)

N Next

N previous One

? KEYWORD from back to forward (current position)

N Next

N previous One

Q exit

Q! Force exit

Help Documentation:info COMMAND (not much to add to man)

Cd/usr/share/doc Document Storage Path

Linux is powered on with two clocks: hardware clock and system clock, two can be the same, can also be different. Note: Date looks at the system time, not the hardware clock.

Second, date system time management

Example:date View current system time

Date 0226104913.30 was modified on February 26, 13 10:49:30

Date + "This yearly is%Y" displays the year

Date +%d

Date +%d

Date +%F

Date +%y-%m-%d

clock Hwclock hardware time management

Hwclock-w Sync to hardware time

Hwclock-s Synchronization to System time

Hwclock-r read time, r optional, add not add all can.

cal: calendars (Calendar)

Third,echo: Display text

General format: Echo [-n] String

where option n means that the output text is not wrapped, the string can be quoted, or it can be unquoted. When you output a quoted string with the Echo command, the string is output as it is, and when you output an unquoted string with the echo command, each word in the string is output as a string, separated by a space between the strings.

Syntax: Echo [-ne][string] or echo [--help][--version]

Additional note: Echo will send the input string to standard output. The output strings are separated by white space characters, and a newline number is added at the end.

Parameter:-n do not wrap in the last line

-E If the following characters appear in the string, they are handled in particular, not as a general

Text output:

\a issued a warning sound;

\b Delete the previous character;

\c finally not add the line break symbol;

\f the line but the cursor remains in its original position;

\ 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;

\v is the same as \f;

\ \ insert \ character;

\NNN inserts the ASCII character represented by the NNN (octal);

Help Display Help

–version displaying version information

The echo command for Linux is extremely common in shell programming and is often used when printing variable value under a terminal.

For example: Echo can be used as a display note for some batch commands that need to be commented to the user, such as the previous command execution will take a long time, often with echo display a message to let the user know this time is slow, a little wait.

In Linux, the echo command is used to display the date on the standard output, such as:

echo "The year was 2013,today is 26"

Echo-e "The year are, \ntoday is 26"

Escaping: Escaping

echo "The echo command!" >

/ will appear in this line without quotation marks. Append this line to the file.

iv.printf: Format and output results to standard output

Syntax printf (options) (parameters)

--help: Online Help;

--version: Displays version information.


Output format: Specifies the format of the data output;

Output string: Specifies the data to output.

Format alternates

The corresponding parameter of the%b is treated as a string containing the escape sequence to be processed.

%c ASCII character. Display the first character of a relative parameter

%d,%i decimal integer

%e,%e,%f floating-point format

%g%e or%f conversion, see which one is shorter, then delete the end of the 0

%G%e or%f conversion, see which one is shorter, then delete the end of the 0

%o Octal value with unsigned sign

%s string%u unsigned decimal value

%x hexadecimal value without sign, using a to F for 10 to 15

%x hexadecimal value without sign, using a to F for 10 to 15

Percent of literal meaning

Escape sequences

\a warning character, usually the bel character of ASCII

\b Back

\c suppresses (does not display) the newline character at any end of the output (only valid in the parameter string under the%B format designator control), and any characters left in the argument, any subsequent arguments, and any characters left in the format string are ignored

\f Page Change (formfeed

\ nthe line break

\ r Enter (carriage return)

\ t Horizontal tab

\v Vertical Tab

\ \ A literal backslash character

\DDD represents a 1 to 3-digit octal value character that is valid only in a format string

\0DDD represents 1 to 3-bit octal value characters

For example: printf "The year are, \ntoday is 26\n"

Linux Learning Essay II

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.