Linux study notes: Understanding SHELL

Source: Internet
Author: User
Alias displays all current command aliases aliaslm & quot; ls-al & quot; command alias unaliaslm cancel command alias type similar to whichexprot setting or display environment variable exprot alias show all current command alias lm = "ls-al" command alias unalias lm cancel command alias type similar to whichexprot set or display the environment variable exprot PATH = "$ PATH ": /sbin add/sbin in PATH echo $ PATH display PATH bash enter subroutine name = yang set variable unset name cancel variable echo $ name display variable content myname = "$ name its me "& myname = '$ name its Me' $ variable content missing $ name in single quotes ciw =/etc/sysconfig/network-scripts/set path env to list all environment variables Echo $ RANDOM: Display the randomly generated number set. set SHELLPS1 = '[u @ h w A ##] $'. set the prompt character. [root @ linux ~] # Read [-pt] variable ----------- read the variable parameter input by the keyboard:-p: the rear can receive a prompt character! -T: The number of seconds that the backend can wait !』 Declare declares the shell variable ulimit-a to display all restrictions. ls/tmp/yang & echo "exist" | echo "not exist" means, after ls/tmp/yang is executed, if it is correct, execute echo "exist". if there is a problem, execute echo "not exist" echo $ PATH | cut-D ': '-f 5 uses the separator, read 5th-segment content export | cut-c 10-20 read 10th-20 bytes of content last | grep 'root' search for a row with root, add [-v] to reverse search cat/etc/passwd | sort display cat/etc/passwd | wc display "line, word count, number of bytes 』 Regular representation[Root @ test root] # grep [-acinv] 'search for the string' filename Parameter description:-A: Search for binary files using text files.-c: count the number of times that the 'searchstring' is found.-I: The Case sensitivity is ignored. Therefore, the case sensitivity is the same.-n: by the way, the output line number-v is selected in reverse direction, that is, the line without the 'searchstring' content is displayed! Grep-n '123.txt search the character search the specific string grep-n' t [ea] st'123.txt search test or taste use [] to search for the set character grep-n '[^ g] oo' 123.txt select [^] grep-n '[0-9] '123.txt search for numbers with 0-9 grep-n' ^ the '123.txt search start with the row and start with the search ^ grep-n' ^ [^ a-zA-Z] '123.txt search does not start with a letter grep-n '[ a-z] $ '123.txt search for the end of a-z line search $ grep-n' g .. d' 123.txt: search for 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 scanning and processing language nl 123.txt | sed' 2, 5d 'delete content from the second to fifth rows diff compare file difference cmp compare two files difference patch file pr to print file formatting
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: 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.