Introduction
UserID(useridentifier,UserIDorUID),thefullnameuseridentifier,inUNIX-likesystems,isanunsignedintegervalueusedbythekerneltoidentifyusers,anditisalsooneofthenecessarycomponentsoftheUNIXfilesystemandprocesses.Indifferentsystems,theUIDvaluerangeisdifferent,butgenerallyspeaking,UIDisrepresentedbya15-bitinteger,anditsrangeiswithin0~32767,andtherearethefollowingrestrictions:theUIDofthesuperuserisalways0;UIDswithvaluesintherangeof1to100arereservedforsystemuse.Somemanualsrecommendtoreserve101to499,oreven101to999(suchasDebian[1])UIDsforbackup;Correspondingly,whenthefirstuseriscreatedwiththeuseraddcommandinLinux,theUIDassignedtoitbydefaultis1000.
ThecurrentusernamereferstotheusernameoruserIDofthecomputercurrentlybeingused.Nowthesystemisgenerallyamulti-usersystem,suchasUNIXOS,LinuxOS.Therefore,theusernameoruserIDofdifferentusersisdifferent,andtheusernamecorrespondstotheuserIDonetoone,whichisusedtodetectwhethertheusernameexistsinthecurrentsystem.Sometimesinordertoknowhowmanyusersareusingthecurrentsystem,itisusuallybyqueryingthecurrentusername.Youcanlearnaboutthecurrentsystemresourceusagethroughthecurrentusername.
Commonmulti-useroperatingsystems
Multi-useroperatingsystemsallowmultipleuserstousethesamemachinethroughtheirownterminals,sharingvariousresourcesinthehostsystem,andeachuserprogramItcanbefurtherdividedintoseveraltasks,sothattheycanbeexecutedconcurrently,whichcanfurtherimproveresourceutilizationandsystemthroughput.Mostofthelarge,medium,andminicomputersareconfiguredwithmulti-userandmulti-taskoperatingsystems,andon32-bitmicrocomputers,manyofthemareconfiguredwithmulti-userandmulti-taskoperatingsystems.
UNIXOS
UNIXOSwasdevelopedbyBellLabsofAmericanTelegraphandTelephoneCompanybetween1969and1970.TheUNIXV.7introducedin1979hasbeenwidelyusedAvarietyofmediumandsmallcomputers.Withtheimprovementofmicrocomputerperformance,peopletransplantedUNIXtomicrocomputer.Around1980,theseventhversionofUNIXwasportedtoMotorola'sMC680xxmicrocomputer.Later,theversionofUNIXV7.0wassimplifiedandthenportedtoIntel8080,whichwascalledXenix.ThetwomostinfluentialvariantsofUNIXoperatingsystemsthatcanrunonmicrocomputersareSolarisOSandLinuxOS.
SolarisOS
SunOS1.0,launchedbySUNin1982,isaUNIXOSrunningontheMotorola680x0platform.SUNOS4.0announcedin1988migratedtheoperatingplatformfromtheearlyMotorola680x0platformtotheSPARCplatform,andbegantosupportIntel’sIntel80x86;in1992,SUNreleasedSolaris2.0.Since1998,Sunhasintroduced64-bitoperatingsystemsSolaris2.7and2.8.Theseoperatingsystemshavegreatlyimprovednetworkfeatures,interoperability,compatibility,andeaseofconfigurationandmanagement.
LinuxOS
LinuxisanimportantvariantofUNIX,originallydevelopedbyFinnishstudentLinusTorvaldsforIntel80386.In1991,thefirstLinuxversionwasreleasedontheInternet.Becausethesourcecodewasopen,manypeoplecooperatedwithitthroughtheInternet,andtheperformanceofLinuxwasrapidlyimproved,anditsapplicationscopewasalsoexpandingdaybyday.Correspondingly,thesourcecodehasalsoexpandedrapidly.Atthistime,itisalreadyafullyfunctionalUNIXsystem.AlargenumberofsoftwarerunningonUNIX(includingmorethan1,000utilitysoftwareandalargenumberofnetworksoftware)havebeentransplantedtoLinux,anditcanbeRunonthemaincomputer,suchasIntel80x86Pentium,etc.
Linuxcommandtoviewusername
inuxviewusercommandwcommand
Thiscommandisusedtodisplaythestatusofusersloggedintothesystem.Thewcommandispowerful,Itcannotonlyshowwhoisloggedintothesystem,butalsoshowthecurrentworkoftheseusers,andthestatisticaldataismoredetailedandscientificthanthewhocommand.
ThedisplayitemsofthewcommandareinthefollowingorderArrangement:thecurrenttime,thetimefromwhenthesystemwasstartedtothepresent,thenumberoflogged-inusers,andtheaverageloadofthesysteminthelast1second,5seconds,and15seconds.Thentherearethevariousdataofeachuser.Thedisplayorderoftheitemsisasfollows:loginaccount,terminalname,remotehostname,logintime,idletime,JCPU,PCPU,andthecommandlineofthecurrentlyrunningprocess.
JCPUtimereferstothetimetakenbyallprocessesconnectedtotheterminal(tty).Thistimedoesnotincludethepastbackgroundjobtime,butitincludesthetimeoccupiedbythecurrentlyrunningbackgroundjob.ThePCPUtimereferstothetimetakenbythecurrentprocess(thatis,theprocessdisplayedintheWHATitem).Thespecificusageandparametersofthiscommandaredescribedbelow.
Linuxviewingusercommandwhocommand
Thiscommandismainlyusedtoviewthecurrentonlineusersituation.Thiscommandisveryuseful.Iftheuserwantstoestablishinstantcommunicationwithotherusers,suchasusingthetalkcommand,thefirstthingtomakesureisthattheuserisindeedonline,otherwisethetalkprocesscannotbeestablished.Foranotherexample,ifthesystemadministratorwantstomonitorwhateachlogged-inuserisdoingatthismoment,hemustalsousethewhocommand.
loginname:loginusername;
terminalline:useterminalequipment;
logintime:logintimetothesystem.
Thefollowingdescribesthecommonlyusedparametersofthewhocommand.
-m
Itdisplaysyourusernameinthesystem,loginterminal,logintime
-q
onlyDisplaytheuser'sloginaccountandthenumberoflogged-inusers
-s
Ignore,itisthesameaswho
-r
CanbeviewedThecurrentsystemrunlevel
run-level3Apr2109:37last=S
-H,--headingdisplaysarowandcolumnheadings.CommonlyusedheadingsareshowninTable4-2.
Linuxviewusercommandlast
Youcanviewthelasttimeyouloggedin.Ofcourse,rootcanviewtheloginstatusofotherusers.
last-nusercanseethepreviousnloginsofuser