Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

General Commands

#errpt | pg Generates an error report

where timestamp=0917140307 means the error was occurred on 17/09/07 at 14:03PM

#errpt -a | pg =====> Produces a detailed report for each entry in the error log

#date ==èDisplays or sets the date/time. Date format is: mmddHHMM.SSyy

eg: date 02030830.0054 (This sets the date/time to Feb 03 08:30:00 CST 1954)

#clear =è command to clear the Screen.

# find==èFinds files with matching expressions.

Search all file systems for any file named java

  • # head ==Displays the first 10 lines (default) of a file.

The above command display the first 25 line of aler_PS1.log.

  • # tail ==Displays the Last 10 lines (default) of a file

# tail  -25 alert_PS1.log command shows the last 25 line of the log file.

  • #uname==è

The  above command displays system name, operating system version, LAN network number, type of hardware running and so on

  • #su – root

  • #su root =è

  • #stopsrc –a==èGracefully shuts down all subsystems controlled by the SRC - System Resource Controller.

  • #shutdown =è
  • #shutdown –F =è
  • #shutdown –Fr =ècommand to restart the system.

  • # kill==èSends a signal to stop or suspend a process from running

#kill <process id> =>to kill that process

  • #kill -9 <process id>=è

  • #last==èDisplay information about previous logins stored in the /usr/adm/wtmp accounting file
  • #last reboot | head -5=èList last 5 times systems has been rebooted
  • #last root =è
  • #clear =è command to Clear the Screen

  • #set –o vi=èEnable command line editing/playback

#HOME/.sh_history=èContains the history of user commands executed on the command line for each login session.Here home is nothing but root directory.For smitty logs also u can find it in root directory smit  #more smit.log

#chfs -a size=+500M /usr/acct (To enlarge file system of 500M, for GB u have to mention G instead of M i.e chfs –a size=+1G /usr/acct)

#chfs -a size=-500M /usr/acct (To decrease the file system  sizeof 500M, for GB u have to mention G instead of M i.e chfs –a size=-1G /usr/acct)

  • #lpstat -t =èList spoolers and and existing jobs

Installation Commands

  • #lslpp    =è
  • #lslpp –l | pg =èList of license program products installed

  • #lslpp –h | pg =èShows history (version level) of license program products

  • #hostname èDisplays the Current hostname of the system

  • lscfg (lists installed devices, -v for versions or -c)
  • lsgroup (lists user groups)
  • lsuser (lists users)
  • lsdev -C -c <class> -H (lists devices)
  • lsattr -l <class> -a <item> -E (for current)
    • class values =tty, printer, tape, disk, adapter, dlc, bus, diskette, if, memory, logical_volume, mouse, port

Definitions

Examples

What it means

PHYSICAL PARTITION (PP)

Smallest unit a PV is divided into (4 MB partition size)

LOGICAL PARITITION (LP)

One or more PPs. LP represents a mirrored copy of a PP. Up to two copies of a PP can be mirrored resulting in a LP count of three (2 mirrors plus original).

LOGICAL VOLUME (LV)

One or more PPs. A file system resides on top of an LV. Only one LV is mapped to a file system. A LV can't span across a VG. Up to 255 LVs in a VG

VOLUME GROUP (VG)

One or more PVs. A collection of PVs that users view as a single oversized PV. A VG can consist of any mixture of physical disk types (size=320,355,400,670,800,857 MB), though performance is most consistent if devices of the same size are used in a single VG. Up to 32 VGs per system.

PHYSICAL VOLUME (PV)

One or more LVs. Represents a hard disk (hdisk0).

AREA (VGDA)

Information about all the LVs and PVs within a VG. First 64K of a PV is reserved for this area - defined in <sys/bootrecord.h>. The VGDA consists of

  • BOOTRECORD: - first 512 bytes. Allows the Read Only System (ROS) to boot system
  • BAD BLK DIRECTORY - found in <sys/bddir.h>
  • LVM RECORD - found in <lvmrec.h>
AREA (VGSA)

Informations about which PPs are stale and which PVs are missing within a VG. The LVM and SCSI driver reserves somewhere between 7-10% of the available disk space for LVM maps, etc.

Logical Volume Set-up

All system LVs (hd1..hd8, hd9var) should reside in the VG named rootvg, under one PV if possible. This will allow complete re-installation of the system from your 'mksysb' tape without affecting the application data that resides on your other VGs.

