Linux Study Notes: Understanding SHELL

Source: Internet
Author: User

Alias displays all current command aliases alias lm = "ls-al" command aliases unalias lm cancelling command aliases

Type is similar to which

Exprot to set or display environment variables

Exprot PATH = "$ PATH":/sbin Add/sbin PATH

Echo $ PATH: Display PATH

Bash entry subroutine

Name = yang variable

Unset name cancel variable

Echo $ name: DISPLAY variable content

Myname = "$ name its me" & myname = '$ name its me' when the single quotation mark $ name loses the variable content

Ciw =/etc/sysconfig/network-scripts/set the path

Env: list all environment variables

Echo $ RANDOM

Set SHELL settings

PS1 = '[\ u @ \ h \ w \ A # \ #] \ $' specifies the prompt character

[Root @ linux ~] # Read [-pt] variable ----------- read the input variables on the keyboard

Parameters:

-P: the backend can be followed by a prompt character!

-T: the number of seconds that the backend can wait !』

Declare declares shell Variables

Ulimit-a displays all restrictions

Ls/tmp/yang & echo "exist" | echo "not exist"

This means that when ls/tmp/yang is executed, if it is correct, echo "exist" will be executed. If there is a problem, echo "not exist" will be executed"

Echo $ PATH | cut-d': '-f 5 uses the separator to read the content of section 5th.

Export | cut-c 10-20 read 10th-20 bytes

Last | grep 'root'

Cat/etc/passwd | sort display

Cat/etc/passwd | wc displays "lines, words, and bytes 』

Regular Representation

[Root @ test root] # grep [-acinv] 'search for the string' filename

Parameter description:

-A: Search for binary files using text files

-C: calculates the number of times the 'search string' is found.

-I: Case sensitivity is ignored, so the case sensitivity is the same.

-N: returns the row number by the way.

-V: reverse selection, that is, the line without the 'search string' content is displayed!

Grep-n '123.txt search for the character to search for a specific string

Grep-n't [ea] st'123.txt search for test or taste use [] to search for collection characters

Grep-n '[^ g] oo '123.txt search for oo orientation that is not prior to g [^]

Grep-n '[0-9] '123.txt search for numbers with 0-9

Grep-n '^ the '123.txt Search Start With the row' ^

Grep-n' ^ [^ a-zA-Z] '123.txt search does not start with an English letter

Grep-n '[a-z] $ '123.txt search end-to-end row search with a-z $

Grep-n 'G .. d' 123.txt search any character starting with g and ending with d.

Grep-n 'ooo * '123.txt search contains at least two oo repeated characters *

Sed text stream editor uses script commands to process text files

Awd mode scan and processing language

Nl 123.txt | sed '2, 5d 'Delete content from the second row to the fifth row

Differences between diff and files

Cmp compares two files

Patch file

Format the file to be printed by pr

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.