+ All Categories
Home > Documents > aix cmds

aix cmds

Date post: 14-Apr-2018
Category:
Upload: subhrajitm47
View: 218 times
Download: 0 times
Share this document with a friend

of 36

Transcript
  • 7/30/2019 aix cmds

    1/36

    COMMANDSKernelHow would I know if I am running a 32-bit kernel or 64-bit kernel?To display if the kernel is 32-bit enabled or 64-bit enabled, type:bootinfo KHow do I know if I am running a uniprocessor kernel or a multiprocessor kernel?/unix is a symbolic link to the booted kernel. To find out what kernel mode is running, enter ls -l/unix and see what file /unix it links to. The following are the three possibleoutputs from the ls-l /unix command and their corresponding kernels:/unix -> /usr/lib/boot/unix_up # 32 bit uniprocessor kernel/unix -> /usr/lib/boot/unix_mp # 32 bit multiprocessor kernel/unix -> /usr/lib/boot/unix_64 # 64 bit multiprocessor kernelNote:AIX 5L Version 5.3 does not support a uniprocessor kernel.How can I change from one kernel mode to another?During the installation process, one of the kernels, appropriate for the AIX version and the hardwarein operation, is enabled by default. Let us use the method from the previous question and assume the32-bit kernel is enabled. Let us also assume that you want to boot it up in the64-bit kernel mode.This can be done by executing the following commands in sequence:

    ln -sf /usr/lib/boot/unix_64 /unixln -sf /usr/lib/boot/unix_64 /usr/lib/boot/unixbosboot -ad /dev/hdiskxxshutdown rThe /dev/hdiskxx directory is where the boot logical volume /dev/hd5 is located.To find out whatxx is in hdiskxx, run the following command:lslv -m hd5Note:In AIX 5.2, the 32-bit kernel is installed by default. In AIX 5.3, the 64-bit kernel is installed on 64-bit hardware and the 32-bit kernel is installed on 32-bit hardware by default.Hardware

    How would I know if my machine is capable of running AIX 5L Version 5.3?AIX 5L Version 5.3 runs on all currently supported CHRP (Common Hardware ReferencePlatform)-based POWER hardware.How would I know if my machine is CHRP-based?Run the prtconf command. If it's a CHRP machine, the string chrp appears on theModelArchitecture line.How would I know if my System p machine (hardware) is 32-bit or 64-bit?To display if the hardware is 32-bit or 64-bit, type:bootinfo yHow much real memory does my machine have?To display real memory in kilobytes (KB), type one of the following:

    bootinfo -rlsattr -El sys0 a realmemCan my machine run the 64-bit kernel?64-bit hardware is required to run the 64-bit kernel.What are the values of attributes for devices in my system?To list the current values of the attributes for the tape device, rmt0, type:lsattr -l rmt0 ETo list the default values of the attributes for the tape device, rmt0, type:lsattr -l rmt0 DTo list the possible values of the login attribute for the TTY device, tty0, typ

  • 7/30/2019 aix cmds

    2/36

    e:lsattr -l tty0 -a login RTo display system level attributes, type:lsattr -E l sys0How many processors does my system have?To display the number of processors on your system, type:lscfg | grep procHow many hard disks does my system have and which ones are in use?To display the number of hard disks on your system, type:LspvHow do I list information about a specific physical volume?To find details about hdisk1, for example, run the following command:lspv hdisk1How do I get a detailed configuration of my system?Type the following:LscfgThe following options provide specific information:-p Displays platform-specific device information. The flag is applicable to AIX4.2.1 or later.-v Displays the VPD (Vital Product Database) found in the customized VPD objectclass.For example, to display details about the tape drive, rmt0, type:lscfg -vl rmt0You can obtain very similar information by running the prtconf command.

    How do I find out the chip type, system name, node name, model number, and so forth?The uname command povides details about your system.uname -p Displays the chip type of the system. For example, PowerPC.uname -r Displays the release number of the operating system.uname -s Displays the system name. For example, AIX.uname -n Displays the name of the node.uname -a Displays the system name, nodename, version, machine ID.uname -M Displays the system model name. For example, IBM, 9114-275.uname -v Displays the operating system version.uname -m Displays the machine ID number of the hardware running the system.uname -u Displays the system ID number.AIX

    What version, release, and maintenance level of AIX is running on my system?Type one of the following:oslevel rlslpp -h bos.rteHow can I determine which fileset updates are missing from a particular AIX level?To determine which fileset updates are missing from 5300-04, for example, run the followingcommand:oslevel -rl 5300-04What SP (Service Pack) is installed on my system?To see which SP is currently installed on the system, run the oslevel -s command. Sample output

    for an AIX 5L Version 5.3 system, with TL4, and SP2 installed would be:oslevel s5300-04-02Is a CSP (Concluding Service Pack) installed on my system?To see if a CSP is currently installed on the system, run the oslevel -s command. Sample outputfor an AIX 5L Version 5.3 system, with TL3, and CSP installed would be:oslevel s5300-03-CSPHow do I create a file system?

  • 7/30/2019 aix cmds

    3/36

    The following command will create, within volume group testvg, a jfs file systemof 10MB withmounting point /fs1:crfs -v jfs -g testvg -a size=10M -m /fs1The following command will create, within volume group testvg, a jfs2 file system of 10MB withmounting point /fs2 and having read only permissions:crfs -v jfs2 -g testvg -a size=10M -p ro -m /fs2How do I change the size of a file system?To increase the /usr file system size by 1000000 512-byte blocks, type:chfs -a size=+1000000 /usrNote: In AIX 5.3, the size of a JFS2 file system can be shrunk as well.How do I mount a CD?Type the following:mount -V cdrfs -o ro /dev/cd0 /cdromHow do I mount a file system?The following command will mount file system /dev/fslv02 on the /test directory:mount /dev/fslv02 /testHow do I mount all default file systems (all standard file systems in the /etc/filesystems filemarked by the mount=true attribute)?The following command will mount all such file systems:mount {-a|all}How do I unmount a file system?

    Type the following command to unmount /test file system:umount /testHow do I display mounted file systems?Type the following command to display information about all currently mounted file systems:MountHow do I remove a file system?Type the following command to remove the /test file system:rmfs /testHow can I defragment a file system?The defragfs command can be used to improve or report the status of contiguous space within afile system. For example, to defragment the file system /home, use the following

    command:defragfs /homeWhich fileset contains a particular binary?To show bos.acct contains /usr/bin/vmstat, type:lslpp -w /usr/bin/vmstatOr to show bos.perf.tools contains /usr/bin/svmon, type:which_fileset svmonHow do I display information about installed filesets on my system?Type the following:lslpp -lHow do I determine if all filesets of maintenance levels are installed on my system?Type the following:

    instfix -i | grep MLHow do I determine if a fix is installed on my system?To determine if IY24043 is installed, type:instfix -ik IY24043How do I install an individual fix by APAR?To install APAR IY73748 from /dev/cd0, for example, enter the command:instfix -k IY73748 -d /dev/cd0How do I verify if filesets have required prerequisites and are completely installed?To show which filesets need to be installed or corrected, type:

  • 7/30/2019 aix cmds

    4/36

    lppchk vHow do I get a dump of the header of the loader section and the symbol entries in symbolicrepresentation?Type the following: dump HtvHow do I determine the amount of paging space allocated and in use?Type the following:lsps aHow do I increase a paging space?You can use the chps -s command to dynamically increase the size of a paging space. Forexample, if you want to increase the size of hd6 with 3 logical partitions, youissue the followingcommand:chps s 3 hd6How do I reduce a paging space?You can use the chps -d command to dynamically reduce the size of a paging space. For example, ifyou want to decrease the size of hd6 with four logical partitions, you issue thefollowing command:chps d 4 hd6How would I know if my system is capable of using Simultaneous Multi-threading (SMT)?Your system is capable of SMT if it's a POWER5-based system running AIX 5L Versi

    on 5.3.How would I know if SMT is enabled for my system?If you run the smtctl command without any options, it tells you if it's enabledor not.Is SMT supported for the 32-bit kernel?Yes, SMT is supported for both 32-bit and 64-bit kernel.How do I enable or disable SMT?You can enable or disable SMT by running the smtctl command. The following is the syntax:smtctl [ -m off | on [ -w boot | now]]The following options are available:-m off Sets SMT mode to disabled.-m on Sets SMT mode to enabled.

    -wbootMakes the SMT mode change effective on next and subsequent reboots if you run thebosboot command before the next system reboot.-w now Makes the SMT mode change immediately but will not persist across reboot.If neither the -w boot or the -w now options are specified, then the mode changeis madeimmediately. It persists across subsequent reboots if you run the bosboot command before the nextsystem reboot.How do I get partition-specific information and statistics?The lparstat command provides a report of partition information and utilization

    statistics. Thiscommand also provides a display of Hypervisor information.Volume groups and logical volumesHow do I know if my volume group is normal, big, or scalable?Run the lsvg command on the volume group and look at the value for MAX PVs. Thevalue is 32for normal, 128 for big, and 1024 for scalable volume group.How to create a volume group?Use the following command, where spartition_size sets the number of megabytes (MB) in each

  • 7/30/2019 aix cmds

    5/36

    physical partition where the partition_size is expressed in units of MB from 1 through 1024. (It's 1through 131072 for AIX 5.3.) The partition_size variable must be equal to a power of 2 (forexample: 1, 2, 4, 8). The default value for standard and big volume groups is the lowest value toremain within the limitation of 1016 physical partitions per physical volume. The default value forscalable volume groups is the lowest value to accommodate 2040 physical partitions per physicalvolume.mkvg -y name_of_volume_group -s partition_size list_of_hard_disksHow can I change the characteristics of a volume group?You use the following command to change the characteristics of a volume group:ChvgHow do I create a logical volume?Type the following:mklv -y name_of_logical_volume name_of_volume_group number_of_partitionHow do I increase the size of a logical volume?To increase the size of the logical volume represented by the lv05 directory bythree logicalpartitions, for example, type:extendlv lv05 3How do I display all logical volumes that are part of a volume group (for exampl

    e, rootvg)?You can display all logical volumes that are part of rootvg by typing the following command:lsvg -l rootvgHow do I list information about logical volumes?Run the following command to display information about the logical volume lv1:lslv lv1How do I remove a logical volume?You can remove the logical volume lv7 by running the following command:rmlv lv7The rmlv command removes only the logical volume, but does not remove other entities, such asfile systems or paging spaces that were using the logical volume.

    How do I mirror a logical volume?1. mklvcopy LogicalVolumeName Numberofcopies2. syncvg VolumeGroupNameHow do I remove a copy of a logical volume?You can use the rmlvcopy command to remove copies of logical partitions of a logical volume. Toreduce the number of copies of each logical partition belonging to logical volume testlv, enter:rmlvcopy testlv 2Each logical partition in the logical volume now has at most two physical partitions.Queries about volume groupsTo show volume groups in the system, type: Lsvg

    To show all the characteristics of rootvg, type: lsvg rootvgTo show disks used by rootvg, type: lsvg -p rootvgHow to add a disk to a volume group?Type the following:extendvg VolumeGroupName hdisk0 hdisk1 ... hdisknHow do I find out what the maximum supported logical track group (LTG) size of my hard disk?You can use the lquerypv command with the -M flag. The output gives the LTG sizein KB. Forinstance, the LTG size for hdisk0 in the following example is 256 KB.

  • 7/30/2019 aix cmds

    6/36

    /usr/sbin/lquerypv -M hdisk0256You can also run the lspv command on the hard disk and look at the value for MAXREQUEST.What does syncvg command do?The syncvg command is used to synchronize stale physical partitions. It acceptsnames of logicalvolumes, physical volumes, or volume groups as parameters.For Ex, to synchronize the physical partitions located on physical volumes hdisk6 and hdisk7, use:syncvg p hdisk4 hdisk5To synchronize all physical partitions from volume group testvg, use:syncvg v testvgHow do I replace a disk?1. extendvg VolumeGroupName hdisk_new2. migratepv hdisk_bad hdisk_new3. reducevg -d VolumeGroupName hdisk_badHow can I clone (make a copy of ) the rootvg?You can run the alt_disk_copy command to copy the current rootvg to an alternatedisk. Thefollowing example shows how to clone the rootvg to hdisk1.alt_disk_copy -d hdisk1NetworkHow can I display or set values for network parameters?

    The no command sets or displays current or next boot values for network tuning parameters.How do I get the IP address of my machine?Type one of the following:ifconfig -ahost Fully_Qualified_Host_NameFor example, type host cyclop.austin.ibm.com.How do I identify the network interfaces on my server?Either of the following two commands will display the network interfaces:lsdev Cc ififconfig aTo get information about one specific network interface, for example, tr0, run the command:

    ifconfig tr0How do I activate a network interface?To activate the network interface tr0, run the command:ifconfig tr0 upHow do I deactivate a network interface?For example, to deactivate the network interface tr0, run the command:ifconfig tr0 downAIX: Commandscompiled by: John FlectherCOMMAND PARAMETER DESCRIPTIONbootlist -m normal Alters the list of boot devices (or the ordering of these devices in thelist available to the system)

    bosboot -a-ad /dev/rnt-b Create a boot image on the default boot deviceCreate a boot image at location and send to tapecfgmgr Configures devices by running the programs in /etc/methods directory.chcons Redirects the system console to device or file, effective next startupchdev -l -a Changes a device's characteristics.chdisp Changes the display used by the low-function terminal (LFTsubsystem.

  • 7/30/2019 aix cmds

    7/36

    chfont Changes the default font selected at boot time.chfs -a size=+ / Changes attributes of a file system. This one willincrease theFilesystem .chgroup Users=x,y,z Changes attributes for groups.chlv -n Rename logical volume from olvname to nlvnamechps -s Changes attributes of a paging space.chpv Changes the characteristics of a physical volume in a volume group.chque -q -a?host = x? Changes the queue name.chssys Changes a subsystem definition in the subsystem object class.chtcb Changes or queries the trusted computing base attribute of a file.chtz. Changes the system time zone informationchuser rlogin=true Changes attributes for the specified user.chvfs Changes entries in the /etc/vfs file.chvg Sets the characteristics of a volume group.crfs -v (jfs)-d -m -AyesCreate a File system on a pre-defined logical volume (which will automount at boot!)crfs -v (jfs)-g -a size=??

    -m -AyesCreate a File system and its logical volume (uses default lvname)crvfs Creates entries in the /etc/vfs file.exportvg None Export a volume groupgrpck -n ALL Verifies the correctness of a group definition.hvirprt Changes the attribute values of a virtual printer.importvg -y Import a Volume Group onto hdisk xlpstat List print queueslsallq Lists the names of all configured queues.lsallqdev Lists all configured printer and plotter queue device names within a

    specified queue.lsattr -El List detailed configuration for a devicelscfg List all configured devices-v List in detail-l scsi* List all scsi IO deviceslsdev -Cc tape List configured tape devices-Cc disk List configured disks on devices-C -s scsi -H List all defined scsi deviceslsdisp Lists the displays currently available on the system.lsfont Lists the fonts available for use by the display.lsfs -l List all filesystems in /etc/filesystems quering the LVM descriptor areaand superblockslsfs Displays the characteristics of file systems.

    lsgroup ALL Displays the attributes of groups.(checks NIS aswell!)lsitab -a Lists the records in the /etc/inittab file.lskbd Lists the keyboard maps currently available to the low-functionterminal (LFT subsystem.lslicense Displays the number of fixed licenses and the status of floatinglicensing.lslpp -l List all installed softwarelslv List configuration details of a given Logical Volume-l List further configuration details of a given disklsprtsv -ch Shows print service information stored in the database.

  • 7/30/2019 aix cmds

    8/36

    lsps -a List pagaing spacelspv None List configured disks List configuration details of a given disk-l List Logical Volumes/Filesystems on a given disklsque Displays the queue stanza name.lsquedev Displays the device stanza name.lssrc -a List all subsystemslsuser Displays attributes of user accounts.lsvfs Lists entries in the /etc/vfs file.lsvg None List configured Volume groups List configuration details of a given Volume group-l List Logical Volumes/Filesystems on a given Volume Groupmkcatdefs Preprocesses a message source file.mkdev Adds a device to the system.mkfont Adds the font code associated with a display to the system.mkfontdir Creates a fonts.dir file from a directory of font files.mkgroup Creates a new group.mkitab Makes records in the /etc/inittab file.mklv -y Create a Logical Volumemklv Creates a logical volume.mklvcopy Adds copies to a logical volume.

    mknamsv Configures TCP/IP-based name service on a host for a client.mknotify Adds a notify method definition to the notify object class.mkprtsv Configures TCP/IP-based print service on a host.mkps Add an additional paging space to the system.mkque Adds a printer queue to the system.mkquedev Adds a printer queue device to the system.mkserver Adds a subserver definition to the subserver object class.mkssys Adds a subsystem definition to the subsystem object class.mksysb. Backs up mounted file systems in the rootvg volume group forsubsequent reinstallationmkszfile. Records size of mounted file systems in the rootvg volume group forreinstallationmktcpip Sets the required values for starting TCP/IP on a host.

    mkuser Creates a new user account.mkuser.sys Customizes a new user account.Mkvg -y -s Create a Volume Group on hdisk xmkvg Creates a volume group.mkvirprt Makes a virtual printer.odmadd Adds objects to created object classes.odmchange Changes the contents of a selected object in the specified object class.odmcreate Produces the .c (source and .h (include files necessary for ODMapplication development and creates empty objectclasses.

    odmdelete Deletes selected objects from a specified object class.odmdrop Removes an object class.odmget Retrieves objects from the specified object classes and places them intoan odmadd input file.odmshow Displays an object class definition on the screen.pwdck Verifies the correctness of local authentication information.redefinevg Redefines the set of physical volumes of the given volume group in thedevice configuration database.reducevg Removes physical volumes from a volume group. When all physical

  • 7/30/2019 aix cmds

    9/36

    volumes are removed from the volume group, the volume group isdeleted.reorgvg Reorganizes the physical partition allocation for a volume group.restbase Restores customized information from the boot image.rmdel Removes a delta from a Source Code Control System (SCCS file.rmdev Removes a device from the system.rmf Removes folders and the messages they contain.rmfs Removes a file system.rmgroup Removes a group.rmitab Removes records in the /etc/inittab file.rmlv Removes logical volumes from a volume group.rmlvcopy Removes copies from a logical volume.rmm Removes messages.rmnamsv Unconfigures TCP/IP-based name service on a host.rmnotify Removes a notify method definition from the notify object class.rmprtsv Unconfigures a print service on a client or server machine.rmps Removes a paging space from the system.rmque Removes a printer queue from the system.rmquedev Removes a printer or plotter queue device from the system.rmserver Removes a subserver definition from the subserver object class.rmssys Removes a subsystem definition from the subsystem object class.rmuser Removes a user account.rmvfs Removes entries in the /etc/vfs file.rmvirprt Removes a virtual printer.

    runcat Pipes the output data from the mkcatdefs command to the gencatcommand.savebase Saves base customized device data in the ODM onto the boot device.startsrc -s Start a subsystemstopsrc -s Stop a subsystemsyncvg Synchronizes logical volume copies that are not current.usrck Verifies the correctness of a user definition.varyoffvg Takes a Volume Group offlinevaryoffvg Deactivates a volume group.varyonvg Puts a Volume Group onlinevaryonvg Activates a volume group.----------------------------------------------------------------------------MISCELLENEOUS

    ----------------------------------------------------------------------------http://www.rs6000.ibm.com/cgi-bin/ds_form Web based man pagesoslevel Returns operating system levelwhence (program) Returns full path of programwhereis (program) Returms full path of programwhat (program) Displays identifying info from the executable like version number, when compiled.lslpp -L all list all installed softwarelslpp -L (program set name) Check if software installedlslpp -f Lists filesets vs packageslslpp -ha Lists installation history of filesetsinstfix -ik (fix number eg IX66617) Checks id fix is installedinstfix -ik 4330-02_AIX_ML

    compress -c file.txt > file.Z Create a compressed file.uuencode (infile) (extract-file-name) > (output file)Converts a binary file to an ASCII file for transfer by modem or emailuudecode (encoded file)Extracts a binary file from encoded file and calls it the extract-file-nameExamples :-uuencode maymap maymap > maymap.encuuencode maymap.encod -c /tmp Displays contents of the /tmp directory filels -i Lists files with their inode numbers

  • 7/30/2019 aix cmds

    10/36

    echo * Lists files, can be used if ls is corrupt/missingalog -o -t boot View the boot logchtz (timezone eg GMT0BST) Changes the timezone in /etc/environment filechlang (language eg En_GB) Changes the language in /etc/environment filear -v -t (archive file) List contents of an archivear -v -x (archive file) Extracts the archivear -v -t /usr/lib/libC-r.a Lists contents of the libC_r.a libraryfind /source -print | cpio -pdm /targetCopying directories using cpio, creates /target/source directory.dump -nTv (binary executable) Displays the contents of an executable filedump -c Displays string informationdump -o Displays object file headersdump -l Displays line numbersdump -s Displays the text sectionsnap -ao /dev/rmt0 Create a snapshot onto tapesnap -ad (directory) Create a snapshot into a named directory other than the default(/tmp/ibmsupt)/usr/dt/bin/dtconfig -d Disables desktop logins/usr/dt/bin/dtconfig -e Enables desktop logins/var/dt/Xpid PID of the dtlogin process--------------------------------------------------------------------------------TERMINALS--------------------------------------------------------------------------------

    tty Displays what the tty/pty number of the terminal is.termdef Reports the termtype setup in smit for the tty port that termdef is runon.chdev -l (device eg tty1) -a term=vt100 Sets tty to a vt100 terminal typepenable tty0 adds getty line into /etc/inittab for tty0 and starts gettypdisable tty0 disables the getty line and disables gettypenable / pdisable -a option is for allstty erase ^? Set backspace key for vt100 terminalsstty erase ^H Set backspace key for wyse50 terminalslscons Displays the console devicechcons -a login=enable (device eg /dev/tty1) Changes the console deviceCreate ttys on ports 0 to 7 on adapter sa2 :-for i in 0 1 2 3 4 5 6 7

    domkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100doneportmir -t /dev/tty0 Mirror current terminal onto /dev/tty0portmir -o Turns off port mirroring--------------------------------------------------------------------------------NETWORK--------------------------------------------------------------------------------host (ip or hostname) Resolves a hostname / ip addresshostname Displays hostnamehostname (hostname) Sets the hostname until next rebootchdev -l (device name) -a hostname=(hostname) Changes hostname permanentlychdev -l inet0 -a hostname=thomas

    ifconfig (device name) Displays network card settingsifconfig (device name) up Turns on network cardifconfig (device name) down Turns off network cardifconfig (device name) detach Removes the network card from the network interface listifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 upifconfig lo0 alias 195.60.60.1 Create alias ip address for loopbackroute (add/delete) (-net/-host) (destination) (gateway)Adds or deletes routes to other networks or hosts, does not updatethe ODM database and will be lost at reboot.

  • 7/30/2019 aix cmds

    11/36

    route add -net 194.60.89.0 194.60.90.4lsattr -EHl inet0 Displays routes set in ODM and hostnameodmget -q "name=inet0" CuAt Displays routes set in ODM and hostnamerefresh -s inetd Refresh inetd after changes to inetd.confkill -1 (inetd PID) Refresh inetd after changes to inted.confnetstat -i Displays interface statisticsentstat -d (ethernet adapter eg en0) Displays ethernet statisticsarp -a Displays ip to mac address table from arp cacheno -a Displays network options use -o to set individual options or-d to set individual options to default.no -o option=value (this value is reset at reboot)no -o "ipforwarding=1"traceroute (name or ipaddress) Displays all the hops from source to destinationsupplied.ping -R (name or ipaddress) Same as traceroute except repeats.--------------------------------------------------------------------------------N.F.S.--------------------------------------------------------------------------------exportfs Lists all exported filesystemsexportfs -a Exports all fs's in /etc/exports fileexportfs -u (filesystem) Un-exports a filesystemmknfs Configures and starts NFS servicesrmnfs Stops and un-configures NFS servicesmknfsexp -d /directory Creates an NFS export directory

    mknfsmnt Creates an NFS mount directorymount hostname:/filesystem /mount-point Mount an NFS filesystemnfso -a Display NFS Optionsnfso -o option=value Set an NFS Optionnfso -o nfs_use_reserved_port=1--------------------------------------------------------------------------------BACKUPS--------------------------------------------------------------------------------MKSYSB------ ------mkszfile -f Creates /image.data file (4.x onwards)mkszfile -X Creates /fs.size file (3.x)mksysb (device eg /dev/rmt0)

    CPIO ARCHIVE------------ ---------find (filesystem) -print | cpio -ocv > (filename or device)eg find ./usr/ -print | cpio -ocv > /dev/rmt0CPIO RESTORE------------ ---------cpio -ict < (filename or device) | more Lists archivecpio -icdv < (filename or device)cpio -icdv < (filename or device) ("files or directories to restore")eg cpio -icdv < /dev/rmt0 "tcpip/*" Restore directory and contentscpio -icdv < /dev/rmt0 "*resolve.conf" Restore a named fileTAR ARCHIVE----------- ---------

    tar -cvf (filename or device) ("files or directories to archive")eg tar -cvf /dev/rmt0 "/usr/*"TAR RESTORE----------- ---------tar -tvf (filename or device) Lists archivetar -xvf (filename or device) Restore alltar -xvf (filename or device) ("files or directories to restore")use -p option for restoring with orginal permissionseg tar -xvf /dev/rmt0 "tcpip" Restore directory and contentstar -xvf /dev/rmt0 "tcpip/resolve.conf" Restore a named file

  • 7/30/2019 aix cmds

    12/36

    AIX ARCHIVE----------- --------find (filesystem) -print | backup -iqvf (filename or device) --- Backup by filename.eg find /usr/ -print | backup -iqvf /dev/rmt0backup -(backup level 0 to 9) -f (filename or device) ("filesystem") --Backup byinode.eg backup -0 -f /dev/rmt0 "/usr" -u option updates /etc/dumpdates fileAIX RESTORE----------- --------restore -qTvf (filename or device) Lists archiverestore -qvxf (filename or device) Restores allrestore -qvxf (filename or device) ("files or directories to restore")(use -d for restore directories)restore -qvxf /dev/rmt0.1 "./etc/passwd" Restore /etc/passwd filerestore -s4 -qTvf /dev/rmt0.1 Lists contents of a mksysb tapeBACKUPS ACROSS A NETWORK------------------------ ---------------------To run the backup on a local machine (cpio) and backup on the remotemachine's (remhost) tape drive (/dev/rmt0)find /data -print | cpio -ocv | dd obs=32k | rsh remhost \"dd ibs=32k obs=64k of=/dev/rmt0"To restore/read the backup (cpio) on the remote machinedd ibs=64k if=/dev/rmt0 | cpio -icvt

    To restore/read the backup (cpio) on the local machine from the remotemachine's (remhost) tape drive (/dev/rmt0)rsh remhost "dd ibs=64k obs=32k if=/dev/rmt0" | dd ibs=32k \| cpio -icvtTo run the backup (cpio) on a remote machine (remhost) and backup tothe local machines tape drive (/dev/rmt0)rsh remhost "find /data -print | cpio -icv | dd ibs=32k" \| dd ibs=32k obs=64k of=/dev/rmt0COPYING DISKETTES------------------------------dd if=/dev/fd0 of=(filename) bs=36bdd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopyCOPYING TAPES

    -----------------------dd if=/dev/rmt0 of=(filename)dd if=(filename) of=/dev/rmt0 or tcopy--------------------------------------------------------------------------------VI Commands--------------------------------------------------------------------------------:g/xxx/s//yyy/ global change where xxx is to be changed by yyysed 's(ctrl v ctrl m)g//g' old.filename > new.filenameStrips out ^M characters from ascii files that have been transferred as binary.To enter crontrol characters type ctrl v then ctrl ? where ? is whateverctrl character you need.--------------------------------------------------------------------------------DEVICES

    --------------------------------------------------------------------------------lscfg lists all installed deviceslscfg -v lists all installed devices in detaillscfg -vl (device name) lists device detailsbootinfo -b reports last device the system booted frombootinfo -k reports keyswitch position ------- 1=secure, 2=service, 3=normalbootinfo -r reports amount of memory (/ by 1024)bootinfo -s (disk device) reports size of disk drivebootinfo -T reports type of machine ie rspclsattr -El sys0 -a realmem reports amount of useable memory

  • 7/30/2019 aix cmds

    13/36

    mknod (device) c (major no) (minor no) Creates a /dev/ device file.mknod /dev/null1 c 2 3lsdev -C lists all customised devices ie installedlsdev -P lists all pre-defined devices ie supportedlsdev -(C or P) -c (class) -t (type) -s (subtype)chdev -l (device) -a (attribute)=(new value) Change a device attributechdev -l sys0 -a maxuproc=80lsattr -EH -l (device) -D Lists the defaults in the pre-defined dblsattr -EH -l sys0 -a modelnamermdev -l (device) Change device state from available to definedrmdev -l (device) -d Delete the devicermdev -l (device) -SR S stops device, R unconfigures child deviceslsresource -l (device) Displays bus resource attributes of a device.Power Management (PCI machines)------------------------------- ------------pmctrl -a Displays the Power Management statermdev -l pmc0 Unconfigure Power Managementmkdev -l pmc0 Configure Power Management--------------------------------------------------------------------------------TAPE DRIVES--------------------------------------------------------------------------------rmt0.x where x = A + B + CA = density 0 = high 4 = lowB = retension 0 = no 2 = yes

    C = rewind 0 = no 1 = yestctl -f (tape device) fsf (No) Skips forward (No) tape markerstctl -f (tape device) bsf (No) Skips back (No) tape markerstctl -f (tape device) rewind Rewind the tapetctl -f (tape device) offline Eject the tapetctl -f (tape device) status Show status of tape drivechdev -l rmt0 -a block_size=512 changes block size to 512 bytes(4mm = 1024, 8mm = variable but1024 recommended)bootinfo -e answer of 1 = machine can boot from a tape driveanswer of 0 = machine CANNOT boot from tape drivediag -c -d (tape device) Hardware reset a tape drive.tapechk (No of files) Checks Number of files on tape.

    < /dev/rmt0 Rewinds the tape !!!--------------------------------------------------------------------------------PRINTERS / PRINT QUEUES--------------------------------------------------------------------------------splp (device) Displays/changes printer driver settingssplp /dev/lp0export $LPDEST="pqname" Set default printer queue for login sessionlsvirprt Lists/changes virtual printer attributes.rmvirprt -q queuename -d queuedevice Removes a virtual printerqpri -#(job No) -a(new priority) Change a queue job priority.qhld -#(job No) Put a hold on holdqhld -r #(job No) Release a held jobqchk -A Status of jobs in queues

    lpstatlpstat -p(queue) Status of jobs in a named queueqcan -x (job No) Cancel a job from a queuecancel (job No)enq -U -P(queue) Enable a queueenable (queue)enq -D -P(queue) Disable a queuedisable (queue)qmov -m(new queue) -#(job No) Move a job to another queuestartsrc -s qdaemon Start qdaemon sub-system

  • 7/30/2019 aix cmds

    14/36

    lssrc -s qdaemon List status of qdaemon sub-systemstop -s qdaemon Stop qdaemon sub-system--------------------------------------------------------------------------------FILE SYSTEMS--------------------------------------------------------------------------------Physical Volumes (PV's)----------------------- ------lspv Lists all physical volumes (hard disks)lspv (pv) Lists the physical volume detailslspv -l (pv) Lists the logical volumes on the physical volumelspv -p (pv) Lists the physical partition usage for that PVchdev -l (pv) -a pv=yes Makes a new hdisk a pysical volume.chpv -v r (pv) Removes a disk from the system.chpv -v a (pv) Adds the removed disk back into the system.chpv -a y (pv) Changes pv allocatable state to YESchpv -a n (pv) Changes pv allocatable state to NOmigratepv (old pv) (new pv) Moves all LV's from one PV to another PV, bothPV's must be in the same volume group.Volume Groups (VG's)-------------------- -------lsvg Lists all volume groupslsvg (vg) Lists the volume group detailslsvg -l (vg) Lists all logical volumes in the volume grouplsvg -p (vg) Lists all physical volumes in the volume group

    lsvg -o Lists all varied on volume groupsvaryonvg (vg) Vary On a volume groupvaryonvg -f (vg) Forces the varyon processvaryonvg -s (vg) Vary on a VG in maintenance mode. LV commands can beused on VG, but LV,s cannot be opened for I/O.varyoffvg (vg) Vary Off a volume groupsynclvodm (vg) Tries to resync VGDA, LV control blocks and ODM.mkvg -y(vg) -s(PP size) (pv) Create a volume groupmkvg -y datavg -s 4 hdisk1reducevg -d (vg) (pv) Removes a volume groupreducevg (vg) (PVID) Removes the PVID disk reference from the VGDA when adisk has vanished without the reducevg (vg) (pv) command being run first.extendvg (vg) (new pv) Adds another PV into a VG.

    exportvg (vg) Exports the volume group eg deletes it!Note : Cannot export a VG if it has active paging space, turn off paging,reboot before exporting VG. Exporting removes entries from filesystemsfile but does not remove the mount points.chvg -a y (vg) Auto Vary On a volume group at system start.lqueryvg -Atp (pv) Details volume group info for the hard disk.importvg -y (vg name) (pv) Import a volume group from a disk.importvg (pv) Same as above but VG will be called vg00 etc.chvg -Q (y/n) (vg name) Turns on/off Quorum checking on a vg.Logical Volumes (LV's)---------------------- -------lslv (lv) Lists the logical volume detailslslv -l (lv) Lists the physical volume which the LV is on

    mklv (vg) (No of PP's) (pv Name optional) Create a logical volumemklv -y (lv) (PP's) (pv name optional) Creates a named logical volumechlv -n (new lv) (old lv) Rename a logical volumeextendlv (lv) (extra No of PP's) Increase the size of an LVrmlv (lv) Remove a logical volumemklv/extendlv -a = PP alocation policy-am = middle -ac = center -ae = edge-aie = inner edge -aim = inner middlemigratepv -l (lv) (old pv) (new pv) Move a logical volume between physical volumes. Both

  • 7/30/2019 aix cmds

    15/36

    physical volumes must be in the same volume group !mklv -y (lv) -t jfslog (vg) (No of PP's) (pv Name optional)Creates a JFSlog logical volume.logform (/dev/lv) Initialises an LV for use as an JFSloggetlvcb -AT (lv) Displays Logical Volume Control Block informationFile Systems (FS's)------------------- ----lsfs Lists all filesystemslsfs -q (fs) Lists the file system detailsmount Lists all the mounted filesystemsmount (fs or lv) Mounts a named filesystemmount a / mount all Mounts all filesystemsmount -r -v cdrfs /dev/cd0 /cdrom Mounts cd0 drive over /cdromcrfs -v jfs -d(lv) -m(mount point) -A yesWill create a file system on the whole of the logical volume, adds entry into/etc/filesystems and will create mount point directory if it does not exist.crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yesWill create a logical volume on the volume group and create the file system onthe logical volume. All at the size stated. Will add entry into/etc/filesystems and will create the mount point directory if it does not exist.chfs -A yes (fs) Change file system to Auto mount in /etc/filesystemschfs -a size=(new fs size)(fs) Change file system sizermfs (fs) Removes the FS and will also remove the LV if there are no onther filesystems on it.

    defrag -q (fs) Reports the fragment status of the file system.defragfs -r (fs) Runs in report only defrag mode (no action).defragfs (fs) Defragments a file system.fsck (fs) Verify a file system, the file system must be unmounted!fsck (-y or -n) (fs) Pre-answer questions either yes or no !fsck -p (fs) Will restore primary superblock from backup copy if the superblockis corrupt.Mirroring--------- --mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP's) (PV Name optional)Creates a mirrored named logical volume.mklvcopy -s n (lv) (copies 2 or 3) (pv) Creates a copy of a logical volume ontoanother physical

    volume. The physical volume MUST be in the same volume group as the orginal logical volume !rmlvcopy (lv) (copies 1 or 2) Removes logical volume copies.rmlvcopy (lv) (copies 1 or 2) (pv) From this pv only!syncvg -p (pv) Synchronize logical partion copiessyncvg -l (lv)syncvg -v (vg)mirrorvg (vg) (pv) Mirrors the all the logical volumes in a volume group onto anew physicalvolume. New physical volume must already be part of the volume group.--------------------------------------------------------------------------------BOOT LOGICAL VOLUME (BLV)--------------------------------------------------------------------------------

    bootlist -m (normal or service) -o displays bootlistbootlist -m (normal or service) (list of devices) change bootlistbootinfo -b Identifies the bootable diskbootinfo -t Specifies type of bootbosboot -a -d (/dev/pv) Creates a complete boot image on a physical volume.mkboot -c -d (/dev/pv) Zero's out the boot records on the physical volume.savebase -d (/dev/pv) Saves customised ODM info onto the boot device.--------------------------------------------------------------------------------SYSTEM DUMP--------------------------------------------------------------------------------

  • 7/30/2019 aix cmds

    16/36

    sysdumpdev -l Lists current dump destination.sysdumpdev -e Estimates dumpsize of the current system in bytes.sysdumpdev -L Displays information about the previous dump.sysdumpstart -p Starts a dump and writes to the primary dump device.sysdumpstart -s Starts a dump and writes to the secondary dump device.(MCA machine can also dump if key is in service position and the reset button ispressed)sysdumpdev -p (dump device) -P Sets the default dump device, permanentlyAnalyse dump file :-echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0--------------------------------------------------------------------------------PAGING SPACE (PS's)--------------------------------------------------------------------------------lsps -a Lists out all paging spacelsps -s Displays total paging and total useagelsps (ps)mkps -s(No of 4M blocks) -n -a (vg)mkps -s(No of 4M blocks) -n -a (vg) (pv)-n = don't activate/swapon now -a = activate/swapon at rebootchps -a n (ps) Turns off paging space.chps -s(No of 4M blocks) (ps) Increases paging space.chlv -n (new name) (old name) Change paging space namermps (ps) Remove paging space. PS must have been turned off and then the systemrebooted

    before it can be removed.Note : Need to change the swapon entry in /sbin/rc.boot script if you are changing the default pagingspace from /dev/hd6. You also need to do a "bosboot -a -d /dev/hdiskx" before the reboot./etc/swapspaces File that lists all paging space devices that are activated/swapon during reboot.--------------------------------------------------------------------------------SCHEDULING--------------------------------------------------------------------------------crontab -l List out crontab entryscrontab -e Edit crontab entryscrontab -l > (filename) Output crontab entrys to a file

    crontab (filename) Enter a crontab from a filecrontab -r Removes all crontab entryscrontab -v Displays crontab submission time./var/adm/cron/cron.allow File containing users allowed crontab use./var/adm/cron/cron.deny File containing users denied crontab use./var/adm/cron/crontab Directory containing users crontab entries.at (now + 2 minutes, 13:05, etc) {return} Schedule a job using atCommand or schell script {return}{CTRL D}at -latq Lists out jobs scheduled to run via at commandat -r (at job No)atrm (at job No) Removes an at job scheduled to run.

    /var/adm/cron/at.allow File containing users allowed at use./var/adm/cron/at.deny File containing users denied at use./var/adm/cron/atjobs Directory containing users at entries.--------------------------------------------------------------------------------SECURITY--------------------------------------------------------------------------------groups Lists out the groups that the user is a member ofsetgroups Shows user and process groupschmod abcd (filename) Changes files/directory permissionsWhere a is (4 SUID) + (2 SGID) + (1 SVTX)

  • 7/30/2019 aix cmds

    17/36

    b is (4 read) + (2 write) + (1 execute) permissions for ownerc is (4 read) + (2 write) + (1 execute) permissions for groupd is (4 read) + (2 write) + (1 execute) permissions for others-rwxrwxrwx -rwxrwxrwx -rwxrwxrwx| | |Owner Group Others-rwSrwxrwx = SUID -rwxrwSrwx = SGID drwxrwxrwt = SVTXchown (new owner) (filename) Changes file/directory ownerschgrp (new group) (filename) Changes file/directory groupschown (new owner).(new group) (filename) Do both !!!umask Displays umask settingsumask abc Changes users umask settingswhere ( 7 - a = new file read permissions)( 7 - b = new file write permissions)( 7 - c = new file execute permissions)eg umask 022 = new file permissions of 755 = read write and execute for ownerread ----- and execute for groupread ----- and execute for othermrgpwd > file.txt Creates a standard password file in file.txtpasswd Change current user passwordpwdadm (username) Change a users passwordpwdck -t ALL Verifies the correctness of local authenticationlsgroup ALL Lists all groups on the systemmkgroup (new group) Creates a group

    chgroup (attribute) (group) Change a group attributermgroup (group) Removes a group--------------------------------------------------------------------------------USERS--------------------------------------------------------------------------------passwd -f Change current users gecos (user description)passwd -s Change current users shellchfn (username) Changes users gecoschsh (username) (shell) Changes users shellenv Displays values of environment variablesprintenvid Displays current user's uid and gid detailsid (user) Displays user uid and gid details

    whoami Displays current user detailswho am i (or who -m)who / w Displays details of all users currently logged in.who -b Displays system reboot timeuptime Displays number of users logged in, time since last reboot, and the machine load averages.lslicense Displays number of current user licensesechlicense -u (number) Changes the number of user licenseslsuser ALL Lists all users detailslsuser (username) Lists details for userlsuser -a(attribute) (username or ALL) Lists user attributeslsuser -a home ALLmkuser -a(attributes) (newuser) Add a new user

    chuser (attributes) (user) Change a userchuser login=false (user) Lock a user accountrmuser -p (user) Removes a user and all entries in security filesusrck -t ALL Checks all the user entires are okay.fuser -u (logical volume) Displays processes using the files in that LVlsattr -D -l sys0 -a maxuproc Displays max number of processes per userchdev -l sys0 -a maxuproc=(number) Changes max number of processes per user--------------------------------------------------------------------------------REMOTE USERS--------------------------------------------------------------------------------

  • 7/30/2019 aix cmds

    18/36

    ruser -a -f (user) Adds entry into /etc/ftpusers fileruser -a -p (host) Adds entry into /etc/host.lpd fileruser -a -r (host) Adds entry into /etc/hosts.equiv fileruser -d -f (user) Deletes entry in /etc/ftpusers fileruser -d -p (host) Deletes entry in /etc/host.lpd fileruser -d -r (host) Deletes entry in /etc/hosts.equiv fileruser -s -F Shows all entries in /etc/ftpusers fileruser -s -P Shows all entries in /etc/host.lpd fileruser -s -R Shows all entries in /etc/hosts.equiv fileruser -X -F Deletes all entries in /etc/ftpusers fileruser -X -P Deletes all entries in /etc/host.lpd fileruser -X -R Deletes all entries in /etc/hosts.equiv file--------------------------------------------------------------------------------INITTAB--------------------------------------------------------------------------------telinit S Switches to single user mode.telinit 2 Switches to multi user mode.telinit q Re-examines /etc/inittablsitab -a Lists all entries in inittablsitab (ident eg tty1) Lists the tty1 entry in inittabmkitab ("details") Creates a new inittab entrychitab ("details") Ammends an existing inittab entryrmitab (ident eg tty1) Removes an inittab entry.chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1"

    --------------------------------------------------------------------------------ODM--------------------------------------------------------------------------------odmget -q "name=lp1" CuDv |more Gets lp1 info from pre-defined database.odmget -q "name-lp1" CuAt |more Gets lp1 info from customised database.odmdelete -o CuAt -q "name=lp1" Deletes lp1 info from customised db.odmget -q "name=lp1" CuAt > lp1.CuAt Export ODM info to text file.odmadd < lp1.CuAt Import ODM info from text file.--------------------------------------------------------------------------------ERROR LOGGING--------------------------------------------------------------------------------/usr/lib/errdemon -l Displays errorlog attributes./usr/lib/errdemon Starts error logging.

    /usr/lib/errstop Stops error logging.errpt Displays summary errorlog report.errpt -a Displays detailed errorlog report.errpt -j (identifier) Displays singe errorlog report.Note : errorlog classes are H=Hardware S=Software O=Information V=Undeterminederrclear (days) Deletes all error classes in the errorlog.errclear -d (class) (days) Deletes all error class entries in errlog.Note : The errclear command will delete all entries older than the numbers ofdays specified in the days paramenter. To delete ALL entries used 0.errlogger "message up to 230 chrs"Enters an operator notifaction message into the errorlog.--------------------------------------------------------------------------------PERFORMANCE MONITORING

    --------------------------------------------------------------------------------vmstat (drive) (interval) (count) Reports virtual memory statistics.vmstat hdisk0 5 20vmstat -s Diplays number of paging events since system start.vmstat -f Diplays number of forks since system start.vmstat -i Diplays number of interupts by device since system start.iostat (drive) (interval) (count) Reports i/o and cpu statistics.iostat hdisk0 5 20iostat -d (drive) (interval) (count) Limits report to drive statistics.iostat -t (interval) (count) Limits report to tty statistics.

  • 7/30/2019 aix cmds

    19/36

    sar -u -P ALL 10 10 Displays %usr %sys %wio %idle for all processors--------------------------------------------------------------------------------DOS DISKETTES--------------------------------------------------------------------------------dosdir Reads directory listing of a diskettedosdir (directory) Reads directory listing of a named directorydosread -D/dev/fd0 C41.TXT c41.txt Gets C41.TXT from diskette drive fd0dosread -D/dev/fd0 DIRECTORY/C41.TXT c41.txt(-D option can be dropped if using fd0)doswrite -D/dev/fd0 (unixfile) (dosfile) Writes a file to diskettedosdel (dosfile) Deletes a dos file on diskettedosformat Formats the diskette--------------------------------------------------------------------------------SENDMAIL--------------------------------------------------------------------------------sendmail -bi Creates new aliase db from /etc/aliase file.newaliasessendmail -bp Displays the contents of the mail queuemailqsendmail -q Processe the sendmail queue NOWsendmail -bt -d0.4 < /dev/nullPrints out sendmail version, compile defines and system informationrefresh -s sendmail Restart sendmailkill -l (sendmail PID)

    --------------------------------------------------------------------------------SP / PSSP--------------------------------------------------------------------------------dsh (command) Runs the command on all the nodesEfence Diplays which node are currently fencedEfence (node number) Fences the nodeEunfence (node number) Unfences the nodeEstart Starts the switchspmon -q Starts SP monitor in guispmon -d -G Diag info, lists LED and switch info for all nodesspmon -L frame1/node3 Displays LED for node 3 in frame 1spmon -p off frame1/node3 Powers off the nodespmon -p on frame1/node3 Powers on the node

    spled Diplays all the nodes LED's in a updating guis1term -w (frame number) (node number) Opens serial terminal (read and write)s1term (frame number) (node number) Opens serial terminal (read only)Example :- s1term 1 1 Opens a serial terminal to console port on frame 1 node 1which is readonly. When rebooting a node use read only.splstdata -e Lists site environment database information-d Displays df command from each node-n Lists node configuration-h Diplays lscfg command from each node-s Lists switch node information-b Lists boot/installation information-a Lists LAN database information

    -i Displays netstat -in command from each nodeAIX COMMAND GUIDEINTRODUCTIONThis is my unix command help file which has been built up over the years. This file was builtprimarily for my own reference and is not intended to be an authoratative guideto all commands forAIX - often if there is a very short description for a command, you can take this as RTFM. I am nota systems administrator, but have been called on to do the job occasionally (and

  • 7/30/2019 aix cmds

    20/36

    install a box or two)- this helpfile should be ideal for people who use AIX, but aren't responsible for the deep magicrequired for hardware configuration.You may find this file helpful despite the numerous omissions nonetheless. Thisfile was originally aplain text file but I have converted to HTML using Lemmy (A vi clone for Windows).Because it has been hand-converted from the original text document, there's a few hangovers from itthat I just can't be bothered to remove such as the caps headings. Additionally,some browsers maynot render certain characters.I've tried (and quite probably failed) to keep several conventions within this document - anycommand, if mentioned in the description of another command should have a bookmark link to thedescription of that command; all examples are in blue text - apologies to lynx users, but examplesshould be written so that they're recognisable anyway (and if you're using lynx,you probably knowunix quite well anyway so I don't really know why I'm apologising ;-). If a command has more thanone useful option, I've tried to put them into Unordered list tags.

    If a command stands almost alone, or is complex within itself, it doesn't appearin this file but in it'sown separate file (with a link if I've converted it to html. Examples are vi andawk.BASIC FILE HANDLINGls- list files in directory; use with options -l (long format) -a (list . files too) -r (reverse order) -t (newest appears first) -d (do not go beyond current directory) -i (show inodes)

    For a more detailed description of ls see ls -lmore- used to control input by pages - like the dos /p argument with dir. e.g.$ more /etc/motd******************************************************************************** ** ** Welcome to AIX Version 4.1! ** ** ** Please see the README file in /usr/lpp/bos for information pertinent to ** this release of the AIX Operating System. *

    * ** ********************************************************************************motd: ENDUseful keys for use with more: b (back a page) ' (go to top) v (vi the file) / (Search)

  • 7/30/2019 aix cmds

    21/36

    q (quit) ' ' (down a page) Control-G (View current line number (down a line)See also pg which is extremely similarpg- used to control input by pages - like the dos /p argument. pg performs the same function asthe more command but has different control, as it is based on exHelpful keys for pg: 1 (go to top) $ (go to bottom) h (help) / (Search) ? (Search back) q (quit) -1 (back a page)pwd- show present working directory. e.g.$ pwd/usr/live/data/epx/vss2To change the current working directory use cdcd- change directory (without arguments, this is the same as $ cd $HOME or $ cd ~)

    cp - copies a file from one location to another. e.g.$ cp /etc/hosts /etc/hosts.backup # make a backup of the hosts file$ cp /etc/motd /tmp/jon/ # Copy file /etc/motd to directory /tmp/jon/Options -f (to force the copy to occur) -r (to recursively copy a directory) -p (to attempt to preserve permissions when copying)synonym: copymv - move a file from one location to another. e.g.$ mv /tmp/jon/handycommands.txt . # move handycommands in /tmp/jon to currentdirectory

    $ mv -f vihelp vihelp.txt # Move file vihelp to vihelp.txt (forced)Options -f (to force the move to occur) -r (to recursively move a directory) -p (to attempt to preserve permissions when moving)synonym: move.rm - removes a file. e.g.$ rm /tmp/jon/*.unl # remove all *.unl files in /tmp/jon$ rm -r /tmp/jon/usr # remove all files recursively Options -f (to force the removal of the file) -r (to recursively remove a directory)

    duRecursively lists directories and their sizes. e.g.$ du /etc # list recursively all directories off /etc712 /etc/objrepos64 /etc/security/audit536 /etc/security104 /etc/uucp8 /etc/vg232 /etc/lpp/diagnostics/data240 /etc/lpp/diagnostics

  • 7/30/2019 aix cmds

    22/36

    248 /etc/lpp16 /etc/aliasesDB16 /etc/acct8 /etc/ncs8 /etc/sm8 /etc/sm.bak4384 /etcThe sizes displayed are in 512K blocks. To view this in 1024K blocks use the option -klp -d send file to printer. e.g. $ lp -dhplas14 /etc/motd # send file /etc/motd to printer hplas14$ lp /etc/motd # send file /etc/motd to default printercat- print a file to stdout (screen). e.g.$ cat /etc/motd # display file /etc/motd to screen******************************************************************************** ** ** Welcome to AIX Version 4.1! ** ** ** Please see the README file in /usr/lpp/bos for information pertinent to *

    * this release of the AIX Operating System. ** ** ********************************************************************************cat is also useful for concatenating several files. e.g.$ cat fontfile IN* > newfile # appends fontfile and all files beginning with INto newfileThough this might seem an essentially useless command, because most unix commandsalways take a filename argument, it does in fact come in extremely useful at more advancedlevels. Awards are given out occasionally for the most useless usage of cat. If

    an option of '-'is specified, cat will take its input from stdin.INPUTS, OUTPUTS AND WILDCARDSUnix commands generally get their information from the screen, and output to it.There arethree main 'streams' which unix uses to get/place it's information on. These streams arecalled: stdin (Standard Input) - normally, what you type into the screen stdout (Standard Output) - normally, what is output to the screen stderr (Standard Error) - normally, error messages which go to the screenany of these may be redirected by the following symbols: < take input from rather than the screen. e.g.

    $ ksh < x # will read all commands from the file x and execute them using the Kornshell. > take output from the command and place it in . e.g.$ ls > x will place the output of the command 'ls' in the file x >> take output from the command and append it to .e.g.$ ls /tmp >> x will place the output of the command 'ls' and append it to the file x 2> take any error messages from the command and put it in

  • 7/30/2019 aix cmds

    23/36

    .Ex:$ ls /tmp 2>/dev/null would throw away any error messages that are produced by ls(sorry, /dev/null is a file that, if written to, the information disappears never to be seenagain). command1 | command2 Pipe - Takes the standard output of the firstcommand, and turns it into the standard input of the second command. The outputofthe second command will then be put on the standard output (which, again, may beapipe) e.g.$ ls | more will send the output of 'ls' into the command 'more', thus producingadirectory listing which stops after every page. This method is called piping.command1 & - the ampersand (&) forces command1 to run in the background. so thatyoumay continue to type other commands in the shell, while command1 executes. It isnotadvisable to run a command in the background if it outputs to the screen, or takes it's inputfrom the screenSee also tee which allows splitting of the input stream and output to several di

    fferent placesat once.WildcardsB Bib Baby Fox FibThere are various wildcards which you may use. One is '*' which means 0 or morecharacters. e.g. 'B*' will match 'B,Bib and Baby' from the list above, another wildcard is '?'which matches 1 character, e.g. '?ib' will match 'Bib and Fib'. Wildcards differdepending onthe program in use: awk derivatives (awk,sed,grep,ex,vi,expr and others) have the followingspecial characters: ^ beginning of the line

    $ end of the line . any character * one or more of the preceding character .* any number of characters \n Carriage return \t Tab character \ Treat as is (so, \$ would try to match a '$')Given the following four lines:Chargeable calls in bundle: $47.50Chargeable calls out of bundle: $20.50Other bundle charges: $0.00Total Charge: $20.50$ grep "^Charg.*bundle.*\$.*"

    would match the first two lines.In english - match all lines which start with 'Charg', then have any number of characters andthen the word 'bundle', then have any number of characters, and then a dollar symbol, andthen have any number of characters following to the end of the lineOTHER FILE HANDLING COMMANDStype - show where the source of a command is: e.g.$ type sendmail

  • 7/30/2019 aix cmds

    24/36

    sendmail is /usr/sbin/sendmailThis command is merely an alias for 'whence -v'whence - show where the source of a command is: shell builtin command. See typeUse option: -v for verbose modewhich - show where the source of a command is held. Almost the same as type and whencechmod - change file permissions. e.g.$ chmod 666 handycommandschanges the permissions (seen by ls -l) of the file handycommands to -rw-rw-rwr= 4, w = 2, x = 1. In the above example if we wanted read and write permission for aparticular file then we would use r + w = 6. If we then wanted to have the filehave readwritepermissions for User, Group and All, then we would have permissions of 666.Therefore the command to change is that above.$ chmod 711 a.outChanges permissions to: -rwx--x--xAdditional explanation of file permissions and user/group/all meaning are givenin thedescription of ls -lYou may specify chmod differently - by expressing it in terms of + and - variables. For

    example$ chmod u+s /usr/bin/suwill modify the "sticky bit" on su, which allows it to gain the same access on the file as theowner of it. What it means is "add s permission to user". So a file that startedoff withpermissions of "-rwxr-xr-x" will change to "rwsr-xr-x" when the above command isexecuted. You may use "u" for owner permissions, "g" for group permissions and "a" for all.chown - Change ownership of a file. Must be done as root. e.g.chown informix *.dat # change all files ending .dat to be owned by informixchgrp

    - Change group ownership of a file. Must be done as root. e.g.chgrp sys /.netrc # change file /.netrc to be owned by the group sysmvdir - move a directory - can only be done within a volume group. To move a directorybetweenvolume groups you need to use mv -ror find -print | cpio -pdumv ; rm -r cpdir - copy a directory. See mvdirrmdir - this is crap - use rm -r insteadmkdir - Creates a directory. e.g.

    $ mkdir /tmp/jon/ # create directory called /tmp/jon/find -name "searchkey" -print- search for files - e.g.$ find . -name "system.log" -print # will find all files (with full path names)calledsystem.log - Wildcards are allowed, e.g.$ find /tmp -name "sl.*" -atime +0 -print # will print out all files in /tmp/ that start sl. andwhich haven't been accessed for a day. Helpful for finding lost files, or finding stuff in

  • 7/30/2019 aix cmds

    25/36

    enormous directories. Other useful options include: -atime + - finds files that haven't been accessed for 1+days also, ctime(creation time) and mtime (modify time) -prune - stay in current directory - don't look in dirs off the directory specifiedin path names - e.g.$ find /tmp -user "compgnc" -prune -print # will find all files in /tmp which usercompgnc owns and will not search lower directories (e.g. /tmp/usr) -size + - finds files that are bigger than -exec rm {} \; - remove all files found...dangerous command - e.g.$ find /tmp -name "sl.*" -atime +0 -prune -print -exec rm {} \; # will remove all filesin /tmp starting 'sl.' that haven't been accessed for a day. Spacing of this command isimportant! Most exec commands are possible:$ find /usr2/calltest -name "*.4gl" -print -exec grep "CHECK" {} \; | pg -ok - like exec only it prompts for confirmation after each occurence. e.g.$ find /tmp/disk7 -name "*" -print -ok doswrite -a {} {} \; # Please note that youMUST end any exec or ok option with an escaped semicolon (\;). -user - finds all files owned by -group - finds all files with a group of ln -s

    - create a symbolic link to a different directory from current directory: e.g.$ ln -s /usr/uniplex/compgnc /u/compgnc/uni # would create a link called 'uni' in thedirectory /u/compgnc. From then on, typing cd uni would cd to /usr/uniplex/compgnc. Youcan also give two files the same name. e.g.$ ln make.e_enquiry makefile # would link the two files so that they are identical, and whenyou change one, you change the other. You may also create a symbolic link to a host(!).Instead of typing 'rlogin hpserver' every time, by typing$ ln -s /usr/bin/rsh hpserver # will create a link so that whenever you type 'hpserver' it will

    execute a remote shell on the machine.Option -f forces the link to occurhead - - prints out the first few line of a file to screen. Specify number to indicatehow many lines(default is 10). e.g. If you sent something to a labels printer and it wasn't lined up, then youcould print the first few labels again using:$ head -45 label1.out | lp -dlocal1tail - - prints out the end of a file. Very similar to head but with a very useful option '-f' whichallows you to follow the end of a file as it is being created.e.g.

    $ tail -f vlink.log # follow end of vlink.log file as it is created.wc - - Word Count (wc) program. Counts the number of chars, words, and lines in a file or in apipe. Options: -l (lines) -c (chars) -w (words)To find out how many files there are in a directory do ls | wc -lsplit -

  • 7/30/2019 aix cmds

    26/36

    - Splits a file into several files.e.g.$ split -5000 CALLS1 # will split file CALLS1 into smaller files of 5000 lines each calledxaa, xab, xac, etc.tr - translates characters. e.g.$ cat handycommands | tr "\t" " " # will take the file handycommands and translate all tabsinto spaces. Useful when messing about with awk or you need to convert some input (e.g.that from tty) to a unique filename that does not contain special characters. e.g.$ tty | tr "/" "." # produces for example .dev.pts.7od - od converts nasty (binary save) files into character representations. Useful when backcompiling,examining raw .dat files,etc. Use with option '-c' for character display(recommended).script- starts recording everything in the shell to a file by default 'typescript'. Press ^D to finish thescript. Provides a log of everything used. Has almost the same effect as $ ksh |tee typescriptUsed for debugging shells, seeing error messages which flash off the screen too

    quickly, etc.cut- cut's the file or pipe into various fields. e.g.$ cut -d "|" -f1,2,3 active.unl # will take the file active.unl which is delimited by pipesymbols and print the first 3 fields options: -d -f Not too useful as you can't specify the delimiter as merely white space (defaults to tab)Alternatively, you can 'cut' up files by character positioning (useful with a fixed width file).e.g.

    $ cut -c8-28 "barcode.txt" # would cut columns 8 to 28 out of the barcode.txt file.paste- paste will join two files together horizontally rather than just tacking one on to the end ofthe other. e.g. If you had one file with two lines:Name:Employee Number:and another file with the lines:Fred BloggsE666then by doing:$ paste file1 file2 > file3 # this would then produce (in file3).

    Name: Fred BloggsEmployee Number: E666Note that paste puts horizontal tabs between the files, so you may need a sed 's/ //g'command to get rid of these.sort - sorts the information from the file and displays the result on standard output(stdout). e.g.$ sort /tmp/list_of_names # will sort the file into alphabetical order, and display it to the

  • 7/30/2019 aix cmds

    27/36

    screen. Useful with option '-u' to filter out duplicates.uniq - filters out all duplicate lines from a file or input stream (file or stream must be sorted!).Useful with option -c which merely produces a count of unique lines.ex - ex is an old line editor, and almost never used now (similar to DOS edlin if you rememberthat - me, I've repressed it). You are most likely to come across ex within thevi editor - allcommands beginning with a colon (:) are ex commandsEXTREMELY USEFUL COMMANDSls -l - lists files in a directory in long format. You cannot do without this. Here's a more detailedexplanation.Ex:. $ ls -lPart 1 Part 2 Part 3 Part 4 Part 5 Part 6 Part 7-rw-rw-rw- 1 root staff 28 Jan 16 09:52 README-rw------- 1 compjmd staff 4304 Jun 24 12:21 tabledictdrwxrwxrwx 2 compjmd staff 512 Jul 1 16:30 testdir-rwxrwx--- 1 compjmd system 0 Jul 1 16:30 a.out... is a sample listing. Part 1: Permissions - see chmod for explanation of these. If the first field isset, then the file in question is not really a file at all, but something else,

    key:o -: normal fileo d: directoryo l: symbolic link created by 'ln'o c or b: device of some sortYou may sometimes see an 's' where the 'x' should be in the permissions - this isnormally on executable files which change other files. e.g. Permissions of 'sqlexec'the file that executes all informix queries should be '-rwsr-sr-x' - this then accessestables with permissions of '-rw-rw----'. where the table files are owned by informix

    (group informix). the 's' flags allows changing of the database tables on a programlevel, but not on a unix level. (can change contents via sqlexec but not use 'rm'command on db file). Part 2: Number of links to this file (directories always have 2+). Part 3: The owner of the file - e.g. If the owner is 'compjmd' and permissionsare set to -rw------- then only the user 'compjmd' may read or write to that file. Again,if owner is "compjmd" and permissions are -r-x------ then only the user compjmdmay read or execute that file. Only the owner of a file or root may chmod it. Part 4: The group ownership of the file - (bloody hell, this is gettingcomplicated). On a unix system there are certain 'groups' which users can belong

    to,held in the file '/etc/group'. You will notice that in this file there will be amain group,e.g. 'staff' which contains every user. Which means that any user listed under staff isin that group.....right...every file has a group attached to it. Which means that if a filehad permissions ----rw---- and a group reference of 'system', then only users whowere part of the group system could modify that file. To see which groups the cu

  • 7/30/2019 aix cmds

    28/36

    rrentuser belongs to do id. Sorry if this wasn't comprehensible but you should neverneedto use this anyway(!). Part 5: Size of the file in bytes Part 6: Time of last modification Part 7: The name of the fileUseful options (and there are loads more). All may be combined except where specified: ls -a show files starting with '.' too ls -A show files starting with '.' but not '.' or '..' ls -c must be used with either option l and/or t - displays/sorts by modificationtime ls -d do not show subdirectory listings ls -i display the i-node number of each file ls -t Put the listing in time order (see options u and c) ls -r Put the listing in reverse order - usually used with a -t ls -u must be used with either options l and/or t - displays/sorts by last-accesstimevi - love it or loathe it - the standard operating system text-file editor. See Related help file. Vi

    You can also use 'view' which forces Read only (-R opt). vi + enters thefile at thespecified line no. Also, vi +/ will enter the file and move to the firstoccurrence of . e.g.$ vi +/"love it or loathe it" handycommandsUsers new to vi hate it. I personally managed to get through University withoutusing it ever(I used Joe's own editor instead). If I accidentally went into vi, I had to ^Z and kill the job.Sigh. Five years of using vi means that I'm getting a little better at it now...(I'm actuallytyping this now in a vi-clone for Windows).

    grep - a phenomenally useful command which matches strings within files - e.g.$ grep D7523 mcall_reps.out # will find all the lines in mcall_reps.out that have the string"D7523" in it. Also incredibly useful for things like pipes,e.g.$ du | grep cred # (in /home directory will show all users that have 'cred' in their title). Youmay use regular expression matching - e.g.$ grep "main.*{" x.c # would match any line containing 'main' and an open curlybrackets atany point in the line afterwards. There are two variations to grep - fgrep and egrep which dovirtually the same things as grep, but are either faster (having less options) o

    r more complex(but slower). See also section on WildcardsOptions: -v : show all lines that do not contain pattern. -y : don't bother matching case -i : don't bother matching case -c : show count of matching lines rather than the lines themselves -l : show filename's instead of matching lines.ksh -o vi- The Korn Shell - pros might notice that I don't mention using the C-Shell at a

  • 7/30/2019 aix cmds

    29/36

    ll - I've neverused it, so that's why it doesn't appear. A Shell is a program that you run yourcommands in.Typing exit will end the current shell. The -o vi option of the korn shell allows vi commandsto work at the shell prompt after pressing escape. For example, pressing escapeand then 'k'will bring up the last command used in the shell.awk- this would be a damn useful command if I knew how to use it properly. see alternative pageawkhelpman - look at the manual, e.g.$ man ps # will list the manual page for the command psGENERAL INFORMATION COMMANDSsmon- monitor's system usage - F5 shows processes which are hogging the machine. Notavailableon AIX 4.1 and above sadly.uptime- shows how long the system has been up and how hard it is being hammered. The loadaverage fields show how many jobs on average are waiting. 10 the machine is being seriously hammered.who- list users who are currently logged on (useful with option 'am i' - i.e. 'whoam i' or'whoami')w- list users and what they are doing, including idle time. The first line is theoutput fromuptimeid- similar to whoami except that it does a direct check to see who you are - whoonly

    checks /etc/utmp so any su commands will be ignored.ps- list processes currently running, by default on the current shell. Useful withoptions: -t - show all processes running on a terminal -ef - show all processes -u - show all processes owned by a user -flp - show as much information as you can about a processnumber -aux - show processes in order of usage of the processors. Useful to see whatprocesses are hogging system resources.fuser -u - show who is using a file.(system hogging command). Useful when trying to work

    out whohas locked a row or table in an informix database for example.lpstat -p - show the current status of a printer and any jobs in the queue. lpstat withoutargumentsprints all of them.enable - enable a printer queue. You must be root or a member of the printq group to run thiscommand.

  • 7/30/2019 aix cmds

    30/36

    disable - disable a printer queue. You must be root or a member of the printq group to run thiscommand.enq - examine spool queue for printers.uname -a- will show you what machine you're currently on.ipcs- list semaphores and shared memory.ipcrm -s - remove semaphore or shared memory.crontab- use -l to list all regular scheduled jobs. To alter them, use option -eat - perform a job at a specified time. (Useful for running something at a later date). at retainsthe current environment. e.g.$ at now + 5 minutesecho "Phone Julie McNally" > /dev/tty616^Djob compjmd.389748732 will be run at ???Will echo to tty616 the message "Phone Julie McNally" in 5 minutes. e.g.2$ at 0331235930

    echo "April fools day!" > /dev/console^Dwill echo "April fools day!" to the console at 11:59 and 30 seconds, on the 31stof march.Format for this is: [YYYY]MMDDhhmmss. at jobs are sometimes used in the place ofcrontab's because if the machine is off when the crontab is meant to take place,the job neverhappens. at jobs automatically start when the machine is switched on if the machine wasdown at the time. typing at -l will show you all the at jobs you have queued, at-r will remove an at job (only the owner or root is allowed to do this).date

    - show current date and time. This command may also be used to set the system clock(ONLY WHEN EVERYONE IS LOGGED OFF) with a root user id. A date change is neversimple, even when adjusting things by an hour. The safest way to do it is to change the datethen reboot the machine because otherwise the crontab daemon may start doing jobs at oddtimes. I believe there might be a 'go slow/fast' option to set the clock, and the clock will thenrun 'slower/quicker' until it catches up with the required time.last - shows a list of recent logins. It looks at /var/adm/wtmp so it only shows initial logins, and

    not whether those users have been su'd to.fileplace -pv - show the physical (as in disk location) location of a file. Useful for tracinginformix files,and perhaps for working out whether defragmentation copying is required.SYSTEM COMMANDSkill - - sends a signal (normally a kill) to a process. kill -9 terminates the job no questions asked,kill -15 tries to clear up as much as possible - e.g. remove semaphores and such

  • 7/30/2019 aix cmds

    31/36

    -like. Othersignals may be sent as well, see manual and /usr/include/sys/signal.h to see what signals youcan send to a process.renice - make a process not hog the system so much by setting its nice value.smit- system admin program for AIXdf- list volume groups + usage. see also lsvg. Usually used with the -k flag so the number ofblocks is displayed in 1024-blocks.cu -l - log on to device such as a pad or a modem. See related files /etc/uucp/* and /etc/locksand /etc/servicesstty sane- Changes terminal settings back to normal. If a tetra module for example crashes yourscreen so that no keys function except ^C which doesn't even do very much then typing^Jstty sane^J should cure the problem. To fully cure the problem you also need to type sttytab3 (and stty -ixon if you're feeling a little overzealous)

    stty- allows you to change terminal settings such as the interrupt key, quit key, etc. e.g.$ stty intr ^A # would change the interrupt key to being control-A$ stty quit ^L #would set the quit key (normally ^\) to control-L. other key changes are: erase (normally ^H) xon (normally ^Q) xoff (normally ^S) eof (normally ^D)To really annoy a systems administrator, change interrupt to 't' and quit to '^D' .hehehehehehe

    lscfg- show all connected deviceslsvg- list volume groups (see related file diskhelp)lspv- list physical disks (and see related file diskhelp)lspv without arguments will produce a list of all the hard-disks used. lspv will produce a list of information about the hard disk. lspv -l will showany logical volumes which are mapped on to that drive.lsdev- list devices. Options:

    -C list Configured devices -P list Possible devicesproduces different output when you are root.mkdev- make devices. e.g. To make a tty:# Script to add a tty. Options that need amending are:# -l name of tty to be created - e.g '-l tty600' wil create# a tty called 'tty600'# -p RAN name# -w Port number on RAN

  • 7/30/2019 aix cmds

    32/36

    # -a Attributes (e.g. to set up auto login, etc.)mkdev -c tty -t 'tty' -s 'rs232' -l tty433 -p sa2 -w 2 -a term='wyse50' -a forcedcd='enable' -alogin='enable' -a speed='19200'e.g. To create a printer (raw device):mkdev -c printer -t 'osp' -s 'rs232' -p 'sa3' -w '10' -l label2 -a xon='yes' -adtr='no' -a col=500It is highly recommended that you make and change devices using smitchdev- change devices. See mkdevcc- c compiler, use with -o to specify a target instead of a.out -O optimise -w or -W all warning flags.shutdown- shutdown the system so that it may be switched off. Rather obviously, this mayonly be runby root. Options: -f shuts the system down immediately (rather than waiting for a minute) -R reboot the system immediately after haltoslevel- show the current revision of the operating system.CONNECTIVITY

    exit- end current shell process. If you log in, then type this command, it will return you to login.^D (control-D) and logout (in some shells) does the same.rlogin- login to a remote machine, e.g.$ rlogin hollandrs # log in to machine called hollandrsUseful with -l option to specify username - e.g.$ rlogin cityrs -l ismsdev # log in to machine cityrs as user ismsdev For further info abouttrust network see .rhosts file and /etc/resolv.conf (I think).telnet- very similar to rlogin except that it is more flexible (just type telnet with

    no arguments andthen '?' to see the options). Useful because you can specify a telnet to a different port.ftp- File Transfer Protocol - a quick and easy method for transferring files between machines.The .netrc file in your $HOME directory holds initial commands. type ftp withoutargumentsand then '?' to see options)rcp- Remote copy. Copies a file from one unix box to another, as long as they trusteach other(see .rhosts file or /etc/resolv.conf I think). Options

    -f (to force the copy to occur) -r (to recursively copy a directory) -p (to attempt to preserve permissions when copying)su - - switch user, option '-' means that the users .profile is run, without option you merelyassume the id and permissions of the user, without (for example) changing PATH andDBPATH, e.g.$ su - root # become root

  • 7/30/2019 aix cmds

    33/36

    $ su root # gain permissions of root but don't change the current environment variables$ su - vlink # switch to user vlinkIf you are root, you may su to any other user without being prompted for a password. suwithout arguments is the same as 'su root'. Note that the 'su' option is not available on allUNIX machines as it can crash some of them.ping - check that is alive and well (do not expect an immediate response from amachine that is linked over an ISDN line). Firewalls often block ping packets after the Pingof Death so quite often you'll find you can't ping internet sites either. Options include: -q ping quietly -i wait no of seconds between each packet sending. The default is 1second. If you are using ping to keep an ISDN line up then using something like$ping -i 5 -q hollandrs is ideal. -f Never use this! Sends as many packets as it possibly can as fast as possible,used for network debugging and is likely to slow networks horribly when used.Known as 'flood' pinging. -c send no of packets before giving up

    To check that your machine can ping, try pinging 127.0.0.1 - this acts as a feedback loop,checking the network card's ability to ping.rsh - remote shell - e.g.$ rsh altos more /tmp/chk # will run the command more the file /tmp/chk on the machinecalled altos. Useful in pipes for example. rsh on its own will execute a login.Use option '-l'to specify logon name. You can also use rcmd and remsh on other flavours of unix.host - lookup the ip address in the /etc/hosts file and give its name

    TAPES AND DISKSPlease see this page for more information on disks in AIXdd if= of= bs= conv=sync- direct (and I mean DIRECT) copy, normally to tape. Archaic syntax and very rarely used.flags: if - input filename or device of - output filename bs - block size conv - ??e.g. To write a file to tape use$ dd if=/etc/hosts of=/dev/rmt0 bs=1024 conv=sync # write hosts file to tape using dd

    cpiostands for copy in-out, and is extremely powerful if you can cope with the innumerable flagsthat you have to use(!)$ cpio -iBcvumd "etc/hosts" /dev/rmt0 # Write the contents of the /etc directory to tape$ find /etc -print | cpio -pdumv /usr2/etcbackup/ # copy directory /etc to /usr2/etcbackup andretain all permissions.

  • 7/30/2019 aix cmds

    34/36

    meaning of the flags: i - input o - output B - Block size of 5120 bytes c - read/write header info v - list file names u - unconditional copy - overwrites existing file. m - keep modification dates d - creates directories as needed. t - generate listing of what is on the tape. p - preserve permissions.tapeutil -f - A program which came with the tape library to control it's working. Called withoutarguments gives a menu. Is useful for doing things like moving tapes from the slot to thedrive. e.g.$ tapeutil -f /dev/smc0 move -s 10 -d 23 # which moves the tape in slot 10 to the drive(obviously, this will depend on your own individual tape library, may I suggestthe manual?).doswrite -a - copy unixfile to rs6000's floppy disk drive in DOS format. -a option expands certain

    characters, for certain ascii conversions.dosdir - show list of files on a dos floppy disk. Useful with option -l (long format).Like doscommand 'dir'dosread -a - copy dos file in floppy disk drive to unix - if UNIXFILE is omitted, it outputs to the screen.dosdel - delete dos file on floppy disk.dosformat- format dos floppy disk (High Density)tar

    - Read/Write stuff to archive.tar cvf /dev/rmt0 # will write files to tapetar xvf /dev/rmt0 will read files from tapetar tvf /dev/rmt0 will give a listing of what's on the tape. If you're using anarchive file thenreplace /dev/rmt0 in the examples above with the name of the archive file.SCREEN COMMUNICATIONecho- a command mainly used in shell scripts. Examples:$ echo "Hello" # will print Hello on your screen$ echo "Hello" > /dev/tty616 # will print Hello on someone elses screen (warning- can crashtheir screen!)

    $ echo $DESTF10 # will print the value of the environment variable DESTF10$ echo "\033Fdemo demo" # will echo demo to the status bar at the top of a wyseterminalSee also file shellscriptsread- will read text from standard input and place it in the variable name specified. See fileshellscriptsline- waits until the user presses return before carrying on (writes what is typed t

  • 7/30/2019 aix cmds

    35/36

    o standardoutput). If used in a crontab/at job this instruction is ignored. See file shellscriptstalk - set up an interactive communication dialogue box between two users. Looks goodbut isn'treally that useful.write - writes a message to someone elses screen. Try typing 'write root' and then type a message,finishing with control-D.banner - writes in huge letters across your screen! (max: 10 chars per word)wall - send a message to all people on a system. Can only be executed by root (I think).tput - tty type independent attribute setting (requires TERM variable and TERMCAP tobe set). Ionly know these few bits: tput cnorm - turns the screen cursor on tput civis - turns the screen cursor off tput clear - clears the screen tput smso - turns all new text to bold

    tput rmso - turns all bold text offtee (-a) - command used in pipes to take a copy of the standard output. e.g.$ ls | tee /tmp/x # would output ls normally and put a copy in /tmp/x. The option '-a' is usedto append rather than replace files.SOURCE CODE CONTROL SYSTEM (SCCS)SCCS OverviewThe source code control system allows versions of a program to be stored in a special file, so thatany version may be retrieved. There are a few commands involved (not all of themlisted here). Allsource code files start with 's.'

    get -r - get a program out of source code to read only. Missing out the -r flag gets the most recentversion. e.g.$ get $SCUK/s.parser.c # extracts file parser.c from source code file $SCUK/s.parser.c asread only. See get -e for editing.get -e - get a piece of code out for edit, so that the code may be modified and a new version createdusing 'delta'. e.g.$ get -e $SCUK/s.parser.c # extracts file parser.c from source code file $SCUK/s.parser.c for

    editing. See get for read-only.delta - you must be in the directory with the modified piece of code when you executethiscommand. This adds the latest version to the source code file. e.g.$ delta $SCUK/s.parser.c # writes file parser.c to the source code file $SCUK/s.parser.c . Seeget -e for information on how to extract the file from source code.prs - show comments/details on source code file.

  • 7/30/2019 aix cmds

    36/36

    admin -r -i - create a new source code file with progam. -r specifies the initial revision of the programand may be missed out (default is 1.1 I think). Must be spaced correctly! adminis also usedfor sccs administration, but it gets to fear and loathing time pretty fast. e.g.admin -iparser.c $SCUK/s.parser.c # creates a new source code file called $SCUK/s.parser.cfrom the file parser.cunget - cancels a get -eMISCELLANEOUSstrip - Removes all linking information within a compiled program - basically a way ofcuttingdown the size of an executable.yes - yes outputs the word 'yes' as fast as its' little legs can go. Never called onit's own. Alwaysused in pipes. For example:$ yes | rm *.o # would confirm 'yes' whenever rm prompts for confirmation. You can alsouse it to output a different word e.g.$ yes please # would output 'please' to the screen until you kill it (prob. imme

    diately).SHELL SCRIPT COMMANDSAre all held on a separate page now. Commands covered are export,if,for, shift,test, while, case,and a few others.sed ''- used by myself for quick substitutions when tr doesn't seem to be doing its job properly.The syntax of the pattern is similar to vi ex command line. E.g. To substitute all spaces withcolon symbols the command issed 's/ /:/g' file1 # substitute all occurrences of spaces with colons in file1and output to

    stdout.-------------- End of HandyCommands File ------------


Recommended