There is no difference in response time between a single or multiple VGs. When an LV is accessed

  • The ODM database (/etc/objrepos/*) is searched to determine which VG the LV belongs to.
  • Then the VGDA for that VG is read to determine the physical placement of the LV on that PV and ultimately the physical track and sector where the data resides.

chlv

  Changes the attributes for an LV 

Examples

What it does

chlv -x 256 hd1

When creating large LVs or extending an existing LV to over 512 MB (assuming PP SIZE=4) in size, the following error message will be displayed: 516-787 extendlv: Maximum allocation for logical volume h1 is 128. To resolve this problem, perform the above command where 256 represents the MAXIMUM number of logical partitions that can be allocated for that LV. This command can be executed while the file system (residing on top of the LV) is mounted.

chlv -n informixlv lv00

Changes the name of LV from lv00 to informixlv. If there is a filesystem mounted on top of that LV, the file system must be unmounted and the LV must be in a closed state for this command to work.
chlv -n <NEW LV> <OLD_LV>

top of page


 

cplv

Copy the contents from one LV to a new or existing LV

Examples

What it does

cplv -e newroot hd4

Copies the LV hd4 to an LV named newroot. If newroot doesn't exist, it will be created. If newroot is smaller than hd4, the extra PPs from hd4 won't be copied to the desintation LV newroot

top of page


 

chpv

Change the characteristics of a physical volume

Examples

What it does

chpv -a n hdisk2

Prohibits the allocation of additional PPs on PV hdisk2

chpv -vr hdisk2

Temporarily removes a PV from a VG (normally used for maintenance) This command removes the VGDA and VGSA copies from the PV, thereby affecting the number of copies required for a quorum.

chpv -va hdisk2

Returns an inactive PV back to the VG

top of page


 

chvg

Examples

What it does

chvg -Qn rootvg

This will turn quorum checking off (default is on). Afterwords, the volume group must be varied off and back on again to cause the change to take effect. In the case of rootvg, this means a reboot.

top of page


 

exportvg

Used to export a VG from one system so that it can be imported by another. This command will erase all data referencing the VG being exported from the ODM database, but won't remove this information from the VGDA (undefines the VG on the system). The information deleted from the ODM but not the VGDA is the LV and VG entries.

To manually transport a VG between systems, the normal process is to varyoff and export the volume group on System A:

varyoffvg VG
exportvg VG

Then move the drives to System B followed by importing them and finally varying them on:

importvg -y VG PV
varyonvg VG

exportvg vg2
importvg -y vg2 hdisk1
#hdisk1 is PV that belongs to VG named vg2
varyonvg vg2

The above steps can be used to correct the ODM when it is not in sync with the VGDA

top of page


 

extendvg

Add a new physical drive to a volume group

Examples

What it does

extendvg datavg hdisk3

Adds the PV hdisk3 to VG datavg. This increases the size of the VG by adding one or more PVs.

top of page


 

getlvodm

Examples

What it does

getlvodm -u rootvg

Will determine whether the ODM or VGDA has the correct copy of the VGDA. If the above command returns the character 'y' for the VG specified, then the ODM database is correct and the VGDA is out-of-sync. To correct the situation when the VGDA doesn't have a good copy, perform the following steps:

  1. importvg -y vg2 -f hdisk1 use force option
  2. varyonvg -f vg2 use force option
  3. copy data off drive
  4. reducevg vg2 hdisk1
  5. rmdev -l hdisk1 -d
  6. cfgmgr
  7. extendvg vg2 hdisk1
  8. add file systems
  9. restore data previously backed off to tape

  top of page 


 

importvg

Used to import a VG from a system that exported it. This command will restore the ODM database from information read from the VGDA. When a VG is imported, /etc/filesystems will be updated with any entry points needed for those LV's and mount points not currently defined.

top of page


 

ipl_varyon

Examples

What it does

ipl_varyon -i

Indicates which PV is your BOOT drive

top of page


 

lqueryvg

Examples

What it does

lqueryvg -p hdisk0 -v

List the VG id in which the PV hdisk0 resides

lqueryvg -p hdisk0 -L

List all the LV ids/names in the VG where PV hdisk0 resides

lqueryvg -p hdisk3 -P

Lists all the PV ids that reside in the VG where hdisk3 resides

top of page


 

lslv

List characteristics about a logical volume

Examples

What it does

lslv hd3

Display attributes of the LV hd3

lslv -l hd3

List distribution of where LV hd3 resides on PV hdisk1

lslv -m hd3

List distribution of PPs where LV hd3 resides on PV hdisk1

  • MAX Lps: If LV created is larger than 512 MB (128 * 4), then this field needs to be upped by the following formula: (LV size in megabytes) / PP size = MAX LP count 900 MB / 4 = 225 The command to change the LP count to 225 for an LV named pick is: chlv -x 225 pick
  • COPIES:
    • value is 1= original copy
    • value is 2= first mirrored copy
    • value is 3 = second mirrored copy
  • STALE PPs: If COPIES > 1 and STALE PPs > 0, means that a mirrored LP is not available or current with other LPs.
  • INTER-POLICY:
    • If set to MIN, an LV will only reside on 1 drive
    • If set to MAX, an LV can span multiple LVs. Distributes an LV among more than 1 PV.
  • INTRA-POLICY: Has 3 values (edge, middle, center). When an LV is created, it will be assigned 1 of the 3 allocation strategies listed above.
  • EFFICENCY: Represents the efficency with which PPs are allocated based on the 3 possible states of the intra-policy.
  • RELOCATABLE : If yes, then the 'reorgvg' command is allowed to move the LV to a new position on the current PV or be placed on another PV.
  • SCHEDULING POLICY: If set to PARALLEL, insures writes to mirrored copies are performed to seperate PVs in parallel.
  • WRITE-VERIFY: If set to NO, will not perform a follow-up read to each write for verification.
  • MIRROR WRITE CONSISTENCY: When enabled, suffer a 20% performance penality. Use the syncvg -v <VG> command to resync disk drives in a VG that loses a PV.

  top of page 


 

lsps

List characteristics of paging space(s).

PAGING SPACE LOW messages will be generated when 512 pages remain free in the pool of free pages. Processes will be terminated when only 128 pages of free memory are left.

AIX determines which users have the most page space allocated to them and selects those processes for termination. All real memory allocated to a process will have a backing store of equal size (for every page of real memory allocated, there will be a page of disk space from paging space allocated)

Its recommended that the first paging space (/dev/hd6) be larger, since this one is brought on sooner than the rest, resulting in being more full than the others.

Thrashing should not be confused with the problem of low paging space. Low paging space is the condition in which the amount of paging space is insufficient. Thrashing is the condition in which the amount of RAM is insufficient. Low paging space involves the consumption of disk space; thrashing involves the consumption of RAM and disk I/O.

Example: lsps -a (Display attributes of all paging spaces)

#lsps –s (Displays Total Paging Space)

LV hd6 is the default paging space. If more than one paging LV is defined, hd6 will always have a higher percentage of utilization since this is the first paging LV turned on at boot time. Once all the other paging LVs have been swapped on, paging is allocated on a round robin basis - four pages (pagesize is 4k ) at a time.

80% (MAXPERM) of real memory is to be used by persistent storage. Persistent storage is information that is not paged to the page space (/dev/hd6) but rather is paged to the physical volume where that file resides.


 

lspv

List charactertistics of a physical volume

Examples

What it does

lspv hdisk0

Stale partitions refers to mirroring. If the PV has no mirrored LPs, then the value for this field is zero.

lspv -l hdisk0

Display distribution of what LVs reside on the PV named hdisk0

lspv -p hdisk0

Display distribution of PPs for each LV that resides on the PV named hdisk0

Physical Volume information .i.e.,Hard Disk information on the server

Command to give the detailed information about the harddisk .here it is hdisk1

Total PP size is total size of the Hard disk.

Free PP size is the Unused Space of the HDD

Used PP size is the Used Space of the HDD.


 

lsvg

List characteristics about volume groups

Examples

What it does

lsvg rootvg

Display attributes for VG rootvg

lsvg -p rootvg

Display PV distribution about VG rootvg

lsvg -o

Lists all active VGs in the system

Volume group Informaion

Rootvg information

Note :similaraly u can generate datavg information also,

Instead of rootvg,type datavg


 

migratepv

Moves one or more LVs to one or more PVs. If '/dev/hd5' is moved to another drive, a spcial step is required, else the system will not boot the next time it's rebooted.

Examples

What it does

migratepv hdisk0 hdisk1

Moves all LVs from hdisk0 to hdisk1

migratepv -l hd1 hdisk2 hdisk1

Copies all PPs for LV hd1 from hdisk2 and places them on a PV named hdisk1

top of page


 

mklv

Creates a logical volume on a physical volume

Examples

What it does

1) mklv -y hd7 -t sysdump -a e rootvg 2 hdisk0
2) sysdumpdev -P -p /dev/hd7

The first command will create a LV dump device named hd7 that consists of 2 PPs located on the edge of PV hdisk0. The second command will assign the system dump device to LV /dev/hd7.

1) mklv -y hd5 -t boot -a e rootvg 2 hdisk2
OR
1) migratepv -l hd5 hdisk0 hdisk2
2) bosboot -a -l /dev/hd5 -d /dev/hdisk2
3) bootlist -m normal hdisk2

Creates and updates a new boot logical volume (hd5) on PV hdisk1. When you move the /blv (boot) file system, you MUST change the disk from which the system tries to boot from to NORMAL mode.

top of page


 

mklvcopy

Makes a mirrored copy of an LV. Note that this command will allocate PPs for the next copy, but the data within is not updated. This must be performed by the syncvg command.

Examples

What it does

1) mklvcopy hd1 2 hdisk1
2) mklvcopy hd2 2 hdisk1
3) mklvcopy hd3 2 hdisk1
4) mklvcopy hd4 2 hdisk1
5) mklvcopy hd5 2 hdisk1
6) mklvcopy hd6 2 hdisk1
7) mklvcopy hd7 2 hdisk1
😎 mklvcopy hd8 2 hdisk1
9) syncvg -v rootvg

Will mirror the operating system so that the system may bebooted from either disk in the case of a disk drive failure. The syncvg command will insure that all LVs just copied will be in synchronized with each other.

  • The third parameter ('2') means make a copy of the original LV (hd?) on the PV named hdisk1.
  • If the third parameter was a '3', then each LV would have 3 copies total - 2 mirrored copies and the original.
1) mklvcopy -m lv00.map lv00 2
2) syncvg -l lv00

When creating the LV named lv00, use the map file named lv00.map. Using the syncvg command will update the mirror copy.

top of page


 

putlvodm

Reads LV data from the command line and writes it to appropriate ODM (Object Data Manager) class fields.

Examples

What it does

putlvodm -K `getlvodm -v rootvg`

Unlocks a VG so that the LVM commands can access or change information about a particular LVM device.

If the message 0516-366 lsvg: Volume group rootvg is locked is ever seen, the above command will unlock the VG in question.

top of page


 

redefinevg

Determines which PVs belong to the specified VG and re-enters this information into the ODM. This command is typically used to fix inconsistencies in the ODM database by reading a copy of the VGDA and recreating the ODM entries as needed.

Examples

What it does

redefinevg -d hdisk0 rootvg

Updates the ODM for a specific VG with the information stored in the VGDA

top of page


 

reducevg

Removes one or more PVs from a VG

Examples

What it does

reducevg rootvg hdisk1

Removes the PV hdisk1 from the VG rootvg.

reducevg -df rootvg hdisk2

Removes hdisk2 from the VG rootvg and all LVs on that PV that weren't previously removed.

top of page


 

restbase

Reads the base customized information from the boot image and restores it in the ODM

top of page


 

rmlv

Removes a logical volume from a volume group

Examples

What it does

rmlv lv00

Removes the LV lv00 from a VG and restores that space back to the free DASD list. The amount of free disk space returned can be verified by executing the lsvg rootvg command before the rmlv command is executed and after it.

  • If there is a file system associated with the LV to be deleted, it first must be unmounted.
  • Further, the references to that file system will not be removed from the /etc/filesystems. The rule when removing a file system is to first umount the file system and then use the 'rmfs' command to remove all references of this file system and it's associated LV.

  top of page 


 

rmlvcopy

Removes logical partition (mirrored) copies. If no PV named is included with this command, the last copy created will be removed first.

Examples

What it does

rmlvcopy lv00 2

Removes both copies of the LV lv00

rmlvcopy lv00 1 hdisk2

Only the copy (LV:lv00) that exists on PV hdisk2 is removed.

top of page


 

savebase

Reads the base customized information from the ODM and restores it to the boot device (hd5).

top of page


 

schedtune

A memory load algorithm that detects when the system is thrashing and suspends active processes and delays the initiation of new processes for a period of time. Since the suspended processes are not scheduled, their pages in RAM are not being referenced, and are freed for other processes to use.

When thrashing stops, the suspended processes are gradually activated again. The result is that the performance is much more predictable and constant when RAM is in demand. Schedtune is part of the lpp named 'bosadt.lib.obj' or PTF U412059. AIX does't allocate a page until you actually attempt to use it.

Examples

What it does

schedtune -h 0

Disables memory load control. Memory load control is ENABLED by default.

schedtune

Determine current settings for load control.

schedtune -D

Resets memory load control to its default characteristics

top of page


 

syncvg

Synchronizes stale partitions within VG. syncvg is automatically run when the VG is varied on ('varyonvg' command).

Examples

What it does

syncvg -v rootvg

Synchronizes stale partitions on any PV that belongs to VG rootvg.

syncvg -l lv00

Synchronizes the LV lv00 so that all copies are identical

top of page


 

synclvodm

Will read the VGDA from the PV specified and update the ODM database. This command is typically used to fix inconsistencies in the ODM database, by reading a copy of the VGDA and recreating the ODM entries as needed.

Examples

What it does

synclvodm rootvg hd1

Rebuilds the ODM database for a LV hd1, by reading the VGDA.

top of page


 

sysdumpdev

Operations performed on the system dump device

Examples

What it does

sysdumpdev -p sysdumpnull

Turns off the dump device

sysdumpdev -p hd7

Reactives the dump device

updatevg rootvg

Resynchronizes the VG information in the ODM

top of page


 

varyoffvg

Takes off-line a VG and all associated file systems and LV's. If a file system or LV is still mounted or open when this command is executed, the command will fail. A VG that has an active paging LV cannot be varied off or exported.

Use the chps -an <PAGE_LV> to disable the paging LV followed by rebooting the system.

Must umount all file systems on each PV that belongs to a VG before it can be varyed-off

Examples

What it does

1) umount /oracle
2) varyoffvg oracle

Varys-off ALL PVs associated with the VG named oracle. Essentially makes that VG inaccessible

top of page


 

varyonvg

Activates a VG. Takes the information stored in the ODM database and updates the kernel.

Examples

What it does

varyonvg oracle

Activates the VG named oracle and makes accessible any LV and/or file system that belongs in that VG

varyonvg -m1 oracle

Will insure the ODM database matches the attributes stored in the VGDA (syncs VGDA to ODM) and reports the status of all PVs.

varyonvg -f oracle

Used if the VG attempting to be varied on was not properly exported from another system, due to a system crash or some similiar instance. This force option is only needed when there is a problem with the VGDA on the imported VG

#prtconf | more

            Or

  • #lsconf | more ==èshows the detailed information of the server

Background Jobs

============

  • #crontab –l=èto list all the crontab jobs

  • #crontab –e=èto edit the crontab jobs

Understanding the AIX File System

The AIX file system contains 3 major elements:

  • Physical Volumes (PV)
  • Volume Groups (VG)
  • Logical Volumes (LV)

  IBM likes to use abbreviations, so get used to calling Physical Volumes PV's, etc. 

Definition

What is it

Examples

Physical Volumes

A Physical Volume is an actual physical device, i.e. disk drive. Each disk drive contains a Physical Volume. Physical Volume's are broken into Physical Partitions (PP's) where each Physical Partition is 4MB in size.

A system with 2 drives, could contain Physical Volume's hdisk0 and hdisk1.

Volume Groups

Volume Group's are a set of one or more Physical Volume's. Each Volume Group can contain one or more Logical Volumes

Physical Volume hdisk0 could contain Volume Group rootvg and
Physical Volume hdisk1 could contain Volume Group datavg.

Logical Volumes

Logical Volume's are used to define groups of files, i.e. File Systems. Each Logical Volume contains Logical Partitions (LP's)

Volume Group rootvg could contain Logical Volume's hd1, hd2, hd3. Where the mounting points for hd1 = '/' (root), hd2 = /usr, hd3 = /tmp

Here's a table to help make this clearer, I hope.

Physical Volume

Volume Group

Logical Volume

drive 1 = hdisk0

rootvg

hd1 mounted as /

drive 2 = hdisk1

datavg

hd2 mounted as /var
hd3 mounted as /tmp

You can use smit to display or configure your file systems. Here are some commands that smit uses that you can use at the command line to provide the necessary information. The following commands only display information.

Physical Volume Information

Examples

What it does

lspv

Displays a list of all Physical Volume's with the drive name and associated Volume Group's

lspv <physicalvolume>

Displays a specific Physical Volume. Stale partitions refers to mirroring. If the Physical Volume has no mirrored Logical Partitions, then the value for this field is zero

lspv -l <physicalvolume>

Displays what Logical Volumes reside on the named Physical Volume along with Logical Partition's Physical Partition's and Mounting Point.

lspv -p <physicalvolume>

Displays distribution of Physical Partitions for each Logical Volume that reside on the named Physical Volume along with State, Region, Type and Mounting Point.

lspv -s <physicalvolume>

Displays Physical Volume, total, free and used Physical Partitions.

lsvg -n <physicalvolume>

Displays total, free and used Physical Partitions and other information.

Volume Group Information

Examples

What it does

lsvg

Displays all Volume Groups

lsvg <volumegroup>

Displays all Volume Groups, total, free and used Physical Partitions

lsvg -p <volumegroup>

Displays Physical Volume, State and Physical Partition information

lsvg -l <volumegroup>

Displays Logical Volume name, Type, Logical Partitions, Physical Partitions, Physical Volumes, Logical Volume State and Mounting Point

Logical Volume Information

Examples

What it does

lslv <logicalvolume>

Displays Volume Group, Mirror State, Mount Point and more...

lslv -l <logicalvolume>

Displays Physical Volume, Copies, Distribution info

top of page


 

Maximums

The smallest file extension is 4Kb. If a user creates or extends a file anywhere from 0-4096 bytes, a 4K block will be allocated from the free list to accommodate that request. When a file system is extended by 1 Physical Partition (4 MB), 1024 inodes are allocated to that file system.

Maximums

length of a filename : 255 characters
number of open files per process : 2,000
number of open files system-wide : 200,000
number of record locks per process: 200,000
number of record locks system-wide: 200,000
bytes per pipe : 32,768
number of pipes per process : 2,000
number of semaphore IDs : 4,096
number of semaphores per ID : 100 K
number of operations per semop call : 1,024
semaphore value : 32,767
adjust on exit : 16,384
number of message queue IDs : 4,096
bytes per message : 8,192
bytes per message queue : 65,536
messages per message queue : 8,192
number of segments system-wide : 16 MB
number of shared memory segments : 4,096
number of segments per process : 10
bytes per segment 256 MB

top of page


 

Path Definitions/Usage

Directory

What's in it

/bin

utilities

/sbin

files needed to boot the machine and mount the /usr file system

/dev

special files (I/O devices)

/etc

miscellaneous administrative utilities

/home

user directories and files

/lib

libraries

/tmp

temporary files. Needs to be at least 12 MB

/usr

common executables that are shared across the same architecture

/usr/adm

administrative commands and files

/usr/bin

utilities (overflow for /bin)

/usr/lib

archive libraries, text processing macros

/usr/spool/mail

Email files

/usr/sbin

utilities used in system administration, including smit

/usr/share

architecture-independent, shareable text files

/usr/share/man

manual pages

/usr/share/dict

spelling dictionary and its indexes

/usr/share/info

InfoExplorer database files

/usr/share/lib

architecture-independent data files, including terminfo

/usr/share/lpp

data about optional program products (OPP)

/var/adm

system logging and accounting files

/var/preserve

preserved data from interrupted edit sessions

/var/spool

spool files for printing

/var/tmp

temporary files

top of page


 

cat

Concatenates or displays one or more files.

Examples

What it does

cat -v textfile

The -v option will display non-printing characters.

tput clear | cat -v

Displays the control codes generated to your terminal to clear the screen.

top of page


 

chlv

Used to expand beyond the maximum Logical Volume limit.

chlv -x 256 <lv_name> (Where logical volume name is entered without the /dev)

top of page


 

chfs

Changes attributes of a file system. Block size for this command is 512 byte blocks, where the command df, returns disk info in 1024 byte blocks.  The simplest method of extending a file system is to

  • Take the target size of the file system in MB's and multiple by 2000.
  • If the file system size is to be extended to 12MB in size, then 12 * 2000 = 24000.

  Remember, when you extend a file system, you extend the logical volume that resides under it. Most systems have a default Physical Partition size of 4MB (review output of lsvg rootvg command) and therefore when the file system increases in size, it will increase by a multiple of 4MBs. 

chfs -a size=24000 /usr (Increase the /usr file system to 12 MBs.)

top of page


 

cp

Copies one or more files.

Examples

What it does

cp /u/roger/test.c /tmp

Copies the file test.c in the directory /u/roger to the /tmp directory

cp -ipr . /tmp/temp

Copies all the files and subdirectories from the current directory to the directory named /tmp/temp.

  • -i If a filename already exists in the destination directory, the system will prompt you to overwrite this file with the one being copied from the source directory.
  • -p Preserves file permissions, owner, group, and modification attributes of the file being copied to it's new destination.
  • -r Copies all files and subdirectories.
cp -r /usr/data /home/data

Copies all files and directories from /usr to /home

top of page


 

crfs

Adds a new file system. Block size for this command is 512 byte blocks, where the command df, returns disk info in 1024 byte blocks.

crfs -v jfs -g rootvg -m /mydata -p rw -a size=100000

  • -v file systems type, jfs=journalized file system
  • -g volume group name where filesystem will reside, rootvg
  • -m mount point for new filesystem, /mydata
  • -p access permissions, rw=read/write
  • -a file system attribute, size=100000

  The above command creates a 50MB journeled file system named /mydata with read/write permissions, created under the volume group, rootvg 

top of page


 

del

Delete files where system will prompt you to delete the file(s).

del /u/roger/*
If 'y' is entered for yes, all files will be removed.

top of page


 

df

Displays summary of disk usage for mounted file systems.

df -v

top of page


 

dircmp

Compares two directories and the contents of all files found in both directories.

dircmp /tmp/COMPANY /u/COMPANY | grep different
Displays only those files that are found in both directories but have differences

top of page


 

du

Display a summary of disk usage for directories (output in 512 byte blocks). Without an argument, du lists the current directory.

Examples

What it does

du /tmp

Displays total number of 512 byte blocks used by /tmp filesystem and all directories underneath it

du -s /tmp

Summarizes disk allocation for /tmp filesystem (including ALL files and subdirectories) in 512 byte blocks

du -a /u/roger/doc.txt

Summarizes disk allocation for a particular file

top of page


 

fsck

Checks and interactively repairs inconsistent file systems. File systems are normally checked everytime the system is rebooted. If a file system is cleanly unmounted via the umount command, it's unlikely to encounter any problems when the fsck command is run on the file system again. Fsck can only be run on a file system that is unmounted (fsck will not make changes to a mounted file-system). If fsck passes without errors, its safe to mount the file system in question.

  • If there's a discrepancy between the number of directory references to a file and the link count in the file and the file contains data (UNCLAIMED BLOCKS), the file is linked into the subdirectory named lost+found directory.
  • fsck does not flag a bad block on your Physical Volume.
  • Bad blocks are only relocated on a write operation.
  • Fsck performs read operations and therefore is useful for soft errors - not hard errors.
  • Also updates the JFS log - /dev hd8
Examples

What it does

1) fsck -fp /dev/hd1
2) mount /u

To make sure the /dev/hd1 (/u file system) is not damaged, followed by mounting that file system for user access.

  • -f (fast check) Won't check file systems cleanly unmounted.
  • -p Will fix minor problems without prompting user whether the problem detected should be fixed or not.
fsck -y /dev/hd1

The -y option gives fsck permission to automatically repair file systems when necessary.

dd count=1 bs=4k skip=31 seek=1 if=/dev/hd4 of=/dev/hd4
fsck /dev/hd4 2>&1 | tee /tmp/fsck.errors

Use this command in case the superblock is corrupted. This will restore the BACKUP COPY of the superblock to the CURRENT copy.

top of page


 

fuser

Identifies processes using a file or file system

fuser -u /dev/hd3
Sample output: /dev/hd3: 2964(root) 6615c(root) 8465(casado) 11290(bonner)

top of page


 

istat

Displays dates of access for a file

istat myfile (Displays attributes about the file named myfile)

top of page


 

ln

Gives a file more than one name (alias). The symbolic link (-s) allows a user to point to a file and/or a directory. Symbolic links can link either a file or directory across a file system. Use unlink to remove a link.

Examples

What it does

ln test1 test2

Creates a link from the original file named test1 to a new file named test2

ln -s /tmp ./junk

Links subdirectory junk under the current directory to directory /tmp.

1) cd /u/COMPANY
2) ln -s /u/roger/*

All the files under /u/roger will now have links to /u/COMPANY.

top of page


 

ls

Displays the contents of a directory

Options

What it does

-a

Lists all entries including hidden files  that start with a "."

-d

List directories only

-e

Indicates if a file has extended security information - 11th character: + means yes, means no

-l

Long listing - more detail

-t

Sorts by time of last modification (latest listed first)

-F

Puts a / (slash) after each filename if the file is a directory. An * (asterisk) after each filename if the file can be executed. An @ for a symbolic link

-R

Lists all subdirectories recursively

-b

Lists garbage or hidden characters in octal

Examples

What it does

ls -ld .

List directory attributes for CURRENT directory

ls -ld ..

List directory attributes for PARENT directory (one level up)

ls -aeltFR

Lists all files and subdirectories under current directory

ls -l

Displays the last time the data in a file has been changed.

ls -lc

Displays the last time the attributes of a file have been changed.

ls -lu

Displays the last time the data in a file has been accessed.

top of page


 

mkfs

Makes a file system.

Example:

cd /u
find . -print|backup -ivqf/dev/rmt0
cd /
umount /u
mkfs /dev/hd1
fsck -p /dev/hd1
mount /u
cd /u
restore -xvf/dev/rmt0

The above procedure is one way of making a file system contiguous again. Over the course of time, thousands of additions, deletions, creation, and extensions of files and/or records will create a file system that looks like Swiss cheese. This results in multiple disk accesses that formally may have taken only one. As a result, the system appears sluggish.

top of page


 

mount

Displays file system attributes or makes file system available for use.

Examples

What it does

mount

Displays attributes about all file systems that are on-line

mount /u/data

Mounts the file system named /u/data for accessibility.

mount /usr/tmp /tmp

If you don't have enough room in the /tmp filesystem for a specific utility to work properly, and you do have enough room in the /usr filesystem, then you can mount the space from the /usr filesystem onto /tmp

mount -o wsize-8192, rsize=8192

Set the read/write buffers to 8K to increase performance for NFS file systems. Since NFS verifies each packet that gets written to the server before it requests the next packet from the client, writes will take longer to execute than a read. By increasing the buffer size, less I/O operations will be needed, thereby increasing performance.

mount -n cad -v nfs /transfer

Mount a remote file system (type=nfs) on the mount point named /transfer, that resides on node cad

top of page


 

mv

Renames one or more files

mv report1 report2 (Renames the file named report1 to report2)

top of page


 

mvdir

Renames a directory.

mv /u/roger /u/scott (Renames the directory roger to scott)

top of page


 

rm

Removes a file or directory

Examples

What it does

rm -i *

Will prompt the user to remove each of the files in the current directory beforeremoving them EXCEPT for hidden files.

rm -r /u/roger/docs

Will recursively remove all files and any subdirectories found under /u/roger/docs.

rm -i S\&e38912

Removes the file named S&38912. Since this file has a special character ('&') that the shell treats differently than most.
-i system prompt if you wish to remove.

rm `find . -print`

Removes all files from current directory including hidden files (file names such as {}, -exec, ;, etc)

rm ./-junkfile

By preceding the filename (-junkfile) with the pathname (./), you are able to hide the '-' character that starts the filename. If this was not done, the following error message would be generated: usage: rm [-fir] file ...

rm /home/*/mbox

Removes all files named mbox found under any of the subdirectories located in /home.

top of page


 

rmfs

Removes a file system

rmfs /u
Removes a file system and the logical volume under it. The file system must be unmounted prior to the 'rmfs' command being executed else you will get a 'BUSY' error message. The '/u' entry in /etc/filesystems will also be removed.

top of page


 

sync

Flushes system buffers to disk. There's a sync daemon (/etc/syncd) that flushes buffers automatically every 60 seconds (default).

top of page


 

umount

Unmounts a file system from system usage.

umount /u
Unmounts a file system so that files found under that file system will not be able to be accessed. The 'umount' will fail if one or more users are either currently on that file system or somebody has a file opened on that file system.

top of page


 

unlink

Used to remove a link or symbolic link.

unlink MyDoc (Removes the link MyDoc from the system)

backup

Command typically used to backup files on an AIX platform. Distribution tapes for AIX are in this format. This command will span across multiple tapes.

Backup by INODE is not recommended because it eliminates the capability to selectively restore files by filename.

If you have more data to backup than can fit on one tape, you will probably want to perform INCREMENTAL backups for files that have been modified within the last 24 hours for each day of the work week, followed by making a complete backup of the system on the weekend.

The error message Volume on /dev/rfd0 is not in backup format is generated when an attempt is made to extract a file NOT created by the backup command:

If your backup was successful, the last item logged by 'backup' is the time the backup finished and the number of 512 byte block that were archived.

Example message of a successful backup:

Backup finished on Sat Aug 1 15:22:34 CDT 1992; there are 8700 blocks on 1 volumes.

Options

What it does

-i

Read standard input

-v

List names of files being backed up

-f

Name of output device (typically de/v/rmt0 for tape drive)

-e

Won't attempt to compress or pack files that are greater than 24 MB.

-q

Won't prompt user to insert tape

-p

Pack data. Backup images by default are NOT packed. If you wish to pack your data, use this option. The restore command has enough intelligence to determine if a backup image is packed or not and take appropriate action

Examples

What it does

find /u -print | backup -ivf/dev/rmt0

Backup the file system /u to tape device using ABSOLUTE pathnames.

find . -print | backup -iepqvf/dev/rmt0 | tee /tmp/BACKUP.LOG

Backup files and directories under current directory (.) using RELATIVE pathnames. The tee (|) will take as input the output of the backup command (filenames being copied) and write them to the log file 'BACKUP.LOG' for later review.

find /faxdata -mtime -1 -type f -print | backup -ivf/dev/rmt0.1

Find any REGULAR files (-type f) that have been modified within the past 24 hours (-mtime -1) and write them to the tape device but don't rewind (/dev/rmt*.1) the tape after backup has finished.

backup -ivqf/dev/fd0

Backup files interactively. Select the file(s) to backup by typing in the file's name. When done, press ^D to finish.

find / -print|backup -icvqf/dev/rmt0-1

If there is more than one tape drive attached to the system, then you can specify a range of devices to the -f flag of the backup command. (/dev/rmt0-1)

top of page


 

compress, uncompress, pack, unpack, zcat

Utilities to compress or expand data. The compress command reduces the size of the named file(s) and renames it with a .Z extension. Compressed files can be restored to their original form using the uncompress command. This utility appears to have a more EFFICENT packing scheme than the PACK/UNPACK commands.

Examples

What it does

compress -v /tmp/junk

File /tmp/junk is compressed and gets renamed to /tmp/junk.Z. -v displays the percentage of file shrinkage

uncompress /tmp/junk.Z

Restores file to original file type and file size and changes the name to /tmp/junk.

1) find . -print | backup -ivqpf /tmp/roger.bck
2) compress /tmp/roger.bck
3) find /tmp/roger.bck.Z -print | backup -ivqf/dev/fd0

