麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 系統(tǒng) > Unix > 正文

UNIX常用命令

2024-06-28 13:23:19
字體:
供稿:網(wǎng)友
UNIX常用命令

UNIX常用命令

UnixDevelopmentEnvironment

lTheBasicKnowleage

lTheGeneralCommand

lUnixShell

lMakeFile

TheBasicKnowledge

Unix/linuxsystemsaremulti-userandmulti-tasking

lHavemultipleusersonthesamesystem

lRunmultiplePRograms,seeminglysimultaneously

lMaintainpermissionsthatdeterminewhichusershaveaccesstowhickfilesandprograms

lRegulatetheamountofdiskspaceeachusercanuse

lStoreuser-specificsettingsin“hidden”file

LoggingIn

lWhenyoufirstconnecttooneoftheUnixcomputersyouwillseetheprompt:

lLogin:

Atthelogin:prompt,typeinyourusernamePassWord

Onceyouhavetypedinyourusernameyouwillbepromptedtotypeinyourpassword

InitializationFiles

WhenyoulogintheUnix/Linuxloginprogramfinally,startsupacommand“shell”

UsersdonotdealwiththeOperatingsystemdirectly.MostofyourinteractionwithaUnixsystemtakesplaceinashell,aprogramthatisruneverytimeyoulogin,anddisplaysthe“$”prompt.Theshellisknownascommandinterpreter,yougiveitcommands,anditrunsthem.

Shell

lSh

lBourneShell

lKsh

lKornShell

lCsh

lCshellbasedonClanguage

lBash

lBornAgainShell

lTcsh

lanotherversionofCshell

UsingtheSystem

Finallyyouareloggedin!Youwillseeapromptlikeoneofthefollowing:

$/#

Justwaitingfoyoutotypesomething.Wewilluser$toindicatethecomputer’s“ready”prompt.

Okey,let’stryasimplecommand.

ls

lsistheprogramtolistfilesinadirectory.Justplainlswon’tlisthiddenfiles(fileswhosenamesstartwith``.’’,like.login).Nowtrytyping:

ls-a

pwd(printworkingdirectory)

Tofindoutwhichdirectoryyouarein,type:

pwd

Thiswillshowyouthefullpathtoyourcurrentworkingdirectory,relativetotherootdirectory(/).

Rm(removefilesordirectories)

Thecommandrmfilewillremovethespecifiedfile.

Someusefuloptionsforrminclude

rm-i(interactivemode-youwillbepromptedtocomfirmfiledeletion)

rm-f(forceremove-overridesinteractivemodeandremovesfilewithoutaprompt)

rm-r(recursive-removethecontentsofdirectoriesrecursively)

cp(copyfilesanddirectories)

Tocopyafile,do:

cpoldfilenamenewfilename

Ortocopyafiletoanewdirectory,whilekeepingtheoldfilenamedo:

cpfilename/directoryname/

Toensureyourdon’toverwriteanyexistingfilesyoucanusethe‘-i’option:

cp-ioldfilenamenewfilename

Thiscommandwillpromptyoutoconfirmifthereisalreadyafilewiththenamenewfilename.

mv(movefiles)

Thiscommandallowsyoutorenameafileasin:

mvoldfilenamenewfilename

Ortomoveafiletoanewdirectory:

mvfilenamedirectoryname/

Aswithcp,itisagoodideatousethe‘-i’optionwithmv,soyoudon’tmistakenlyoverwriteyourexistingfiles.

Thespecialdirectory

Youmayhavenoticedwhenyoutypedls–athattherewerelistingsdot(.)anddot-dot(..).Theserepresentyourcurrentworkingdirectory(.)andit’sparentdirectory(..).

Forexample,typing

cd..

cd.

cp/vol/examples/tutorial/science.txt.

cd~willalwaysbringyoubacktoyourhomedirectory.

cd~/homeworkwillbringyoutothe‘homework’directory.

Thecharacter*iscalledawildcardandwillmatchagainstnoneofmorecharacter(s)inafileordirectoryname.

