[Sommaire] AIX Command Examples: Main  

AIX Logo AIX Command Examples


Created by Michael A. Lowry, mlowry@austin.ibm.com.
Based on the original AIX Command Examples by Jon Bass.
You may view this page with frames or without frames.


backup -- 4.3 Man Page
backup by i-node (filesystem must be unmounted) backup -0 -uf /dev/rmt0.1 /var
backup by name find ./home -print | backup -iqvf /dev/rmt0
backup by name and pack data to tape find ./home -print | backup -iqvpf /dev/rmt0
backup by name, compress data, and dd copy to tape find . -print | backup -iqvf - | compress | dd of=/dev/rmt0 bs=512 conv=sync
Related commands: restore , rdump

bootlist -- 4.3 Man Page
set service mode bootlist (tape, floppy, CD-ROM, hard disk) bootlist -m service rmt fd cd scdisk

chdev -- 4.3 Man Page
set device rmt0's block size chdev -l rmt0 -a block_size=512
turn on extended file marks chdev -l rmt0 extfm=yes
change the first density setting chdev -l rmt0 density_set_1=140
enable hardware data compression chdev -l rmt0 compress=yes
make hdisk0 a physical volume chdev -l hdisk0 -a pv=yes
reset the physical volume status chdev -l hdisk0 -a pv=clear
Related commands: lsattr

cpio -- 4.3 Man Page
write files in current direcotry to tape using 1204 bytes per record find . -print | cpio -ovC2 > /dev/rmt0
a way to do cpio with just the find command (when issued as a flag of find, cpio behaves as if -C10, or 5K blocks, were implied) find . -print -cpio /dev/rmt0
read cpio archive that was written to tape using 512 bytes per record cpio -iBv < /dev/rmt0
list the table of contents of a cpio archive cpio -itv < /dev/rmt0

dd -- 4.3 Man Page
find out the block size and archive type of an archive on tape (works with any kind of archive) chdev -l rmt0 -a block_size=0

tctl -f /dev/rmt0 rewind

dd if=/dev/rmt0 of=/tmp/block bs=128k count=1

wc -c /tmp/block    (returns the archive block size)

file /tmp/block    (returns the archive type)


copy a single tape file from a tape drive on one machine to a tape drive on another machine, goofy On the both the source and target machine:

chdev -l rmt0 -a block_size=0

On the source machine:

mknod /tmp/pipe p

dd if=/dev/rmt0 of=/tmp/pipe &

dd if=/tmp/pipe | rsh goofy "dd of=/dev/rmt0"

rm -f /tmp/pipe

df -- 4.3 Man Page
summary of all filesystems df
summary of all filesystems by i-node df -i

exportvg -- 4.3 Man Page
export the datavg volume group and all its filesystems exportvg datavg
Related commands: importvg, varyonvg, varyoffvg

imfs -- 4.3 Man Page
import the filesystem that's on logical volume lv00 imfs -l lv00
Related commands: importvg, exportvg

importvg -- 4.3 Man Page
import the datavg volume group and all its filesystems from the disks hdisk4 and hdisk5 importvg -y datavg hdisk4 hdisk5
Related commands: imfs, exportvg, varyonvg, varyoffvg

lsattr -- 4.3 Man Page
show tape drive characteristics (attributes) lsattr -El rmt0
Related commands: chdev

lscfg -- 4.3 Man Page
show tape drive microcode level (firmware revision number) lscfg -vl rmt0
*Note: Look for DEVICE_SPECIFIC (Z1)=xxxx
(where xxxx is the revision number)
Related commands: chdev

lsdev -- 4.3 Man Page
list all hard drives lsdev -Cc disk
list all tape drives lsdev -Cc tape
list status of rmt0 lsdev -Cl rmt0
list all SCSI devices lsdev -Cs scsi
list all SSA devices lsdev -C | grep SSA
Related commands: mkdev

lslpp -- 4.3 Man Page
show installed products lslpp -f | pg
show files in bos.obj lslpp -f bos.obj
show version of atape.driver lslpp -h atape.driver
show version of Sysback lslpp -h sysback.obj
show version of products with sysmgt in name lslpp -h | grep sysmgt
show lowest OS maintenance level lslpp -m bos.obj

lslv -- 4.3 Man Page
display logical volume information for logical volume hd2 lslv hd2
display PV; and copies, allocation, and distribution of PPs for logical volume hd2 lslv -l hd2
list physical partitions of hd2 lslv -m hd2
display the LV allocation map for hdisk0 lslv -p hdisk0
Related commands: lsvg

lsvg -- 4.3 Man Page
list names of all volume groups lsvg
list active (varied on) volume groups lsvg -o
show more information about rootvg lsvg rootvg
display names, characteristics, and status of all logical volumes in rootvg lsvg -l rootvg
list physical volumes in rootvg lsvg -p rootvg
list all active volume groups and their logical volumes lsvg -o | lsvg -il