The 3 commands will backup the current directory and compress that backup image to a floppy diskette.

1) restore -xvf/dev/fd0
2) uncompress < /tmp/roger.Z | restore -xvf-

Restore the files archived from a floppy diskette. (In this example assume restored file=roger.Z)  Uncompress the compressed image and restore this file back to the file system

zcat /tmp/junk.Z > /tmp/junk1

Uncompresses /tmp/junk.Z into /tmp/junk1

find /u/COMPANY -print | xargs pack -f

Packs all the files under the specified directory (/u/COMPANY)

find /u/COMPANY -print | xargs unpack

Unpacks all the files under the specified directory (u/COMPANY)

top of page


 

cpio

Copies files to/from an archive storage device. This command is often used to copy files from UNIX to AIX systems. This command will span across multiple tapes. cpio stands for CoPy Input to Output.

Options

What it does

-c

Writes header information in ascii format for portability across UNIX systems. The message Out of phase--get help is generated when an attempt is made to extract a file not in cpio format OR if the archive tape was written with the -c option. The cpio command doesn't have this option specified when attemping to extract files from the media (eg., cpio -icdumpv < /dev/rmt0)

-r

When restoring will prompt for new path/file to restore to

-v

List the file name as it's being copied

-i

Read from standard input, i.e. keyboard

