Shell learning Summary (1)

Source: Internet
Author: User
Tags ssh account
    1. Echo $ shell: display the default shell
    2. Echo $ bash_version: displays the bash shell version.
    3. Apt-Get update: Update suite Indexes
    4. Apt-Get install Bash: Update bash
    5. Host Logon method:

Ssh-l account host name or IP address

Example: SSH-l John 192.168.1.2

SSH account @ host name or IP address

Example: SSH john@192.168.1.2

SSH host name or IP address

SSH 192.168.1.2

      1. Unregister a host

Execute exit or press Ctrl + D.

      1. Unix-like operating system, file classification and itsCode:

Code

File Type

-

General Files

D (directory)

Directory

L (Link)

Symbolic Link file

B (Block)

Disk Device Files

C (character)

Character Device File

S (socket)

Socket File

P (PIPE)

Connection File

6. absolute path: the first character of the directory is/

Relative Path: the first character of the directory is not/

7. File Permission settings

Chmod A + X test. Sh adds executable permissions to three identities

U + x g + x O + X Add executable permissions to the file owner, group identity, and others, respectively,

U, G, and O represent users, groups, and others respectively.

8. wildcard characters:

*: Represents any string, which can be a null string.

? : Represents a character, but cannot be blank

9. escape characters

Remove special characters: A. Use a pair of single quotes to enclose special characters or the entire string

B. Use escape characters

Example: Echo 9 '* '9 = 81 echo '9*9 = 81' or Echo 9 \ * 9 = 81

Single quotation marks appear in the string. escape characters are used to remove the exclusive pair of single quotation marks, double quotation marks are used instead, or concatenation is used.

For example, Echo Jack \'s book or ECHO "Jack's Book" or ECHO 'jack' \'s book'

10. Continued Line Characters

\ A newline character is connected, that is, the upper and lower rows are regarded as one line.

Echo "Row 1 \

Row 1 too"

Result: Row 1 row 1 too

11. Character Set combination

Character Set combination is a character in the character range listed in []. The length is 1 .[! ABC] indicates one of the three non-ABC

12. bracket Extension

The extension symbol of parentheses is {}, which is used to combine strings. For example, {a, B, c} c Represents: AC, BC, and CC.

13. files enabled by default:

Standard input (stdin), file code is 0

Standard output (stdout), the file code is 1

Standard Error (stderr), file code is 2

14. Standard Input/Output redirection

Turn to output:> example: Echo 'Hello world! '> Hi.txt. When hi.txt exists, its content is cleared.

To attach:> example: Echo 'Hello world too! '> Hi.txt is not cleared when it exists. The output text is appended to the end of the file.

Redirection input: WC-L

Used for conversion input and conversion output: Sort <unsort.txt> sort.txt: In this example, the unsort.txt file is input to sort.txt.

15. MPS queue

Usage:

Basic Type: command 1 | command 2

For example, cat unsort.txt | sort: displays unsort.txt and submits it to sort for sorting by pipelines.

You can also store the results, such as CAT unsort.txt | sort> sort.txt.

Combination of multiple pipelines: command 1 | command 2 |... | Command n

16. front-end and back-end work

Foreground work: After executing a command, you can obtain control of the keyboard to execute the next command.

Background work: The work is discarded to the background for processing. before the work is completed, the manager still has the control of the keyboard to execute the next instruction.

For example,. Build/envsetup. Sh &: & indicates that build/envsetup. Sh is thrown to the background for work.

The system displays the process number, for example, [1] 11973,

After the build/envsetup is executed, the system displays: [1] + done. Build/envsetup. Sh

17. ShellProgramStructure: variable definition, built-in commands, shell syntax structure, functions, and other command line programs

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.