LINUX的常用指令Word文档下载推荐.docx
《LINUX的常用指令Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《LINUX的常用指令Word文档下载推荐.docx(18页珍藏版)》请在冰豆网上搜索。
![LINUX的常用指令Word文档下载推荐.docx](https://file1.bdocx.com/fileroot1/2023-1/1/361e1c5e-80ea-4a3c-91e8-923747036835/361e1c5e-80ea-4a3c-91e8-9237470368351.gif)
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
Alt>
F1>
Switchtothefirsttextterminal.UnderLinuxyoucanhaveseveral(6instandardsetup)terminalsopenedatthesametime.
Fn>
(n=1..6)
Switchtothenthtextterminal.
tty
Printthenameoftheterminalinwhichyouaretypingthiscommand.
F7>
SwitchtothefirstGUIterminal(ifX-windowsisrunningonthisterminal).
(n=7..12)
SwitchtothenthGUIterminal(ifaGUIterminalisrunningonscreenn-1).Ondefault,nothingisrunningonterminals
8to12,butyoucanrunanotherserverthere.
(Inatextterminal)Autocompletethecommand
ifthereisonlyoneoption,orelseshowalltheavailableoptions.
THISSHORTCUTISGREAT!
ItevenworksatLILOprompt!
ArrowUp>
Scrollandeditthecommandhistory.Press<
Enter>
toexecute.
Shift>
PgUp>
Scrollterminaloutputup.Workalsoattheloginprompt,soyoucanscrollthroughyourbootupmessages.
PgDown>
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.
BkSpc>
(inX-windows)KillthecurrentX-windowsserver.UseiftheX-windowsservercrushesandcannotbeexitednormally.
Del>
Shutdownthesystemandreboot.Thisisthenormalshutdowncommandforauseratthetext-modeconsole.Don'
tjustpressthe"
reset"
buttonforshutdown!
c
Killthecurrentprocess(mostlyinthetextmodeforsmallapplications).
d
Logoutfromthecurrentterminal.
Seealsothenextcommand.
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.
MiddleMouseButton>
Pastethetextwhichiscurrentlyhighlightedsomewhereelse.Thisisthenormal"
copy-paste"
operationinLinux.
(Itdoesn'
tworkwithNetscapeandWordPerfectwhichusetheMSWindows-style"
.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"
)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"
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
Listthecontentofthecurrentdirect