-u

Copies unconditionally. Older file replaces a newer one. Files with older modification times will replace files with newer modification times.

-d

Creates directories,  if applicable

-t

For table of contents

-C1

Performs block I/O in 512 byte blocks, if the block size of the device that wrote the data on the tape was set to 512 bytes. Make sure you read with the same block size. If the block size that the data was written to and about to be read from are two different sizes, this message will be displayed: Cannot read from the specified device

Examples

What it does

1) cd /u/roger
2) find . -print | cpio -ocv > /dev/fd0

Reads file names using the find command and copies to the floppy drive (/dev/fd0).

find . -cpio /dev/fd0 -print

Saves files in current directory and writes this info to floppy. Same command as above except much faster.

1) cd /u/roger
2) cpio -icuvd < /dev/fd0

Restore files and directories saved on the floppy device. These files are restored under the current directory (/u/roger) Only if relative pathnames (./<filename>) were used.

cpio -itvcC1 < /dev/rmt0

List the table of contents from a tape device.

1) cd /u/roger
2) find . -print | cpio -dumpv /u/jerry

Copies all files FROM one directory TO another WITHOUT changing the permissions, owner/group or modification date of the file. Use the following command to verify that all files were copied:

find /u/roger -print | wcfind /u/jerry -print | wc

If the number of files encountered is the same for both directories its safe to assume that the directories are identical. NOTE: that the number of blocks allocated to the SOURCE directory (/u/roger) may be larger than the DESTINATION directory (/u/jerry), since compaction of the directory structure will have occurred at the destination end.

