Linux常用命令列表.docx

上传人:b****1 文档编号:590210 上传时间:2023-04-29 格式:DOCX 页数:24 大小:30.03KB
下载 相关 举报
Linux常用命令列表.docx_第1页
第1页 / 共24页
Linux常用命令列表.docx_第2页
第2页 / 共24页
Linux常用命令列表.docx_第3页
第3页 / 共24页
Linux常用命令列表.docx_第4页
第4页 / 共24页
Linux常用命令列表.docx_第5页
第5页 / 共24页
Linux常用命令列表.docx_第6页
第6页 / 共24页
Linux常用命令列表.docx_第7页
第7页 / 共24页
Linux常用命令列表.docx_第8页
第8页 / 共24页
Linux常用命令列表.docx_第9页
第9页 / 共24页
Linux常用命令列表.docx_第10页
第10页 / 共24页
Linux常用命令列表.docx_第11页
第11页 / 共24页
Linux常用命令列表.docx_第12页
第12页 / 共24页
Linux常用命令列表.docx_第13页
第13页 / 共24页
Linux常用命令列表.docx_第14页
第14页 / 共24页
Linux常用命令列表.docx_第15页
第15页 / 共24页
Linux常用命令列表.docx_第16页
第16页 / 共24页
Linux常用命令列表.docx_第17页
第17页 / 共24页
Linux常用命令列表.docx_第18页
第18页 / 共24页
Linux常用命令列表.docx_第19页
第19页 / 共24页
Linux常用命令列表.docx_第20页
第20页 / 共24页
亲,该文档总共24页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

Linux常用命令列表.docx

《Linux常用命令列表.docx》由会员分享,可在线阅读,更多相关《Linux常用命令列表.docx(24页珍藏版)》请在冰点文库上搜索。

Linux常用命令列表.docx

Linux常用命令列表

LinuxShortcutsandCommands:

LinuxNewbieAdministratorGuide

byStanandPeterKlimas

Thisisapracticalselectionofthecommandsweusemostoften.Presstoseethelistingofallavailablecommand(onyourPATH).Onmysmallhomesystem,itsaysthereare2595executablesonmyPATH. Manyofthese"commands"canbeaccessedfromyourfavouriteGUIfront-end(probablyKDEorGnome)byclickingontherightmenuorbutton.Theycanallberunfromthecommandline. ProgramsthatrequireGUIhavetoberunfromaterminalopenedunderaGUI.

Legend:

<>=singlespecialorfunctionkeyonthekeyboard.Forexampleindicatesthe"control"key.

italic=nameofthefileorvariableyouprobablywanttosubstitutewithyourown.

fixedwidth=in-lineLinuxcommandsandfilenames.

NotesfortheUNIXClueless:

1.LINUXISCASE-SENSITIVE.Forexample:

Netscape,NETSCAPEandnEtscapearethreedifferentcommands.Alsomy_filE,my_file,andmy_FILEarethreedifferentfiles.Youruserloginnameandpasswordarealsocasesensitive.(ThisgoeswiththetraditionofUNIXandthe"c"programminglanguagebeingcasesensitive.)

2.Filenamescanbeupto256characterslongandcancontainletters,numbers,"."(dot),"_"(underscore),"-"(dash),plussomeothernotrecommendedcharacters.

3.Fileswithnamesstartingwith"."arenormallynotshownbythels(list)ordircommands.Thinkofthesefilesas"hidden".Usels-a (listwiththeoption"all")toseethesefiles.

4."/"isanequivalenttoDOS"\"(rootdirectory,meaningtheparentofallotherdirectories).

5.UnderLinux,alldirectoriesappearunderasingledirectorytree(therearenoDOS-styledriveletters).

6.Inaconfigurationfile,alinestartingwith#isacomment.

7.1Linuxessentialshortcutsandsanitycommands

Switchtothefirsttextterminal.UnderLinuxyoucanhaveseveral(6instandardsetup)terminalsopenedatthesametime.

(n=1..6)

Switchtothenthtextterminal.

tty

Printthenameoftheterminalinwhichyouaretypingthiscommand.