mkdev -- 4.3 Man Page
move a device from defined to available state mkdev -l rmt0
Related commands: lsdev

mount -- 4.3 Man Page
mount a filesystem mount /dev/hd1 /home
soft-mount an NFS filesystem called /info (on host donald) over /mnt mount -o soft donald:/info /mnt
Related commands: umount

oslevel -- No 3.2 Man Page (oslevel not in AIX 3.2) -- 4.3 Man Page
show the lowest OS level oslevel

pax -- 4.3 Man Page
make tar archive of /var pax -wvf /dev/rmt0 /var
make cpio archive of /var using find to make the file-list. find /var -print | pax -wvf /dev/rmt0 -x cpio
restore files from archive; preserve file modes, UID and GID, but not modification time. pax -rvf /dev/rmt0 -pmop
restore all files from archive; convert absolute pathnames to relative pathnames pax -rvf /dev/rmt0 -s!/!./! 
show verbose table of contents pax -vf /dev/rmt0

ps -- 4.3 Man Page
show the 5 most active processes ps aux | head 5
show active tape processes ps auxw | grep rmt
show user jim's processes using different format output ps -ef | grep jim

rdump -- 4.3 Man Page
network backup by i-node

-s = (size of tape/32768*11)/15
always round after each division

rdump -0 -vd 6250 -s33000 -f daffy:/dev/rmt0 /var
network backup by name rdump -0 -uf daffy:/dev/rmt0.1 /var

restore -- 4.3 Man Page
table of contents restore -Tqvf /dev/rmt0
extract a file restore -xqvf /dev/rmt0 ./path/file
extract a directory restore -xqvdf /dev/rmt0 ./path
table of contents restore -Tqvf /dev/rmt0
extract a full filesystem (to current dir.) restore -rqvf /dev/rmt0
extract interactively restore -if /dev/rmt0.1
dd from tape, uncompress and get a table of contents dd if=/dev/rmt0 bs=512 | uncompress | restore -Tqvf -
dd from tape, uncompress and extract a file dd if=/dev/rmt0 bs=512 | uncompress | restore -xqvf -
(4.1.x, 4.2)
go to 4th image and get table of contents
restore -s4 -Tqvf /dev/rmt0.1
(4.1.x, 4.2)
go to 4th image and extract a file
restore -s4 -xqvf /dev/rmt0.1 ./path/filename
*Note: 3.2.x mksysb backups are in tar format
Related commands: backup

restvg -- * -- 4.3 Man Page
extract a volume group to its original location
restvg -qf /dev/rmt0
extract a volume group to hdisk4, shrinking all logical volumes to minimum size
restvg -qsf /dev/rmt0 hdisk4
Related commands: savevg

rsh -- 4.3 Man Page
network archive using tar and dd tar -cvf - ./home | rsh daffy "dd of=/dev/rmt0 bs=1024"
network restore using dd and tar rsh daffy "dd if=/dev/rmt0 ibs=1024 | (cd /home ; tar -xvf -)
network restore using dd dd if=/filename.in | rsh daffy "dd of=/filename.out"

savevg -- * -- 4.3 Man Page
backup a volume group
savevg -i datavg /dev/rmt0
Related commands: restvg

tar -- 4.3 Man Page

create an absolute tar archive

create a relative tar archive

go to 4th image and get table of contents
of a mksysb at 3.2.5

tar -cvf /dev/rmt0 /home

tar -cvf /dev/rmt0 ./home

tctl -f /dev/rmt0.1 fsf 3 ; tar -tvf /dev/rmt0

extract a file tar -xvf /dev/rmt0 ./path/file ./path2/file2

tcopy -- 4.3 Man Page
show tape information
(e.g., block size, number of files on tape)
tcopy /dev/rmt0
copy from rmt0 to rmt1 (block size must be 0) tcopy /dev/rmt0 /dev/rmt1

tctl -- 4.3 Man Page
display tape drive status (essentially this runs "lsdev -Cl rmt0 ; lsattr -El rmt0") tctl -f /dev/rmt0 status
eject tape tctl -f /dev/rmt0 offline
rewind tape tctl -f /dev/rmt0 rewind
skip fowrward to 4th tape file (the 3rd EOF mark) tctl -f /dev/rmt0.1 fsf 3

umount -- 4.3 Man Page
unmount a disk filesystem umount /home
Related commands: mount

varyoffvg -- 4.3 Man Page
deactivate the datavg volume group varyoffvg datavg
Related commands: importvg, exportvg, lsvg

varyonvg -- 4.3 Man Page
activate the datavg volume group varyonvg datavg
Related commands: importvg, exportvg, lsvg