Tips for using Linux under Commands

Source: Internet
Author: User
Tags modifier

Entry indication
! Start a history substitution unless followed by a Space, tab line end, "=", or "("
!n Select command line n
!-n Select the backward n command (that is, the penultimate nth record n>0)
!! Previous command with!-1

!string Select the most recent command that starts with string
!? String? Select the command that recently contains the beginning of a string

^string1 ^string2 ^ after replacing string2 with Sting1, the previous command is executed repeatedly. With!!:s/string1/string2.

!# the entire command that is currently entered

!! Previous command
!!:^ gets the first parameter of the previous command the same! ^ and!! : 1
!!:$ gets the last parameter of the previous command with! $ and $_
!!:n gets the nth parameter of the previous command

!string:n gets the nth parameter of a command that has recently executed a string beginning with

History
CTRL + P previous command used (p=pervious)
CTRL + N next command to use (N=next)
CTRL + R Quick Search History

System-supplied historical command operations
Fc-s
History

Word Indication
0 is 0, the 0th Word. For most commands, it refers to the command name
n Nth Word
^ 1th parameter (Word)
$ last argument (word)
% recent%string% matching words
X-y Word range 0-y can write –y
* All the words except the 0th one 1-$
x* x-$ 's shorthand, with x*
If the entry indicator is not used with the word indicator, the previous item is used as an entry

Modifier
After the optional Word indicator, you can add one or more of the following modifier symbols, each with: start
H Remove the tail of the file name, leaving only the head
T remove the header of the file name, leaving only the tail
R Remove the end extension
E Remove all parts except the extension
P Print a new command without executing
Q references the replaced word for further substitution
X with Q, but also in spaces, tabs, line breaks where the words are separated
s/old/new/Replace the first old in the entry with the new one. /Can be any delimiter
& Repeat Last Replacement
g/a to make replacements execute throughout an item, with S
G One-time s-decoration for each word in the entry


This article from the "Linux and Network" blog, reproduced please contact the author!

Tips for using Linux under Commands

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.