cpio -imv /home/roger/.profile < /dev/fd0

Selectively restore the /home/roger/.profile file from floppy

cpio -i "*.f" "*.c" </dev/fd0

Selectively restore only the *.f and *.c files from floppy

top of page


 

dd

Converts/copies files to/from an output device. DD stands for Data Dump. This command will NOT span across multiple tapes. Common utility found on most versions of UNIX.

Examples

What it does

dd if=/dev/rmt0 bs=512k | cpio -icdmv

Reads the files off the tape device faster because of the blocking factor (bs=blocksize of 512K or cache upto 1/2 MB at a time)

dd if=rs6000.data of=/dev/rmt0.4 bs=1024 conv=ebcdic

Copies the data from the input file (if=rs6000.dat) to the output tape device (/dev/rmt0). The rmt*.4 device extension means output is written in 1600 bpi format. This creates an EBCDIC low density tape, resulting in a 1024 byte blocked non-labeled file. To extract this file on the AS/400, create a physical file with a record length of 1024 bytes. Use the CPYFRMTAP command to copy the file. NOTE: When copying data from an EBCDIC machine, make sure your BLOCK SIZE is set to 0 on the tape device

dd if=unixfile.txt of=DOSFILE.TXT conv=ucase

Copies the data from the input file (if=unixfile.txt) to output name (of=DOSFILE.TXT) and converts the source data to UPPERCASE characters.