SwitchtothefirstGUIterminal(ifX-windowsisrunningonthisterminal).

 (n=7..12)

SwitchtothenthGUIterminal(ifaGUIterminalisrunningonscreenn-1).Ondefault,nothingisrunningonterminals

8to12,butyoucanrunanotherserverthere.

 

(Inatextterminal)Autocompletethecommand ifthereisonlyoneoption,orelseshowalltheavailableoptions.

THISSHORTCUTISGREAT!

ItevenworksatLILOprompt!

 

Scrollandeditthecommandhistory.Presstoexecute.

 

Scrollterminaloutputup.Workalsoattheloginprompt,soyoucanscrollthroughyourbootupmessages.

 

Scrollterminaloutputdown.

 <+>

(inX-windows)ChangetothenextX-serverresolution(ifyousetuptheX-servertomorethanoneresolution).FormultipleresolutionsonmystandardSVGAcard/monitor,Ihavethefollowinglineinthefile/etc/X11/XF86Config(thefirstresolutionstartsondefault,thelargestdeterminesthesizeofthe"virtualscreen"):

Modes"1024x768""800x600""640x480""512x384""480x300""400x300""1152x864"

<->

(inX-windows)ChangetothepreviousX-serverresolution.

(inX-windows)KillthecurrentX-windowsserver.UseiftheX-windowsservercrushesandcannotbeexitednormally.

Shutdownthesystemandreboot.Thisisthenormalshutdowncommandforauseratthetext-modeconsole.Don'tjustpressthe"reset"buttonforshutdown!

c

Killthecurrentprocess(mostlyinthetextmodeforsmallapplications).

d

Logoutfromthecurrentterminal. Seealsothenextcommand.

d

Send[End-of-File]tothecurrentprocess.Don'tpressittwiceelseyoualsologout(seethepreviouscommand).

s

Stopthetransfertotheterminal.

q

Resumethetransfertotheterminal.Tryifyourterminalmysteriouslystopsresponding.

z

Sendthecurrentprocesstothebackground.

exit

Logout.Icanalsouselogoutforthesameeffect. (Ifyouhavestartedasecondshell,e.g.,usingbashthesecondshellwillbeexitedandyouwillbebackinthefirstshell,notloggedout.)

reset

Restoreascrewed-upterminal(aterminalshowingfunnycharacters)todefaultsetting.Useifyoutriedto"cat"abinaryfile.Youmaynotbeabletoseethecommandasyoutypeit.