Forexample,ifyoutype

ls*h

Youshouldgetalistofallfilesanddirectoriesstartingwiththeletterh.

Similarlyifyoutype:

ls*.cpp

The?characterissimilartothe*character,exceptthat?willmatchexactlyonecharacter,Forexample:

ls?anwillmatch‘man’butnot‘stan’!

Displaythecontentsofafileonthescreen

clear(clearscreen)

Beforeyoustartthenextsection,youmayliketocleartheterminalwindowofthepreviouscommandssotheoutputofthefollowingcommandscanbeclearlyunderstood.

Attheprompt,type

clear

Thiswillclearalltextandleaveyouwiththe%promptatthetopofthewindow.

cat(concatenate)

Thecommandcatcanbeusedtodisplaythecontentsofafileonthescreen.Type:

catscience.txt

asyoucansee,thefileislongerthanthesizeofthewindow,soitscrollspastmakingitunreadable.

less

Thecommandlesswritesthecontentsofafilenotothescreenapageatatime,type:

lessscience.txt

Pressthe[space-bar]ifyouwanttoseeanotherpage,type[q]ifyouwanttoquitreading.

head

Theheadcommandwritesthefirsttenlinesofafiletothescreen.

Firstclearthescreenthentype

headscience.txt

tail

thetailcommandwritesthelasttenlinesofafiletothescreen.Clearthescreenandtype:

tailscience.txt

Searchingthecontentsofafile

Simplesearchingusingless

Usingless,youcansearchthoughatextfileforakeyword(pattern).Forexample,tosearchthroughscience.txtfortheword‘science’,type

lessscience.txt

Thenstillinless(i.e.don’tpress[q]toquit),typeaforwardslash[/]followedbythewordtosearch.

Asyoucansee,lessfindsandhighlightsthekeyword.Type[n]tosearchforthenextoccurrenceoftheword.

grep

  • Itsearchesfilesforspecifiedwordsorpatterns.Firstclearthescreen,thentype

    grepsciencescience.txt

    Asyoucansee,grephasprintedouteachlinecontainingthewordscience.

    Trytyping

    grepSciencescience.txt

    Thegrepcommandsiscasesensitive;ItdistinguishesbetweenScienceandscience.

    Toignoreupper/lowercasedistinctions,usethe-ioption,i.e.Type

    grep-isciencescience.txt

    TosearchforapharSEOrpattern,youmustencloseitinsinglequotes.Forexampletosearchforspinningtop.Type

    發(fā)表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發(fā)表
    主站蜘蛛池模板: 久久综合久久综合久久 | 蜜桃一本色道久久综合亚洲精品冫 | 亚洲最大久久 | 国产午夜精品一区二区三区不卡 | 超级av在线 | 国产精品一品二区三区四区18 | 美女视频在线观看黄 | 久久99精品久久久久久久久久久久 | 久久超| 成人在线视频免费 | 久草成人在线观看 | 18视频在线观看娇喘 | 中文字幕亚洲一区二区三区 | 大胆在线日本aⅴ免费视频 美国黄色毛片女人性生活片 | 夜夜夜精品视频 | 久色亚洲 | 成人毛片免费看 | 销魂美女一区二区 | 精品国产亚洲人成在线 | 国产精品7区 | 国产人成精品一区二区三 | 日韩精品二区 | 999久久国精品免费观看网站 | 一级精品 | 一本色道久久综合狠狠躁篇适合什么人看 | 美女被免费网站在线软件 | china对白普通话xxxx | 欧美在线观看视频一区 | 91短视频在线免费观看 | 欧美视屏一区二区 | 亚洲精品成人久久久 | 91成人影院 | 黄视频网址 | 91成人一区二区三区 | 午夜男人免费视频 | 国产精品久久久乱弄 | 国产91成人| 天天舔夜夜操 | 中文字幕欧美一区二区三区 | 99成人在线 | 久久艹国产精品 |