tar -cvf- /u/roger | dd of=/dev/rmt0 bs=1024k

Copies the ABSOLUTE path /u/roger using the tar utility. To speed this process up, these files are piped to the dd utility using a cache buffer size of 1 MB.

dd if=/dev/rhdisk0 of=/dev/rhdisk1 bs=5120b

Copies the raw physical volume named hdisk0 to the raw physical volume named hdisk1. This represents a copy disk utility.

dd if=/dev/rmt0 of=/tmp/ascii_file conv=swab

Copies the data from the tape device (if=/dev/rmt0) and creates an output file (/tmp/ascii_file) - which is BYTE swapped (conv=swab) as it is being written out. This needs to be done if your copying ascii files from a System V Unix machine (unisys to the RS/6000)

dd if=/dev/rmt0.1 of=/tmp/data1 cbs=242 ibs=3240 conv=sync,unblock

Useful when reading an ASCII file that is NOT delimited by a NL character.

dd if=/dev/rmt0.1 of=/tmp/data1 cbs=147 ibs=2940 conv=ascii

Will read a record size of 147 bytes, a block size of 2940 bytes, and convert the output to an ASCII file.

top of page


 

mksysb

High-level shell command for backing up mounted file systems in the rootvg volume group. mkszfile -f must be called prior to mksysb in order to create the /.fs.size file that mksysb uses to determine which files will be backed up.

8MM TAPE DEVICE

An 8mm tape drive is the preferred method of backing up your system because that tape can be used to recreate the rootvg image if one or more physical volumes fail. Each of the file systems MUST have at least 500 blocks free when the mksysb backup is made. The system will need some work space in each file system when it is installing from a mksysb backup.

