Aix Comnds

Embed Size (px)

Citation preview

  • 8/17/2019 Aix Comnds

    1/21

    AIX COMMAND GUIDE

     Making files is easy under the UNIX operating system. Therefore, users tend to create numerous files using large amounts of file space. It has been said that the only standard thing about all UNIX systems is the

    message-of-the-day telling users to clean up their files. -- System V.2 administrator's guide

    Quick Alphabetic Look-Up

    Basic ile !andling"nputs# $utputs and

    %ildcards$ther ile !andling

    &ommands(tremely Use)ul

    &ommands*eneral "n)ormation&ommands

    System &ommands &onnecti+ity ,apes and isks

    Screen

    &ommunication

    Source &ode &ontrol

    System S&&S/0iscellaneous Shell Scripts

    INTRODUCTION

    ,his is my uni( command help )ile 1hich has been built up o+er the years. ,his )ile 1as built primarily )or my o1n re)erence and is not  intended to be an authoratati+e guide toall commands )or A" - o)ten i) there is a +ery short description )or a command# you cantake this as 3,0. " am not  a systems administrator# but ha+e been called on to do the 4ob occasionally and install a bo( or t1o/ - this help)ile should be ideal )or people 1ho

    use A"# but aren't responsible )or the deep magic re5uired )or hard1are con)iguration.

    6ou may )ind this )ile help)ul despite the numerous omissions nonetheless. ,his )ile 1asoriginally a plain te(t )ile but " ha+e con+erted to !,0L using Lemmy A +i clone )or%indo1s/.

    Because it has been hand-con+erted )rom the original te(t document# there's a )e1hango+ers )rom it that " 4ust can't be bothered to remo+e such as the caps headings.Additionally# some bro1sers may not render certain characters.

    "'+e tried and 5uite probably )ailed/ to keep se+eral con+entions 1ithin this document -

    any command# i) mentioned in the description o) another command should ha+e a bookmark link to the description o) that command7 all e(amples are in blue te(t -apologies to lyn( users# but e(amples should be 1ritten so that they're recognisableany1ay and i) you're using lyn(# you probably kno1 uni( 5uite 1ell any1ay so " don'treally kno1 1hy "'m apologising 7-/. ") a command has more than one use)ul option# "'+etried to put them into 8UL9 Unordered list tags.

    ") a command stands almost alone# or is comple( 1ithin itsel)# it doesn't appear in this )ile

    http://bigcalm.tripod.com/aix/quickh.htmhttp://bigcalm.tripod.com/aix/handycommands.htm#BASIC%20FILE%20HANDLINGhttp://bigcalm.tripod.com/aix/handycommands.htm#INPUTS,%20OUTPUTS%20AND%20WILDCARDShttp://bigcalm.tripod.com/aix/handycommands.htm#INPUTS,%20OUTPUTS%20AND%20WILDCARDShttp://bigcalm.tripod.com/aix/handycommands.htm#OTHER%20FILE%20HANDLING%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#OTHER%20FILE%20HANDLING%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#EXTREMELY%20USEFUL%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#EXTREMELY%20USEFUL%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#GENERAL%20INFORMATION%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#GENERAL%20INFORMATION%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#SYSTEM%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#CONNECTIVITYhttp://bigcalm.tripod.com/aix/handycommands.htm#TAPES%20AND%20DISKShttp://bigcalm.tripod.com/aix/handycommands.htm#SCREEN%20COMMUNICATIONhttp://bigcalm.tripod.com/aix/handycommands.htm#SCREEN%20COMMUNICATIONhttp://bigcalm.tripod.com/aix/handycommands.htm#SOURCE%20CODE%20CONTROL%20SYSTEM%20(SCCS)http://bigcalm.tripod.com/aix/handycommands.htm#SOURCE%20CODE%20CONTROL%20SYSTEM%20(SCCS)http://bigcalm.tripod.com/aix/handycommands.htm#MISCELLANEOUShttp://bigcalm.tripod.com/aix/handycommands.htm#SHELL%20SCRIPT%20COMMANDShttp://www.softwareonline.org/http://bigcalm.tripod.com/aix/handycommands.htm#vihttp://bigcalm.tripod.com/aix/handycommands.htm#vihttp://lynx.browser.org/http://bigcalm.tripod.com/aix/quickh.htmhttp://bigcalm.tripod.com/aix/handycommands.htm#BASIC%20FILE%20HANDLINGhttp://bigcalm.tripod.com/aix/handycommands.htm#INPUTS,%20OUTPUTS%20AND%20WILDCARDShttp://bigcalm.tripod.com/aix/handycommands.htm#INPUTS,%20OUTPUTS%20AND%20WILDCARDShttp://bigcalm.tripod.com/aix/handycommands.htm#OTHER%20FILE%20HANDLING%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#OTHER%20FILE%20HANDLING%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#EXTREMELY%20USEFUL%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#EXTREMELY%20USEFUL%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#GENERAL%20INFORMATION%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#GENERAL%20INFORMATION%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#SYSTEM%20COMMANDShttp://bigcalm.tripod.com/aix/handycommands.htm#CONNECTIVITYhttp://bigcalm.tripod.com/aix/handycommands.htm#TAPES%20AND%20DISKShttp://bigcalm.tripod.com/aix/handycommands.htm#SCREEN%20COMMUNICATIONhttp://bigcalm.tripod.com/aix/handycommands.htm#SCREEN%20COMMUNICATIONhttp://bigcalm.tripod.com/aix/handycommands.htm#SOURCE%20CODE%20CONTROL%20SYSTEM%20(SCCS)http://bigcalm.tripod.com/aix/handycommands.htm#SOURCE%20CODE%20CONTROL%20SYSTEM%20(SCCS)http://bigcalm.tripod.com/aix/handycommands.htm#MISCELLANEOUShttp://bigcalm.tripod.com/aix/handycommands.htm#SHELL%20SCRIPT%20COMMANDShttp://www.softwareonline.org/http://bigcalm.tripod.com/aix/handycommands.htm#vihttp://lynx.browser.org/

  • 8/17/2019 Aix Comnds

    2/21

     but in it's o1n separate )ile 1ith a link i) "'+e con+erted it to html. (amples are +i anda1k .

    BASIC FILE HANDLING

    ls

    - list )iles in directory7 use 1ith options• -l long )ormat/

    • -a list . )iles too/

    • -r re+erse order/

    • -t ne1est appears )irst/

    • -d do not go beyond current directory/

    • -i sho1 inodes/

    or a more detailed description o) ls see ls -lmore

    - used to control input by pages - like the dos :p argument 1ith dir. e.g.; more :etc:motd

  • 8/17/2019 Aix Comnds

    3/21

    pg

    - used to control input by pages - like the dos :p argument. pg per)orms the same)unction as the more command but has di))erent control# as it is based on e(!elp)ul keys )or pg

    • > go to top/

    ; go to bottom/• h help/

    • : Search/

    • C Search back/

    • 5 5uit/

    • -> back a page/

    pwd

    - sho1 present working directory. e.g.; p1d:usr:li+e:data:ep(:+ss2

    ,o change the current 1orking directory use cdcd

    - change directory 1ithout arguments# this is the same as ; cd ;!$0 or ; cd D/cp

    8source9 8destination9 - copies a )ile )rom one location to another. e.g.; cp :etc:hosts :etc:hosts.backup E make a backup o) the hosts )ile; cp :etc:motd :tmp:4on: E &opy )ile :etc:motd to directory :tmp:4on:$ptions

    • -) to )orce the copy to occur/

    • -r to recursi+ely copy a directory/

    -p to attempt to preser+e permissions 1hen copying/

    synonym copymv

    8source9 8destination9 - mo+e a )ile )rom one location to another. e.g.; m+ :tmp:4on:handycommands.t(t . E mo+e handycommands in :tmp:4on tocurrent directory; m+ -) +ihelp +ihelp.t(t E 0o+e )ile +ihelp to +ihelp.t(t )orced/$ptions

    • -) to )orce the mo+e to occur/

    • -r to recursi+ely mo+e a directory/

    -p to attempt to preser+e permissions 1hen mo+ing/

    synonym mo+e.

    rm

    8)ilename9 - remo+es a )ile. e.g.; rm :tmp:4on:

  • 8/17/2019 Aix Comnds

    4/21

    • -) to )orce the remo+al o) the )ile/

    • -r to recursi+ely remo+e a directory/

    d

    3ecursi+ely lists directories and their siFes. e.g.

    ; du :etc E list recursi+ely all directories o)) :etcG>2 :etc:ob4reposH= :etc:security:auditIJH :etc:security>K= :etc:uucp :etc:+g2J2 :etc:lpp:diagnostics:data2=K :etc:lpp:diagnostics2= :etc:lpp>H :etc:aliasesB>H :etc:acct

    :etc:ncs :etc:sm :etc:sm.bak=J= :etc,he siFes displayed are in I>2M blocks. ,o +ie1 this in >K2=M blocks use theoption -k

    lp -d8@rintername9 8ilename9send )ile to printer. e.g. ; lp -dhplas>= :etc:motd E send )ile :etc:motd to printerhplas>=; lp :etc:motd E send )ile :etc:motd to de)ault printer 

    c!"

    - print a )ile to stdout screen/. e.g.; cat :etc:motd E display )ile :etc:motd to screen

  • 8/17/2019 Aix Comnds

    5/21

    commands al1ays take a )ilename argument# it does in )act come in e(tremelyuse)ul at more ad+anced le+els. A1ards are gi+en out occasionally )or the mostuseless usage o) cat. ") an option o) '-' is speci)ied# cat 1ill take its input )romstdin.

    IN#UTS$ OUT#UTS AND %ILDCARDS

    Uni( commands generally get their in)ormation )rom the screen# and output to it.,here are three main 'streams' 1hich uni( uses to get:place it's in)ormation on.,hese streams are called

    • stdin Standard "nput/ - normally# 1hat you type into the screen

    • stdout Standard $utput/ - normally# 1hat is output to the screen

    • stderr Standard rror/ - normally# error messages 1hich go to the screen

    any o) these may be redirected by the )ollo1ing symbols• 8 8)ilename9 take input )rom 8)ilename9 rather than the screen. e.g.

    ; ksh 8 ( E 1ill read all commands )rom the )ile ( and e(ecute them usingthe Morn shell.

    • 9 8)ilename9 take output )rom the command and place it in 8)ilename9.

    e.g.; ls 9 ( 1ill place the output o) the command 'ls' in the )ile (

    • 99 8)ilename9 take output )rom the command and append it to

    8)ilename9. e.g.; ls :tmp 99 ( 1ill place the output o) the command 'ls' and append it tothe )ile (

    • 29 8)ilename9 take any error messages )rom the command and put it in8)ilename9. e.g.; ls :tmp 29:de+:null 1ould thro1 a1ay any error messages that are produced by ls sorry# :de+:null is a )ile that# i) 1ritten to# the in)ormationdisappears ne+er to be seen again/.

    • command> N command2 @ipe - ,akes the standard output o) the )irst

    command# and turns it into the standard input o) the second command. ,heoutput o) the second command 1ill then be put on the standard output1hich# again# may be a pipe/ e.g.; ls N more 1ill send the output o) 'ls' into the command 'more'# thus producing a directory listing 1hich stops a)ter e+ery page. ,his method is

    called piping.

    command> O - the ampersand O/ )orces command> to run in the background. sothat you may continue to type other commands in the shell# 1hile command>e(ecutes. "t is not ad+isable to run a command in the background i) it outputs tothe screen# or takes it's input )rom the screen

    http://www.ling.helsinki.fi/~reriksso/unix/award.html#cathttp://www.ling.helsinki.fi/~reriksso/unix/award.html#cathttp://www.ling.helsinki.fi/~reriksso/unix/award.html#cat

  • 8/17/2019 Aix Comnds

    6/21

    See also tee 1hich allo1s splitting o) the input stream and output to se+eraldi))erent places at once.

    %&ldc!rds

    B Bib Baby o( ib

    ,here are +arious 1ildcards 1hich you may use. $ne is '

  • 8/17/2019 Aix Comnds

    7/21

    w(&c( 8command9- sho1 1here the source o) a command is held. Almost the same as type and1hence 

    c(mod 8$ctal @ermissions9 8)iles/9- change )ile permissions. e.g.

    ; chmod HHH handycommandschanges the permissions seen by ls -l/ o) the )ile handycommands to -r1-r1-r1-r =# 1 2# ( >. "n the abo+e e(ample i) 1e 1anted read and 1rite permission)or a particular )ile then 1e 1ould use r T 1 H. ") 1e then 1anted to ha+e the)ile ha+e read-1rite permissions )or User# *roup and All# then 1e 1ould ha+e permissions o) HHH. ,here)ore the command to change is that abo+e.; chmod G>> a.out&hanges permissions to -r1(--(--(Additional e(planation o) )ile permissions and user:group:all meaning are gi+enin the description o) ls -l6ou may speci)y chmod di))erently - by e(pressing it in terms o) T and -

    +ariables. or e(ample; chmod uTs :usr:bin:su1ill modi)y the Rsticky bitR on su# 1hich allo1s it to gain the same access on the)ile as the o1ner o) it. %hat it means is Radd s permission to userR. So a )ile thatstarted o)) 1ith permissions o) R-r1(r-(r-(R 1ill change to Rr1sr-(r-(R 1hen theabo+e command is e(ecuted. 6ou may use RuR )or o1ner permissions# RgR )orgroup permissions and RaR )or all.

    c(ow) 8Login ame9 8)iles/9- &hange o1nership o) a )ile. 0ust be done as root. e.g.cho1n in)ormi(

  • 8/17/2019 Aix Comnds

    8/21

    sl. and 1hich ha+en't been accessed )or a day. !elp)ul )or )inding lost )iles# or)inding stu)) in enormous directories. $ther use)ul options include

    • -atime T8days9 - )inds )iles that ha+en't been accessed )or >Tdays also#

    ctime creation time/ and mtime modi)y time/• -prune - stay in current directory - don't look in dirs o)) the directory

    speci)ied in path names - e.g.; )ind :tmp -user RcompgncR -prune -print E 1ill )ind all )iles in :tmp1hich user compgnc o1ns and 1ill not search lo1er directories e.g.:tmp:usr/

    • -siFe T8blocks9 - )inds )iles that are bigger than 8blocks9

    • -e(ec rm 7 - remo+e all )iles )ound...dangerous command - e.g.

    ; )ind :tmp -name Rsl..out N lp -dlocal>

    "!&l -8umber9 8ileame9

    - prints out the end o) a )ile. Very similar to head but 1ith a +ery use)ul option '-)'1hich allo1s you to )ollo1 the end o) a )ile as it is being created.e.g.; tail -) +link.log E )ollo1 end o) +link.log )ile as it is created.

    wc -8options9 8ileame9- %ord &ount 1c/ program. &ounts the number o) chars# 1ords# and lines in a)ile or in a pipe. $ptions

    • -l lines/

    • -c chars/

    http://bigcalm.tripod.com/aix/handycommands.htm#grephttp://bigcalm.tripod.com/aix/handycommands.htm#pghttp://bigcalm.tripod.com/aix/handycommands.htm#doswritehttp://bigcalm.tripod.com/aix/handycommands.htm#lphttp://bigcalm.tripod.com/aix/handycommands.htm#headhttp://bigcalm.tripod.com/aix/handycommands.htm#grephttp://bigcalm.tripod.com/aix/handycommands.htm#pghttp://bigcalm.tripod.com/aix/handycommands.htm#doswritehttp://bigcalm.tripod.com/aix/handycommands.htm#lphttp://bigcalm.tripod.com/aix/handycommands.htm#head

  • 8/17/2019 Aix Comnds

    9/21

    • -1 1ords/

    ,o )ind out ho1 many )iles there are in a directory do ls N 1c -lspl&" -8split9 8ileame9

    - Splits a )ile into se+eral )iles.e.g.

    ; split -IKKK &ALLS> E 1ill split )ile &ALLS> into smaller )iles o) IKKK lineseach called (aa# (ab# (ac# etc."r 8character9 8other character9

    - translates characters. e.g.; cat handycommands N tr RtR R R E 1ill take the )ile handycommands andtranslate all tabs into spaces. Use)ul 1hen messing about 1ith a1k or you need tocon+ert some input e.g. that )rom tty/ to a uni5ue )ilename that does not containspecial characters. e.g.; tty N tr R:R R.R E produces )or e(ample .de+.pts.G

    od 8options9 8)ilename9- od con+erts nasty binary sa+e/ )iles into character representations. Use)ul 1hen

     back-compiling# e(amining ra1 .dat )iles#etc. Use 1ith option '-c' )or characterdisplay recommended/.scr&p"

    - starts recording e+erything in the shell to a )ile by de)ault 'typescript'. @ress Pto )inish the script. @ro+ides a log o) e+erything used. !as almost the same e))ectas ; ksh N tee typescriptUsed )or debugging shells# seeing error messages 1hich )lash o)) the screen too5uickly# etc.

    c"

    - cut's the )ile or pipe into +arious )ields. e.g.; cut -d RNR -)>#2#J acti+e.unl E 1ill take the )ile acti+e.unl 1hich is delimited by

     pipe symbols and print the )irst J )ields options• -d 8delimiter9

    • -) 8)ields9

     ot too use)ul as you can't speci)y the delimiter as merely 1hite space de)aults totab/ Alternati+ely# you can 'cut' up )iles by character positioning use)ul 1ith a)i(ed 1idth )ile/. e.g.; cut -c-2 Rbarcode.t(tR E 1ould cut columns to 2 out o) the barcode.t(t )ile.

    p!s"e

    - paste 1ill 4oin t1o )iles together horiFontally rather than 4ust tacking one on tothe end o) the other. e.g. ") you had one )ile 1ith t1o lines

     Name !mployee Number

    and another )ile 1ith the lines "red #loggs

     !$$$ then by doing; paste )ile> )ile2 9 )ileJ E this 1ould then produce in )ileJ/. Name "red #loggs

    http://bigcalm.tripod.com/aix/handycommands.htm#lshttp://bigcalm.tripod.com/aix/handycommands.htm#cathttp://bigcalm.tripod.com/aix/handycommands.htm#ttyhttp://bigcalm.tripod.com/aix/handycommands.htm#ttyhttp://bigcalm.tripod.com/aix/handycommands.htm#kshhttp://bigcalm.tripod.com/aix/handycommands.htm#teehttp://bigcalm.tripod.com/aix/handycommands.htm#lshttp://bigcalm.tripod.com/aix/handycommands.htm#cathttp://bigcalm.tripod.com/aix/handycommands.htm#ttyhttp://bigcalm.tripod.com/aix/handycommands.htm#ttyhttp://bigcalm.tripod.com/aix/handycommands.htm#kshhttp://bigcalm.tripod.com/aix/handycommands.htm#tee

  • 8/17/2019 Aix Comnds

    10/21

     !mployee Number !$$$ 

     ote that paste puts horiFontal tabs bet1een the )iles# so you may need a sed 's: ::g' command to get rid o) these.

    sor" 8)ilename9- sorts the in)ormation )rom the )ile and displays the result on standard output

    stdout/. e.g.; sort :tmp:listWo)Wnames E 1ill sort the )ile into alphabetical order# and display itto the screen. Use)ul 1ith option '-u' to )ilter out duplicates.

    )&, 8)ilename9- )ilters out all duplicate lines )rom a )ile or input stream )ile or stream must besorted?/. Use)ul 1ith option -c 1hich merely produces a count o) uni5ue lines.

    e- 8)ilename9- e( is an old line editor# and almost ne+er used no1 similar to $S edlin i) youremember that - me# "'+e repressed it/. 6ou are most likely to come across e(1ithin the +i editor - all commands beginning 1ith a colon / are e( commands

    EXTREMEL. USEFUL COMMANDS

    ls /l

    - lists )iles in a directory in long )ormat. 6ou cannot do 1ithout this. !ere's a moredetailed e(planation. e.g.; ls -l

    #!r" 0 #!r" 1 #!r" 2 #!r" 3 #!r" 4 #!r" 5 #!r" 6

    -r1-r1-r1- > root sta)) 2 Xan >H KYI2 3A0

    -r1------- > comp4md sta)) =JK= Xun 2= >22> tabledict

    dr1(r1(r1( 2 comp4md sta)) I>2 Xul > >HJK testdir  

    -r1(r1(--- > comp4md system K Xul > >HJK a.out

    ... is a sample listing.

    • #!r" 0 @ermissions - see chmod )or e(planation o) these. ") the )irst )ield

    is set# then the )ile in 5uestion is not really a )ile at all# but something else#key

    o - normal )ile

    o d directory

    o l symbolic link created by 'ln'

    o c or b de+ice o) some sort

    6ou may sometimes see an 's' 1here the '(' should be in the permissions -this is normally on e(ecutable )iles 1hich change other )iles. e.g.@ermissions o) 's5le(ec' the )ile that e(ecutes all in)ormi( 5ueries should be '-r1sr-sr-(' - this then accesses tables 1ith permissions o) '-r1-r1----'.1here the table )iles are o1ned by in)ormi( group in)ormi(/. the 's' )lagsallo1s changing o) the database tables on a program le+el# but not on auni( le+el. can change contents +ia s5le(ec but not use 'rm' command ondb )ile/.

    http://bigcalm.tripod.com/aix/handycommands.htm#sedhttp://bigcalm.tripod.com/aix/handycommands.htm#sedhttp://bigcalm.tripod.com/aix/handycommands.htm#vihttp://bigcalm.tripod.com/aix/handycommands.htm#chmodhttp://bigcalm.tripod.com/aix/handycommands.htm#sedhttp://bigcalm.tripod.com/aix/handycommands.htm#vihttp://bigcalm.tripod.com/aix/handycommands.htm#chmod

  • 8/17/2019 Aix Comnds

    11/21

    • #!r" 1 umber o) links to this )ile directories al1ays ha+e 2T/.

    • #!r" 2 ,he o1ner o) the )ile - e.g. ") the o1ner is 'comp4md' and

     permissions are set to -r1------- then only the user 'comp4md' may read or1rite to that )ile. Again# i) o1ner is Rcomp4mdR and permissions are -r-(------ then only the user comp4md may read or e(ecute that )ile. $nly the

    o1ner o) a )ile or root may chmod it.• #!r" 3 ,he group o1nership o) the )ile - bloody hell# this is getting

    complicated/. $n a uni( system there are certain 'groups' 1hich users can belong to# held in the )ile ':etc:group'. 6ou 1ill notice that in this )ile there1ill be a main group# e.g. 'sta))' 1hich contains e+ery user. %hich meansthat any user listed under sta)) is in that group.....right...e+ery )ile has agroup attached to it. %hich means that i) a )ile had permissions ----r1----and a group re)erence o) 'system'# then only users 1ho 1ere part o) thegroup system could modi)y that )ile. ,o see 1hich groups the current user belongs to do id. Sorry i) this 1asn't comprehensible but you should ne+erneed to use this any1ay?/.

    #!r" 4 SiFe o) the )ile in bytes• #!r" 5 ,ime o) last modi)ication

    • #!r" 6 ,he name o) the )ile

    Use)ul options and there are loads more/. All may be combined e(cept 1herespeci)ied

    • ls -a sho1 )iles starting 1ith '.' too

    • ls -A sho1 )iles starting 1ith '.' but not '.' or '..'

    • ls -c must be used 1ith either option l and:or t - displays:sorts by

    modi)ication time• ls -d do not sho1 subdirectory listings

    ls -i display the i-node number o) each )ile• ls -t @ut the listing in time order see options u and c/

    • ls -r @ut the listing in re+erse order - usually used 1ith a -t

    • ls -u must be used 1ith either options l and:or t - displays:sorts by last-

    access time

    v& 8)ilename9- lo+e it or loathe it - the standard operating system te(t-)ile editor. See 3elatedhelp )ile. Vi 6ou can also use '+ie1' 1hich )orces 3ead only -3 opt/. +iT8number9 enters the )ile at the speci)ied line no. Also# +i T:8Search pattern91ill enter the )ile and mo+e to the )irst occurrence o) 8Search pattern9. e.g.

    ; +i T:Rlo+e it or loathe itR handycommandsUsers ne1 to +i hate it. " personally managed to get through Uni+ersity 1ithoutusing it e+er " used Xoe's o1n editor instead/. ") " accidentally 1ent into +i# " hadto PZ and kill the 4ob. Sigh. i+e years o) using +i means that "'m getting a little better at it no1... "'m actually typing this no1 in a +i-clone )or %indo1s/.

    grep 8pattern9 8)iles/9- a phenomenally use)ul command 1hich matches strings 1ithin )iles - e.g.; grep GI2J mcallWreps.out E 1ill )ind all the lines in mcallWreps.out that ha+e

    http://bigcalm.tripod.com/aix/handycommands.htm#chmodhttp://bigcalm.tripod.com/aix/handycommands.htm#idhttp://bigcalm.tripod.com/aix/vihelp.htmhttp://bigcalm.tripod.com/aix/vihelp.htmhttp://bigcalm.tripod.com/aix/vihelp.htmhttp://bigcalm.tripod.com/aix/handycommands.htm#chmodhttp://bigcalm.tripod.com/aix/handycommands.htm#idhttp://bigcalm.tripod.com/aix/vihelp.htmhttp://bigcalm.tripod.com/aix/vihelp.htm

  • 8/17/2019 Aix Comnds

    12/21

    the string RGI2JR in it. Also incredibly use)ul )or things like pipes#e.g.; du N grep cred E in :home directory 1ill sho1 all users that ha+e 'cred' in theirtitle/. 6ou may use regular e(pression matching - e.g.; grep Rmain.

  • 8/17/2019 Aix Comnds

    13/21

    - similar to 1hoami e(cept that it does a direct check to see 1ho you are - 1ho only checks :etc:utmp so any su commands 1ill be ignored.

    ps

    - list processes currently running# by de)ault on the current shell. Use)ul 1ithoptions

    -t 8tty9 - sho1 all processes running on a terminal• -e) - sho1 all processes

    • -u 8loginname9 - sho1 all processes o1ned by a user 

    • -)lp 8processid9 - sho1 as much in)ormation as you can about a process

    number • -au( - sho1 processes in order o) usage o) the processors. Use)ul to see

    1hat processes are hogging system resources.

    +ser -u 8)ilename9- sho1 1ho is using a )ile.system hogging command/. Use)ul 1hen trying to1ork out 1ho has locked a ro1 or table in an in)ormi( database )or e(ample.

    lps"!" -p 8printer9- sho1 the current status o) a printer and any 4obs in the 5ueue. lpstat 1ithoutarguments prints all o) them.

    e)!7le 8printer9- enable a printer 5ueue. 6ou must be root or a member o) the print5 group to runthis command.

    d&s!7le 8printer9- disable a printer 5ueue. 6ou must be root or a member o) the print5 group to runthis command.

    e), 8+arious parameters9- e(amine spool 5ueue )or printers.

    )!me -a- 1ill sho1 you 1hat machine you're currently on.&pcs

    - list semaphores and shared memory.&pcrm -s 8semaphorenumber9

    - remo+e semaphore or shared memory.cro)"!7

    - use -l to list all regular scheduled 4obs. ,o alter them# use option -e!" 8no1 T CC seconds:minutes:hours:days:years9

    - per)orm a 4ob at a speci)ied time. Use)ul )or running something at a later date/.at retains the current en+ironment. e.g.

    ; at no1 T I minutesecho R@hone Xulie 0callyR 9 :de+:ttyH>HP 4ob comp4md.JYG=GJ2 1ill be run at CCC%ill echo to ttyH>H the message R@hone Xulie 0callyR in I minutes. e.g.2; at KJJ>2JIYJKecho RApril )ools day?R 9 :de+:consoleP

    http://bigcalm.tripod.com/aix/handycommands.htm#whohttp://bigcalm.tripod.com/aix/handycommands.htm#whohttp://bigcalm.tripod.com/aix/handycommands.htm#whohttp://bigcalm.tripod.com/aix/handycommands.htm#suhttp://bigcalm.tripod.com/aix/handycommands.htm#whohttp://bigcalm.tripod.com/aix/handycommands.htm#whohttp://bigcalm.tripod.com/aix/handycommands.htm#su

  • 8/17/2019 Aix Comnds

    14/21

    1ill echo RApril )ools day?R to the console at >>IY and JK seconds# on the J>st o)march. ormat )or this is [6666\00hhmmss. at 4obs are sometimes used inthe place o) crontab's because i) the machine is o)) 1hen the crontab is meant totake place# the 4ob ne+er happens. at 4obs automatically start 1hen the machine iss1itched on i) the machine 1as do1n at the time. typing at -l 1ill sho1 you all

    the at 4obs you ha+e 5ueued# at -r 8at4ob9 1ill remo+e an at 4ob only the o1neror root is allo1ed to do this/.d!"e

    - sho1 current date and time. ,his command may also be used to set the systemclock $L6 %! V36$ "S L$** $/ 1ith a root user id. A datechange is ne+er simple# e+en 1hen ad4usting things by an hour. ,he sa)est 1ay todo it is to change the date then reboot the machine because other1ise the crontab daemon may start doing 4obs at odd times. " belie+e there might be a 'go slo1:)ast'option to set the clock# and the clock 1ill then run 'slo1er:5uicker' until it catchesup 1ith the re5uired time.

    l!s" 8username9

    - sho1s a list o) recent logins. "t looks at :+ar:adm:1tmp so it only sho1s initiallogins# and not 1hether those users ha+e been su'd to.+&lepl!ce -p+ 8)ilename9

    - sho1 the physical as in disk location/ location o) a )ile. Use)ul )or tracingin)ormi( )iles# and perhaps )or 1orking out 1hether de)ragmentation copying isre5uired.

    S.STEM COMMANDS

    *&ll -8Signal9 8process9- sends a signal normally a kill/ to a process. kill -Y terminates the 4ob no

    5uestions asked# kill ->I tries to clear up as much as possible - e.g. remo+esemaphores and such-like. $ther signals may be sent as 1ell# see manual and:usr:include:sys:signal.h to see 1hat signals you can send to a process.

    re)&ce 8priority9 8process9- make a process not hog the system so much by setting its nice +alue.

    sm&"

    - system admin program )or A"d+ 

    - list +olume groups T usage. see also ls+g. Usually used 1ith the -k )lag so thenumber o) blocks is displayed in >K2=-blocks.

    c -l 8de+ice9

    - log on to de+ice such as a pad or a modem. See related )iles :etc:uucp:< and:etc:locks and :etc:ser+icess""' s!)e

    - &hanges terminal settings back to normal. ") a tetra module )or e(ample crashesyour screen so that no keys )unction e(cept P& 1hich doesn't e+en do +ery muchthen typing PXstty sanePX should cure the problem. ,o )ully cure the problem youalso need to type stty tabJ and stty -i(on i) you're )eeling a little o+erFealous/

    s""'

    http://bigcalm.tripod.com/aix/handycommands.htm#crontabhttp://bigcalm.tripod.com/aix/handycommands.htm#crontabhttp://bigcalm.tripod.com/aix/handycommands.htm#suhttp://bigcalm.tripod.com/aix/handycommands.htm#suhttp://bigcalm.tripod.com/aix/handycommands.htm#lsvghttp://bigcalm.tripod.com/aix/handycommands.htm#crontabhttp://bigcalm.tripod.com/aix/handycommands.htm#suhttp://bigcalm.tripod.com/aix/handycommands.htm#lsvg

  • 8/17/2019 Aix Comnds

    15/21

    - allo1s you to change terminal settings such as the interrupt key# 5uit key# etc.e.g.; stty intr PA E 1ould change the interrupt key to being control-A; stty 5uit PL E1ould set the 5uit key normally P/ to control-L. other keychanges are

    erase normally P!/• (on normally PQ/

    • (o)) normally PS/

    • eo) normally P/

    ,o really annoy a systems administrator# change interrupt to 't' and 5uit to 'P' .hehehehehehe

    lsc+g

    - sho1 all connected de+iceslsvg

    - list +olume groups see related )ile diskhelp/

    lspv - list physical disks and see related )ile diskhelp/lsp+ 1ithout arguments 1ill produce a list o) all the hard-disks used. lsp+ 8hard-disk-name9 1ill produce a list o) in)ormation about the hard disk. lsp+ -l 8hard-disk-name9 1ill sho1 any logical +olumes 1hich are mapped on to that dri+e.

    lsdev

    - list de+ices. $ptions• -& list &on)igured de+ices

    • -@ list @ossible de+ices

     produces di))erent output 1hen you are root.

    m*dev - make de+ices. e.g. ,o make a ttyE Script to add a tty. $ptions that need amending areE -l name o) tty to be created - e.g '-l ttyHKK' 1il createE a tty called 'ttyHKK'E -p 3A nameE -1 @ort number on 3AE -a Attributes e.g. to set up auto login# etc./mkde+ -c tty -t 'tty' -s 'rs2J2' -l tty=JJ -p sa2 -1 2 -a term'1yseIK' -a)orcedcd'enable' -a login'enable' -a speed'>Y2KK'e.g. ,o create a printer ra1 de+ice/

    mkde+ -c printer -t 'osp' -s 'rs2J2' -p 'saJ' -1 '>K' -l label2 -a (on'yes' -a dtr'no'-a colIKK"t is (&g(l' recommended that you make and change de+ices using smit 

    c(dev

    - change de+ices. See mkde+ cc

    - c compiler# use 1ith• -o 8ob4ect9 to speci)y a target instead o) a.out

    http://bigcalm.tripod.com/aix/handycommands.htm#smithttp://bigcalm.tripod.com/aix/handycommands.htm#smithttp://bigcalm.tripod.com/aix/handycommands.htm#smithttp://bigcalm.tripod.com/aix/handycommands.htm#mkdevhttp://bigcalm.tripod.com/aix/handycommands.htm#smithttp://bigcalm.tripod.com/aix/handycommands.htm#mkdev

  • 8/17/2019 Aix Comnds

    16/21

    • -$ optimise

    • -1 or -% all 1arning )lags.

    s("dow)

    - shutdo1n the system so that it may be s1itched o)). 3ather ob+iously# this may

    only be run by root. $ptions• -) shuts the system do1n immediately rather than 1aiting )or a minute/

    • -3 reboot the system immediately a)ter halt

    oslevel

    - sho1 the current re+ision o) the operating system.

    CONNECTI8IT.

    e-&"

    - end current shell process. ") you log in# then type this command# it 1ill return

    you to login. P control-/ and logout in some shells/ does the same.rlog&)

    - login to a remote machine# e.g.; rlogin hollandrs E log in to machine called hollandrsUse)ul 1ith -l option to speci)y username - e.g.; rlogin cityrs -l ismsde+ E log in to machine cityrs as user ismsde+ or )urtherin)o about trust net1ork see .rhosts )ile and :etc:resol+.con) " think/.

    "el)e"

    - +ery similar to rlogin e(cept that it is more )le(ible 4ust type telnet 1ith noarguments and then 'C' to see the options/. Use)ul because you can speci)y a telnetto a di))erent port.

    +"p- ile ,rans)er @rotocol - a 5uick and easy method )or trans)erring )iles bet1eenmachines. ,he .netrc )ile in your ;!$0 directory holds initial commands. type)tp 1ithout arguments and then 'C' to see options/

    rcp

    - 3emote copy. &opies a )ile )rom one uni( bo( to another# as long as they trusteach other see .rhosts )ile or :etc:resol+.con) " think/. $ptions

    • -) to )orce the copy to occur/

    • -r to recursi+ely copy a directory/

    • -p to attempt to preser+e permissions 1hen copying/

    s - 8loginname9- s1itch user# option '-' means that the users .pro)ile is run# 1ithout option youmerely assume the id and permissions o) the user# 1ithout )or e(ample/ changing@A,! and B@A,!# e.g.; su - root E become root; su root E gain permissions o) root but don't change the current en+ironment+ariables; su - +link E s1itch to user +link 

  • 8/17/2019 Aix Comnds

    17/21

    ") you are root# you may su to any other user 1ithout being prompted )or a pass1ord. su 1ithout arguments is the same as 'su root'. ote that the 'su' option isnot a+ailable on all U" machines as it can crash some o) them.

    p&)g 8hostname9- check that 8hostname9 is ali+e and 1ell do not e(pect an immediate response

    )rom a machine that is linked o+er an "S line/. ire1alls o)ten block ping packets a)ter the @ing o) eath so 5uite o)ten you'll )ind you can't ping internetsites either. $ptions include

    • -5 ping 5uietly

    • -i8no9 1ait no o) seconds bet1een each packet sending. ,he de)ault is >

    second. ") you are using ping to keep an "S line up then usingsomething like ; ping -i I -5 hollandrs is ideal.

    • -) e+er use this? Sends as many packets as it possibly can as )ast as

     possible# used )or net1ork debugging and is likely to slo1 net1orkshorribly 1hen used. Mno1n as ')lood' pinging.

    • -c 8no9 send no o) packets be)ore gi+ing up

    ,o check that your machine can ping# try pinging >2G.K.K.> - this acts as a)eedback loop# checking the net1ork card's ability to ping.

    rs( 8hostname9 8commands9- remote shell - e.g.; rsh altos more :tmp:chk  E 1ill run the command more the )ile :tmp:chk on themachine called altos. Use)ul in pipes )or e(ample. rsh on its o1n 1ill e(ecute alogin. Use option '-l' to speci)y logon name. 6ou can also use rcmd and remsh onother )la+ours o) uni(.

    (os" 8ip address9- lookup the ip address in the :etc:hosts )ile and gi+e its name

    TA#ES AND DIS9S

    #le!se see "(&s p!ge +or more &)+orm!"&o) o) d&s*s &) AIX

    dd i)8)ilename or de+ice9 o)8)ilename or de+ice9 bs8Block SiFe9 con+sync- direct and " mean "3&,/ copy# normally to tape. Archaic synta( and +eryrarely used. )lags

    • i) - input )ilename or de+ice

    • o) - output )ilename

    •  bs - block siFe

    con+ - CC

    e.g. ,o 1rite a )ile to tape use; dd i):etc:hosts o):de+:rmtK bs>K2= con+sync E 1rite hosts )ile to tapeusing dd

    cp&o

    stands )or copy in-out# and is e(tremely po1er)ul i) you can cope 1ith theinnumerable )lags that you ha+e to use?/

    http://www.elsewhere.org/jargon/html/entry/Ping-O'-Death.htmlhttp://www.elsewhere.org/jargon/html/entry/Ping-O'-Death.htmlhttp://www.elsewhere.org/jargon/html/entry/Ping-O'-Death.htmlhttp://bigcalm.tripod.com/aix/aixdisks.htmhttp://www.elsewhere.org/jargon/html/entry/Ping-O'-Death.htmlhttp://bigcalm.tripod.com/aix/aixdisks.htm

  • 8/17/2019 Aix Comnds

    18/21

    ; cpio -iBc+umd Retc:hostsR 8:de+:rmtK E *rab :etc:hosts )ile )rom tape; )ind :etc -print N cpio -oBc+ 9:de+:rmtK E %rite the contents o) the :etc directoryto tape; )ind :etc -print N cpio -pdum+ :usr2:etcbackup: E copy directory :etc to:usr2:etcbackup and retain all permissions.

    meaning o) the )lags• i - input

    • o - output

    • B - Block siFe o) I>2K bytes

    • c - read:1rite header in)o

    • + - list )ile names

    • u - unconditional copy - o+er1rites e(isting )ile.

    • m - keep modi)ication dates

    • d - creates directories as needed.

    • t - generate listing o) 1hat is on the tape.

    •  p - preser+e permissions.

    "!pe"&l -) 8de+icename9 8commands9- A program 1hich came 1ith the tape library to control it's 1orking. &alled1ithout arguments gi+es a menu. "s use)ul )or doing things like mo+ing tapes)rom the slot to the dri+e. e.g.; tapeutil -) :de+:smcK mo+e -s >K -d 2J E 1hich mo+es the tape in slot >K to thedri+e ob+iously# this 1ill depend on your o1n indi+idual tape library# may "suggest the manualC/.

    doswr&"e -a 8uni( )ile9 8dos )ile9- copy uni()ile to rsHKKK's )loppy disk dri+e in $S )ormat. -a option e(pandscertain characters# )or certain ascii con+ersions.

    dosd&r 8directory9- sho1 list o) )iles on a dos )loppy disk. Use)ul 1ith option -l long )ormat/. Likedos command 'dir'

    dosre!d -a 8$S )ile9 8uni( )ile9- copy dos )ile in )loppy disk dri+e to uni( - i) U""L is omitted# it outputs tothe screen.

    dosdel 8$S )ile9- delete dos )ile on )loppy disk.

    dos+orm!"

    - )ormat dos )loppy disk !igh ensity/"!r

    - 3ead:%rite stu)) to archi+e.tar c+) :de+:rmtK 8)ilenames9 E 1ill 1rite )iles to tapetar (+) :de+:rmtK 1ill read )iles )rom tapetar t+) :de+:rmtK 1ill gi+e a listing o) 1hat's on the tape. ") you're using an archi+e)ile then replace :de+:rmtK in the e(amples abo+e 1ith the name o) the archi+e)ile.

    SCREEN COMMUNICATION

    http://bigcalm.tripod.com/aix/handycommands.htm#findhttp://bigcalm.tripod.com/aix/handycommands.htm#findhttp://bigcalm.tripod.com/aix/handycommands.htm#findhttp://bigcalm.tripod.com/aix/handycommands.htm#find

  • 8/17/2019 Aix Comnds

    19/21

    ec(o

    - a command mainly used in shell scripts. (amples; echo R!elloR E 1ill print !ello on your screen; echo R!elloR 9 :de+:ttyH>H E 1ill print !ello on someone elses screen 1arning- can crash their screen?/

    ; echo ;S,>K E 1ill print the +alue o) the en+ironment +ariable S,>K; echo RKJJdemo demoR E 1ill echo demo to the status bar at the top o) a 1yseterminalSee also )ile shellscripts

    re!d

    - 1ill read te(t )rom standard input and place it in the +ariable name speci)ied.See )ile shellscripts

    l&)e

    - 1aits until the user presses return be)ore carrying on 1rites 1hat is typed tostandard output/. ") used in a crontab:at 4ob this instruction is ignored. See )ileshellscripts

    "!l*  8user9- set up an interacti+e communication dialogue bo( bet1een t1o users. Looksgood but isn't really that use)ul.

    wr&"e 8user9- 1rites a message to someone elses screen. ,ry typing '1rite root' and then type amessage# )inishing 1ith control-.

    7!))er 8message9- 1rites 8message9 in huge letters across your screen? ma( >K chars per 1ord/

    w!ll 8message9- send a message to all people on a system. &an only be e(ecuted by root " think/.

    "p" 8argument9- tty type independent attribute setting re5uires ,30 +ariable and ,30&A@to be set/. " only kno1 these )e1 bits

    • tput cnorm - turns the screen cursor on

    • tput ci+is - turns the screen cursor o)) 

    • tput clear - clears the screen

    • tput smso - turns all ne1 te(t to bold

    • tput rmso - turns all bold te(t o)) 

    "ee -a/ 8)ilename9- command used in pipes to take a copy o) the standard output. e.g.; ls N tee :tmp:( E 1ould output ls normally and put a copy in :tmp:(. ,he option '-

    a' is used to append rather than replace )iles.

    SOURCE CODE CONTROL S.STEM :SCCS;

    SCCS Overv&ew

    ,he source code control system allo1s +ersions o) a program to be stored in a special)ile# so that any +ersion may be retrie+ed. ,here are a )e1 commands in+ol+ed not all o)them listed here/. All source code )iles start 1ith 's.'

    http://bigcalm.tripod.com/aix/handycommands.htm#lshttp://bigcalm.tripod.com/aix/handycommands.htm#lshttp://bigcalm.tripod.com/aix/handycommands.htm#lshttp://bigcalm.tripod.com/aix/handycommands.htm#ls

  • 8/17/2019 Aix Comnds

    20/21

    ge" -r8re+ision9 8source code )ile9- get a program out o) source code to read only. 0issing out the -r )lag gets themost recent +ersion. e.g.; get ;S&UM:s.parser.c E e(tracts )ile parser.c )rom source code )ile;S&UM:s.parser.c as read only. See get -e )or editing.

    ge" /e 8source code )ile9- get a piece o) code out )or edit# so that the code may be modi)ied and a ne1+ersion created using 'delta'. e.g.; get -e ;S&UM:s.parser.c E e(tracts )ile parser.c )rom source code )ile;S&UM:s.parser.c )or editing. See get )or read-only.

    del"! 8source code )ile9- you must be in the directory 1ith the modi)ied piece o) code 1hen you e(ecutethis command. ,his adds the latest +ersion to the source code )ile. e.g.; delta ;S&UM:s.parser.c E 1rites )ile parser.c to the source code )ile;S&UM:s.parser.c . See get -e )or in)ormation on ho1 to e(tract the )ile )romsource code.

    prs 8source code )ile9- sho1 comments:details on source code )ile.!dm&) -r 8re+ision no9 -i 8program9 8source code )ile9

    - create a ne1 source code )ile 1ith progam. -r speci)ies the initial re+ision o) the program and may be missed out de)ault is >.> " think/. 0ust be spaced correctly?admin is also used )or sccs administration# but it gets to )ear and loathing time pretty )ast. e.g.admin -iparser.c ;S&UM:s.parser.c E creates a ne1 source code )ile called;S&UM:s.parser.c )rom the )ile parser.c

    )ge" 8source code )ile9- cancels a get -e 

    MISCELLANEOUS

    s"r&p 8binary compiled )ile9- 3emo+es all linking in)ormation 1ithin a compiled program - basically a 1ay o) cutting do1n the siFe o) an e(ecutable.

    'es 81ord9- yes outputs the 1ord 'yes' as )ast as its' little legs can go. e+er called on it'so1n. Al1ays used in pipes. or e(ample; yes N rm 

  • 8/17/2019 Aix Comnds

    21/21

    sed '8pattern9'- used by mysel) )or 5uick substitutions 1hen tr  doesn't seem to be doing its 4ob properly. ,he synta( o) the pattern is similar to +i e( command line. .g. ,osubstitute all spaces 1ith colon symbols the command issed 's: ::g' )ile> E substitute all occurrences o) spaces 1ith colons in )ile> and

    output to stdout.-------------- nd o) !andy&ommands ile ------------

    http://bigcalm.tripod.com/aix/handycommands.htm#trhttp://bigcalm.tripod.com/aix/handycommands.htm#trhttp://bigcalm.tripod.com/aix/handycommands.htm#vihttp://bigcalm.tripod.com/aix/handycommands.htm#exhttp://bigcalm.tripod.com/aix/handycommands.htm#exhttp://bigcalm.tripod.com/aix/handycommands.htm#trhttp://bigcalm.tripod.com/aix/handycommands.htm#vihttp://bigcalm.tripod.com/aix/handycommands.htm#ex