Pastethetextwhichiscurrentlyhighlightedsomewhereelse.Thisisthenormal"copy-paste"operationinLinux. (Itdoesn'tworkwithNetscapeandWordPerfectwhichusetheMSWindows-style"copy-paste".Itdoesworkinthetextterminalifyouenabled"gpm"serviceusing"setup".)BestusedwithaLinux-ready3-buttonmouse(Logitechorsimilar)orelseset"3-mousebuttonemulation").

~

(tilde)Myhomedirectory(normallythedirectory/home/my_login_name).Forexample,thecommandcd~/my_dirwillchangemyworking directorytothesubdirectory"my_dir"undermyhomedirectory. Typingjust"cd"aloneisanequivalentofthecommand"cd~".

.

(dot)Currentdirectory.Forexample,./my_programwillattempttoexecutethefile"my_program"locatedinyourcurrentworkingdirectory.

..

(twodots)Directoryparenttothecurrentone.Forexample,thecommandcd..willchangemycurrentworkingdirectoryoneonelevelup.

7.2CommonLinuxcommands--systeminfo

pwd

Printworkingdirectory,i.e.,displaythenameofmycurrentdirectoryonthescreen.

hostname

Printthenameofthelocalhost(themachineonwhichyouareworking).Usenetconf(asroot)tochangethenameofthemachine.

whoami

Printmyloginname.

idusername

Printuserid(uid)andhis/hergroupid(gid),effectiveid(ifdifferentthantherealid)andthesupplementarygroups.

date

Printorchangetheoperatingsystemdateandtime.E.g.,Icouldchangethedateandtimeto2000-12-3123:

57usingthiscommand:

date123123572000

Tosetthehardware(BIOS)clockfromthesystem(Linux)clock,usethecommand(asroot)setclock

time

Determinetheamountoftimethatittakesforaprocesstocomplete+otherinfo.Don'tconfuseitwiththedatecommand.E.g.Icanfindouthowlongittakestodisplayadirectorycontentusing:

timels

who

Determinetheusersloggedonthemachine.

rwho-a

(=remotewho)Determineallusersloggedonyournetwork.Therwhoservicemustbeenabledforthiscommandtorun.Ifitisn't,runsetupasroottoenable"rwho".

fingeruser_name

Systeminfoaboutauser.Try:

fingerroot

last

Showlistingofuserslastlogged-inonyoursystem.

history|more

Showthelast(1000orso)commandsexecutedfromthecommandlineonthecurrentaccount.The"|more"causesthedisplaytostopaftereachscreenful.

uptime

Showtheamountoftimesincethelastreboot.

ps

(=printstatus)Listtheprocessescurrentlyrunbythecurrentuser.

psaxu|more

Listalltheprocessescurrentlyrunning,eventhosewithoutthecontrollingterminal,togetherwiththenameoftheuserthatownseachprocess.

top

Keeplistingthecurrentlyrunningprocesses,sortedbycpuusage(topusersfirst).InKDE,youcangetGUI-basedKtopfrom"K"menuunder"System"-"TaskManager"(orbyexecuting"ktop"inanX-terminal).

uname-a

(=Unixnamewithoption"all")Infoonyour(local)server.Icanalsouseguname(inX-windowterminal)todisplaytheinfomorenicely.

free

Memoryinfo(inkilobytes).

df-h

(=diskfree)Printdiskinfoaboutallthefilesystems(inhuman-readableform)

du/-bh|more

(=diskusage)Printdetaileddiskusageforeachsubdirectorystartingatthe"/"(root)directory(inhumanlegibleform).

cat/proc/cpuinfo

Cpuinfo--itshowthecontentofthefilecpuinfo.Notethatthefilesinthe/procdirectoryarenotrealfiles--theyarehookstolookatinformationavailabletothekernel.

cat/proc/interrupts

Listtheinterruptsinuse.

cat/proc/version

Linuxversionandotherinfo

cat/proc/filesystems

Showthetypesoffilesystemscurrentlyinuse.

cat/etc/printcap

Showthesetupofprinters.

lsmod

(Asroot.Use/sbin/lsmodtoexecutethiscommandwhenyouareanon-rootuser.)Showthekernelmodulescurrentlyloaded.

set|more

Showthecurrentuserenvironment.

echo$PATH

Showthecontentoftheenvironmentvariable"PATH".Thiscommandcanbeusedtoshowotherenvironmentvariablesaswell.Use"set"toseethefullenvironment.

dmesg|less

Printkernelmessages(thecontentoftheso-calledkernelringbuffer).Press"q"toquit"less".Useless/var/log/dmesg toseewhat"dmesg"dumpedintothisfilerightafterthelastsystembootup.

 

7.3Basicoperations

any_command--help|more

Displayabriefhelponacommand(workswithmostcommands)."--help"workssimilartoDOS"/h"switch.The"more"pipeisneedediftheoutputislongerthanonescreen.

mantopic

Displaythecontentsofthesystemmanualpages(help)onthetopic.Trymanmanfirst.Press"q"toquittheviewer.Thecommandinfotopicworkssimilarandmaycontainmoreup-to-dateinformation.Manualpagescanbehardtoread.Tryany_command--helpforshort,easytodigesthelponacommand.Ifmoreinfoneeded,havealooktothedirectory/usr/doc.Todisplaymanualpagefromaspecificsection,Imayusesomethinglikeinthisexample:

 man3exit(thisdisplaysaninfoonthecommandexitfromsection3ofthemanualpages).

apropostopic

Givemethelistofthecommandsthathavesomethingtotodowithmytopic.

helpcommand

Displaybriefinfoonabash(shell)build-incommand.

ls

Listthecontentofthecurrentdirectory.UnderLinux,thecommand"d

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2