To utilize the full 2.3 gb tape capacity...

  • Set the blocksize to 1024
  • Edit the /usr/lpp/bosinst/diskette/startup2 file
    • Change the following line from 512 to 1024. /etc/methods/chggen -a rmt0 -a block_size=1024
  • Create a new install/maint diskette

  MKSYSB can create a BOOTABLE tape. Further, the data is archived in TAR format. In order to look at the names of files backed up by this command, perform the following: 

  • tctl -f/dev/rmt1.1 fsf 3
  • tar -tvf/devrmt1.1

  Example: mkszfile -f && mksysb /dev/rmt0
-f forces extending the /usr or /tmp file system if not enough working space (8 MB) exists. This command should ALWAYS succeed unless a tape has not been inserted into the archive device (eg., rmt0), or the tape is either write-protected or has defective media.
 

top of page


 

restore

Retrieve information from archive device created with the backup command. Default device is /dev/fd0. This command will read a backup image spread across multiple tapes.

Examples

What it does

restore -Tvf/dev/rmt0

-T=table of contents, -v=list the file name being copied, -f=name of output device. Will list the tape's table of contents. If you forget to label the tape with the date that the tape was made, use this command to report back the date this archive was created.

restore -xvf/dev/rmt0 ./usr/tmp/My*

Restores all files that start with "My" from the /usr/tmp directory

restore -xdvf/dev/rmt0 ./usr/tmp

Restores the directory named /usr/tmp from tape device

restore -xvf/dev/rmt0

Restores all the files located on the tape device that were backed up using the backup command.

restore -xvf/dev/rmt0 ./tmp/TestFile

-x=extract data from output device. Restores only the file named ./tmp/TestFile from the tape device. If the subdirectory /tmp doesn't exist in the current directory, then that subdirectory will be made prior to restoring 'TestFile'.

1) tctl -f/dev/rmt0 rewind
2) restore -s1 -Tvf/dev/rmt0.1
3) restore -s1 -Tvf/dev/rmt0.1

  1. 1. Rewind to the beginning of tape. 2. Review files on FIRST backup image. 3. Review files on SECOND backup image)
    Displays the table of contents for multiple backup images. s1=specifies that multiple backups are on the tape and that the restore command skips to the backup specified by the number associated with the 's' option. The 0.1 for the output device (-f flag) means that once the tape has been read, it will not rewind. If only the second backup image was needed, could have just typed in: restore -s2 -Tvf/dev/rmt0.1

1) tctl -f/dev/rmt0.1 fsf 3
2) restore -xvqf/dev/rmt0.1 ./unix

If by chance the ./unix file was deleted, go back to your install tape and extract the file that needs to be restored. The first three images on the tape are BOSBOOT, INSTALL/MAINT, followed by the TOC (table of contents) image.

restbyname -xvqf/dev/fd0 -Z /tmp/DISK.LIST

Selectively restore ONLY those files listed in file /tmp/DISK.LIS

top of page


 

tapechk

Performs consistency checks on a tape device. Primarily used to check tapes written in backup format.

Example: tapechk 2 ( Checks the first 2 files found on the tape device.)

top of page


 

tar

Probably the easiest command to use when transferring files from one UNIX system to another. This command will NOT span across multiple tapes. Tar stands for Tape ARchiver.

When using this command while performing a SELECTIVE restore from a tape device (eg;., tar -xvf/dev/rmt0 ./etc/motd), the tar command will continue to run until the end of tape is encountered, even after the file has been found. The error message tar: directory checksum error (0 != 12345) Tar is an older utility than cpio or backup/restore is generated when an attempt is made to extract a file that is NOT in tar format.

Options

What it does

-c

Writes (creates) files (appends to archive device)

-x

Extract (read) files from archive device

-v

Verbose mode (displays names)

-f

Device name to use

Examples

What it does

tar -cvf- * | dd of=/dev/rmt0 bs=128k

Copies all the files and subdirectories from the current directory and pipes the output to the dd command for faster archiving.

dd if=/dev/rmt0 bs=128k | tar -xvf-

Use the dd command to read the tape device for faster archiving and pipe the output to the tar command to restore the archived files.

tar -tvf/dev/rmt0

List the table of contents of the tape device.

tar -cvf/dev/rmt0 /u/jones

Copies the jones account to the archive device named /dev/rmt0.

tar -xvf/dev/rmt0 tmp/newdata /tmp/olddata

Selectively copies ONLY the newdata and olddata directories from the tape to the current directory.

tar -cvf- * | xargs compress -v > /tmp/tar.Z

Copies all the files from the current directory and compresses them into the file named tar.Z.

top of page


 

tcopy

Copies from one magnetic tape device to another. This command will work for copying multiple backup images from one media type to another. It will continue to copy until two end-of-tape marks are encountered.

Examples

What it does

tcopy /dev/rmt0

Displays ALL the backup images and their size for the tape your currently viewing.

tcopy /dev/rmt0 /dev/rmt1

Copies all the data from one media type to another until two end of tape marks are encountered. In the example above, rmt0 could be a 8mm device and rmt1 may be a 1/4" tape device. If the error message: tcopy: Cannot open /dev/rmt?' is displayed, make sure the destination device is not write-protected.

top of page


 

tctl

Command used to fast forward a tape device (Tape ConTroL).

Examples

What it does

tctl -f/dev/rmt0 rewind

Rewind the tape device.

tctl -f/dev/rmt0.1 fsf

Move tape forward to the second tape mark. The .1 on the rmt0 device instructs the device NOT to rewind after performing the command. Use this command to skip past unwanted tape images - assumming there are multiple archive images on the tape to skip past.

tctl -f/dev/rmt0 retension

Moves the tape to the beginning, end, and back to the beginning again. Used to retension the tape when encountering multiple read errors on restore operations.

top of page


 

Backup files from a remote computer

The local host MUST be included in remote's hosts /etc/hosts.equiv file. The local host and user name MUST be included in the $HOME/.rhosts file at the user account at the remote machine.

Examples

What it does

rsh lanai -l roger "dd if=/dev/rmt0" | tar -xvf-

Restores files FROM a remote tape drive on a host named 'lanai'

tar -cvf- * | rsh lanai -l roger "dd of=/dev/rmt0 bs=64k conv=block"

The tar command will write it's output to the rsh command which pipes the data to the remote host (lanai) and the tape drive (/dev/rmt0). Specify -l <UserName> if the local user is different from the remote user.

tar -cvf- * | rexec lanai " dd of=/dev/fd0 bs=4096"

Uses the floppy drive device on node lanai to store files in tar format

lsattr

List attributes for a specific device.

Options

What it does

-E

Current

-a

Attribute name

-l

Class names: tty, printer, tape, disk, adapter, dlc, bus, diskette, if, memory, logical_volume, mouse, port

Examples

What it does

lsattr -l rmt0 -E

Lists current attributes for tape drive mode.

lsattr -l tty0 -a speed -R

-R=range of baud rates. List valid ranges for speed attribute for a tty device

lsattr -l scsi0 -E

Display current attributes about scsi0 device

lsattr -l cxma0 -E

Display the characteristics of a defined 128-port async adapter

lscfg

List all devices currently connected to the system

Examples

What it does

lscfg

Partial listing

lscfg -v

Lists hardware and firmware levels for each device - if applicable

lscfg -l ent0 -v

Lists hardware and firmware levels for ent0 (ethernet) device

#lscfg | more

lsdev

List device attributes

Options

What it does

-E

Current

-a

Attribute name

-l

Class names: tty, printer, tape, disk, adapter, dlc, bus, diskette, if, memory, logical_volume, mouse, port

Examples

What it does

lsdev -C

Lists all those devices that are currently configured (-C) since the system was either LAST rebooted OR the smit cfgmgr command was run.

lsdev -C|grep rmt

Displays attributes for the 'rmt' (magnetic tape) devices only

lsdev -P -H

Displays different attributes from PREDEFINED database

mkdev

Adds a device to the system. This command can also be used to change the STATE of a device. Devices NOT turned on when the system is rebooted will only be DEFINED to the system. To access those physical devices, they MUST be in an AVAILABLE state.

Examples

What it does

mkdev -l tty1

Assumming the device state is DEFINED, will bring that device to an AVAILABLE state. A device that is DEFINED means the system knows that the device exists BUT has not been made it available for use.

mkdev -l rmt0

If the power to the tape device was NOT turned on when the system was last rebooted, this device will be in a DEFINED state. To make this device available for use, execute this command.

mkdev -ctty -ttty -srs232 -psa2 -w11 -alogin=enable -aterm=ibm3151

Creates a new terminal device on port 11 on adapter sa2. sa2 could be either an 8,16, or 64 port adapter card. The port is configured as an ibm3151 CRT and will generate a login prompt when turned on.

top of page


 

rmdev

Removes a device from the system

Examples

What it does

rmdev -l tty1

Assumming the device state is AVAILABLE, will bring that device to a DEFINED state. If this command fails with a '/etc/methods/ucfgtty' error, chances are the getty process is still running on that port. Use the pdisable command to stop the getty from running. Then execute the rmdev command so the port in question can go to a DEFINED state.

1) pdisable 1
2) rmdev -l tty1 -d

-d=deletes the tty definition from the ODM database.  In order to remove the terminal device tty1 from the system, you must first disable the tty, followed by removing all instances of that device by using the '-d' option. If there is a getty running on the terminal port to be removed AND that getty is not disabled, the following message will appear on screen: Method error (/etc/methods/ucfgtty): 0514-062 Cannot perform the requested function because the specified device is busy

cfgmgr

Automatically configures devices that have been just added or not powered on since the system was last rebooted

#cfgmgr -v

vmstat

Statistics about virtual memory and cpu/hard disk usage.

Example: vmstat hdisk0 hdisk1 5 (Display various statistics every 5 seconds)

ps

Display status of current processes. This command is useful for determining if runaway processes are excessively utilizing the CPU or memory.

For example, if a machine was just rebooted and appears to be running slowly, use this command to see if there are any getty processes running wild, using excessive CPU time.

  • Getty's should never be using more than 0% of measured CPU time as reported by the output of the command ps avg.
  • If this is not the case, suspect noise on that line.
  • A login state of PDELAY for that port may resolve that problem.
  • STAT column
    • R means RUNNING process
    • S means SLEEPING process
    • Z means ZOMBIE process
  • RSS represents how much memory (in 1k bytes) process is using.
  • SIZE represents how much paging space (in 1k bytes) process is using.
  • CPU represents how much cpu time a process is using
  • MEM represents a percentage of remaining memory a process is using
ps -ef

Full listing of all processes in the system. If the 'C' field (means processor utilization) has a large value, this means that that process is a CPU intensive task.

Permissisons

Depending on how the umask is set, when a user creates a file, the file permissions will be set to

  • read/write for the owner of the file
  • read-only for group and other

  If you look at the permissions using the ls -l command, you will see...
-rw-r--r-- 1 roger staff 129 Oct 07 10:14 testfile 

-

r

w

-

r

-

-

r

-

-

1

roger

staff

129

Oct 7 10:14

testfile

Fle Type

Owner Flag

Group Flag

Other Flag

Links

Owner

Group

filename

-=ordinary
F=remote
l=symbolic liink
D=directory
b=block
B=remote block
c=character special
p=fifo
s=socket

r
e
a
d

w
r
i
t
e

e
x
e
c
u
t
e

r
e
a
d

w
r
i
t
e

e
x
e
c
u
t
e

r
e
a
d

w
r
i
t
e

e
x
e
c
u
t
e

#
o
f

l
i
n
k
s

owner of file

group owner

size of file in bytes

date last written to

 

A dash under the owner, group, and other fields means that particular attribute (either read,write or execute) isn't permitted. When a file is created, a mask is applied to the permission bits to determine what permissions are allowed. The mask can be user defined by the umask command.

File permission bits are verified when a file is opened. The commands mv (move) and rm (remove), for example, don't open a file. Thus, it's possible to remove a file that you don't have permissions to open, as long as you have write (w) permission for the directory containing that file.

chmod

Change permissioms of a file or directory. Without considering the umask value, when a directory is created, the permissions are set to 'rwxrwxrwx'; and for a new file, the permissions are 'rw-rw-rw'. When the umask is applied, directory settings are 'rwxr-xr-x' and files are 'rw-r--r--'. To have access to another user's directory, that users directory must have the execute bit set for either group or other (eg., 'rwxr-xr-x).

#chmod 777 <filesystem>

#chmod –R 777  *

umask

Sets the default file permissions for files created by a user.

Type in the umask command by itself to show what the current defaults are. This can be changed by the smit user command or by the umask command itself.

By default, the umask is set to 022 which means

  • Don't allow write access for GROUP and OTHER.
  • When this mask is applied to the system file default of 666 (read/write for everyone), the result is 644 read/write for owner, and read for group and other).
  • The math works out as follows 666 - 022 = 644.
  • The system default for creating directories is 777 - 022 = 755, which means the owner has read/write/execute permissions on that directory, while group and others only have read and execute permissions.

ulimit

Quota limits for individual users for memory usage and file size. Doesn't effect the /etc/security/limits database. Only changes your environment for the current session (not a permanent change). This command allows the user to change their hard or soft limits.

To raise or lower the soft limit (within the bounds of the hard limit), use the -S option.

To raise or lower the hard limit (within the bounds of the default values specified in the /etc/security/limits database), use the -H option.

Examples

What it does

ulimit -a

View current limits
time(seconds) 3600
file(blocks) 2097151
data(kbytes) 65536
stack(kbytes) 4096
memory(kbytes) 32768
coredump(blocks) 2048

ulimit -Sf 1000000

Increase file limit to 1000000

ulimit -d 100000

Data section is now increased to 50 MB. When compiling large C or FORTRAN programs, you may receive a MALLOC error during the link phase. This is because their is not enough heap space allocated to this process.

  • #oslevel=èCommand to Display the OS Version and Maintenance Level

  • #rm –R /oracle -à to delete all the files and its subdirectories
  • #cp -rp /biwdir/* /biwbak/biwbak/  =è it copies with the same permissions

For more commands refer the below links:

http://www.ahinc.com/aix/backup.htm

http://bhami.com/rosetta.html

http://unixarticles.com/articles/10/1/AIX-Command -Crib-Sheet

http://www.unixguide.net/cgi-bin/unixguide.cgi