您的位置:首页 > 运维架构 > Linux

Windows/Linux下的常用command资料收藏

2016-04-20 07:06 399 查看
HowtousetheWindowcommandline(DOS)

Basic:

CTRL+Cwillsendabreak(stopexecution)whennotextisselected

Help:

Helpcommand|more(pressenterforpagedown)

Command/?

http://www.computerhope.com/issues/ch000014.htm

Genneraloperation:
http://www.computerhope.com/issues/chusedos.htm
Search

http://www.computerhope.com/findstr.htm

-Findthefilesthatincludethekeywordinthegivenfiletypesincurrentandsubdirectories.

$findstr/S"keyword"*.txt

-Findthepathofagivendirectoryname

$dir<FolderName>/AD/s


-Findallfileswithsomecertainnameinthecurrentandsubdirectories

$dir*.txt/s

/P

Skipfileswithnon-printablecharacters.

/R

Usessearchstringsasregularexpressions.

/X

Printslinesthatmatch
exactly.

/M

Printsonlythefilenameifafilecontainsamatch.

/N

Printsthelinenumberbeforeeachlinethat
matches.

/I

Specifiesthatthesearchisnottobe
case-sensitive.

Regularexpressionquickreference:

.

Wildcard:anycharacter

*

Repeat:zeroormoreoccurrencesofpreviouscharacterorclass

^

Lineposition:beginningofline

$

Lineposition:endofline

[class]

Characterclass:anyonecharacterinset

[^class]

Inverseclass:anyonecharacternotinset

[x-z]

Range:anycharacterswithinthespecifiedrange

\x

Escape:literaluseofmetacharacterx

\<xyz

Wordposition:beginningofword

xyz\>

Wordposition:endofword

HowtousetheLinuxcommandline

General:

http://www.computerhope.com/issues/chshell.htm

Help:

Command–help|less(I,j,k…available)

Search

http://www.computerhope.com/findstr.htm

-Findthefilesthatincludethekeywordinthegivenfiletypesincurrentandsubdirectories.

grep-rnw
'/path/to/somewhere/'-e"pattern"
·-ror-Risrecursive,

·-nislinenumber,and

·-wstandsmatchthewholeword.

·-l(lower-caseL)canbeaddedtojustgivethefilenameofmatchingfiles.

·Alongwiththese,--excludeor--includeparametercould
beusedforefficientsearching.Somethinglikebelow:

·[code]grep-r-i--include\*.h--include\*.cppCP_Image~/path[12345]|mailx-sGREPemail@domain.com


-Findthepathofagivendirectoryname

$find.-name<foldername>-typed



-Findallfileswithsomecertainnameinthecurrentandsubdirectories

$find.-name<
file
name>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: