Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2029617
  • 博文数量: 593
  • 博客积分: 20034
  • 博客等级: 上将
  • 技术积分: 6779
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 14:07
文章分类

全部博文(593)

文章存档

2016年(1)

2011年(101)

2010年(80)

2009年(10)

2008年(102)

2007年(16)

2006年(283)

我的朋友

分类:

2006-02-20 21:38:12

AIX Commands  

--------------------------------------------------------------------------------

Below are some of the more common command line entries and a description of what they do.
oslevel Returns operating system level
whence (program) Returns full path of program
whereis (program) Returms full path of program
lslpp -L all list all installed software
lslpp -L (program set name) Check if software installed
lslpp -f Lists filesets vs packages
instfix -ik (fix number eg IX66617) Checks id fix is installed
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 email
uudecode (encoded file)
Extracts a binary file from encoded file and calls it the extract-file-name
examples :-
uuencode maymap maymap > maymap.enc
uuencode maymap.enc
od -c /tmp Displays contents of the /tmp directory file
ls -i Lists files with their inode numbers
echo * Lists files, can be used if ls is corrupt/missing
alog -o -t boot View the boot log
chtz (timezone eg GMT0BST) Changes the timezone in /etc/environment file
chlang (language eg En_GB) Changes the language in /etc/environment file
ar -v -t /usr/lib/libC-r.a Lists all objects in libC_r.a library
--------------------------------------------------------------------------------
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 run on.
chdev -l (device eg tty1) -a term=vt100 Sets tty to a vt100 terminal type
penable tty0 adds getty line into /etc/inittab for tty0 and starts getty
pdisable tty0 disables the getty line and disables getty
penable / pdisable -a option is for all
stty erase ^? Set backspace key for vt100 terminals
stty erase ^H Set backspace key for wyse50 terminals
lscons Displays the console device
chcons -a login=enable (device eg /dev/tty1) Changes the console device
Create ttys on ports 0 to 7 on adapter sa2 :-
for i in 0 1 2 3 4 5 6 7
do
mkdev -c tty1 -t tty -s rs232 -p sa2 -w$i -a login=enable -a term=vt100
done
--------------------------------------------------------------------------------
NETWORK
--------------------------------------------------------------------------------
host (ip or hostname) Resolves a hostname / ip address
hostname Displays hostname
hostname (hostname) Sets the hostname until next reboot
chdev -l (device name) -a hostname=(hostname) Changes hostname permanently
chdev -l inet0 -a hostname=thomas
ifconfig (device name) Displays network card settings
ifconfig (device name) up Turns on network card
ifconfig (device name) down Turns off network card
ifconfig (device name) detach Removes the network card from the
network interface list
ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up
ifconfig lo0 alias 195.60.60.1 Create alias ip address for loopback
route (add/delete) (-net/-host) (destination) (gateway)
Adds or deletes routes to other networks or hosts, does not update
the ODM database and will be lost at reboot.
route add -net 194.60.89.0 194.60.90.4
netstat -i Displays interface statistics
entstat -d (ethernet adapter eg en0) Displays ethernet statistics
arp -a Displays ip to mac address table from arp cache
no -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
destination supplied.
ping -R (name or ipaddress) Same as traceroute except repeats.
--------------------------------------------------------------------------------
N.F.S.
--------------------------------------------------------------------------------
exportfs Lists all exported filesystems
exportfs -a Exports all fs's in /etc/exports file
exportfs -u (filesystem) Un-exports a filesystem
mknfs Configures and starts NFS services
rmnfs Stops and un-configures NFS services
--------------------------------------------------------------------------------
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/rmt0
CPIO RESTORE
------------
cpio -ict < (filename or device) ?more Lists archive
cpio -icdv < (filename or device)
cpio -icdv < (filename or device) ("files or directories to restore")
eg cpio -icdv < /dev/rmt0 "tcpip/*" Restore directory and contents
cpio -icdv < /dev/rmt0 "*resolve.conf" Restore a named file
TAR 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 archive
tar -xvf (filename or device) Restore all
tar -xvf (filename or device) ("files or directories to restore")
use -p option for restoring with orginal permissions
eg tar -xvf /dev/rmt0 "tcpip" Restore directory and contents
tar -xvf /dev/rmt0 "tcpip/resolve.conf" Restore a named file
AIX ARCHIVE
-----------
find (filesystem) -print ?backup -iqvf (filename or device)
Backup by filename.
eg find /usr/ -print ?backup -iqvf /dev/rmt0
backup -(backup level 0 to 9) -f (filename or device) ("filesystem")
Backup by inode.
eg backup -0 -f /dev/rmt0 "/usr" -u option updates /etc/dumpdates file
AIX RESTORE
-----------
restore -qTvf (filename or device) Lists archive
restore -qvxf (filename or device) Restores all
restore -qvxf (filename or device) ("files or directories to restore")
(use -d for restore directories)
--------------------------------------------------------------------------------
Copying diskettes and tape
--------------------------------------------------------------------------------
COPYING DISKETTES
-----------------
dd if=/dev/fd0 of=(filename) bs=36b
dd if=(filename) of=/dev/fd0 bs=36b conv=sync or flcopy
COPYING 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 yyy
sed 's(ctrl v ctrl m)g//g' old.filename > new.filename
Strips out ^M characters from ascii files that have been transferred as binary.
To enter crontrol characters type ctrl v then ctrl ? where ? is whatever
ctrl character you need.
--------------------------------------------------------------------------------
DEVICES
--------------------------------------------------------------------------------
lscfg lists all installed devices
lscfg -v lists all installed devices in detail
lscfg -vl (device name) lists device details
bootinfo -T reports type of machine ie rspc
bootinfo -r reports amount of memory (/ by 1024)
bootinfo -s (disk device) reports size of disk drive
mknod (device) c (major no) (minor no) Creates a /dev/ device file.
mknod /dev/null1 c 2 3
lsdev -C lists all customised devices ie installed
lsdev -P lists all pre-defined devices ie supported
lsdev -(C or P) -c (class) -t (type) -s (subtype)
chdev -l (device) -a (attribute)=(new value) Change a device attribute
chdev -l sys0 -a maxuproc=80
lsattr -EH -l (device) -D Lists the defaults in the pre-defined db
lsattr -EH -l sys0 -a modelname
rmdev -l (device) Change device state from available to defined
rmdev -l (device) -d Delete the device
rmdev -l (device) -SR S stops device, R unconfigures child devices
lsresource -l (device) Displays bus resource attributes of a device.
Power Management (PCI machines)
-------------------------------
pmctrl -a Displays the Power Management state
rmdev -l pmc0 Unconfigure Power Management
mkdev -l pmc0 Configuter Power Management
--------------------------------------------------------------------------------
TAPE DRIVES
--------------------------------------------------------------------------------
rmt0.x where x = A + B + C
A = density 0 = high 4 = low
B = retension 0 = no 2 = yes
C = rewind 0 = no 1 = yes
tctl -f (tape device) fsf (No) Skips forward (No) tape markers
tctl -f (tape device) bsf (No) Skips back (No) tape markers
tctl -f (tape device) rewind Rewind the tape
tctl -f (tape device) offline Eject the tape
tctl -f (tape device) status Show status of tape drive
chdev -l rmt0 -a block_size=512 changes block size to 512 bytes
(4mm = 1024, 8mm = variable but
1024 recommended)
bootinfo -e answer of 1 = machine can boot from a tape drive
answer of 0 = machine CANNOT boot from tape drive
diag -c -d (tape device) Hardware reset a tape drive.
--------------------------------------------------------------------------------
PRINT QUEUES
--------------------------------------------------------------------------------
export $LPDEST="pqname" Set default printer queue for login session
lsvirprt Lists/changes virtual printer attributes.
qpri -#(job No) -a(new priority) Change a queue job priority.
qhld -#(job No) Put a hold on hold
qhld -r #(job No) Release a held job
qchk -A Status of jobs in queues
lpstat
qcan -x (job No) Cancel a job from a queue
cancel (job No)
enq -U -P(queue) Enable a queue
enable (queue)
enq -D -P(queue) Disable a queue
disable (queue)
qmov -m(new queue) -#(job No) Move a job to another queue
startsrc -s qdaemon Start qdaemon sub-system
lssrc -s qdaemon List status of qdaemon sub-system
stop -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 details
lspv -l (pv) Lists the logical volumes on the physical volume
lspv -p (pv) Lists the physical partition usage for that PV
chdev -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 YES
chpv -a n (pv) Changes pv allocatable state to NO
migratepv (old pv) (new pv) Moves all LV's from one PV to another PV, both
PV's must be in the same volume group.
Volume Groups (VG's)
--------------------
lsvg Lists all volume groups
lsvg (vg) Lists the volume group details
lsvg -l (vg) Lists all logical volumes in the volume group
lsvg -p (vg) Lists all physical volumes in the volume group
lsvg -o Lists all varied on volume groups
varyonvg (vg) Vary On a volume group
varyonvg -f (vg) Forces the varyon process
varyonvg -s (vg) Vary on a VG in maintenance mode. LV commands can be
used on VG, but LV,s cannot be opened for I/O.
varyoffvg (vg) Vary Off a volume group
synclvodm (vg) Tries to resync VGDA, LV control blocks and ODM.
mkvg -y(vg) -s(PP size) (pv) Create a volume group
mkvg -y datavg -s 4 hdisk1
reducevg -d (vg) (pv) Removes a volume group
reducevg (vg) (PVID) Removes the PVID disk reference from the VGDA when a
disk 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 filesystems
file 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 details
lslv -l (lv) Lists the physical volume which the LV is on
mklv (vg) (No of PP's) (pv Name optional) Create a logical volume
mklv -y (lv) (PP's) (pv name optional) Creates a named logical volume
chlv -n (new lv) (old lv) Rename a logical volume
extendlv (lv) (extra No of PP's) Increase the size of an LV
rmlv (lv) Remove a logical volume
mklv/extendlv -a = PP alocation policy
-am = middle -ac = center -ae = edge
-aie = inner edge -aim = inner middle
migratepv -l (lv) (old pv) (new pv)
Move a logical volume between physical volumes. Both 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 JFSlog
File Systems (FS's)
-------------------
lsfs Lists all filesystems
lsfs -q (fs) Lists the file system details
mount Lists all the mounted filesystems
mount (fs or lv) Mounts a named filesystem
mount -a Mounts all filesystems
mount all
mount -r -v cdrfs /dev/cd0 /cdrom mounts cd0 drive over /cdrom
crfs -v jfs -d(lv) -m(mount point) -A yes
Will 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 yes
Will create a logical volume on the volume group and create the file system on
the 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/filesystems
chfs -a size=(new fs size)(fs) Change file system size
rmfs (fs) Removes the file system and will also remove the
LV if there are no onther file systems 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
superblock is 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 onto another 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.
syncvg -p (pv) Synchronize logical partion copies
syncvg -l (lv)
syncvg -v (vg)
mirrorvg (vg) (pv)
Mirrors the all the logical volumes in a volume group onto a new physical
volume. New physical volume must already be part of the volume group.
--------------------------------------------------------------------------------
BOOT LOGICAL VOLUME (BLV)
--------------------------------------------------------------------------------
bootlist -m (normal or service) -o displays bootlist
bootlist -m (normal or service) (list of devices) change bootlist
bootinfo -b Identifies the bootable disk
bootinfo -t Specifies type of boot
bosboot -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
--------------------------------------------------------------------------------
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.
sysdumpdev -p (dump device) -P Sets the default dump device, permanently
Analyse 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 space
lsps (ps)
mkps -s(No of 4M blocks) -n -a (vg)
mkps -s(No of 4M blocks) -n -a (vg) (pv)
chps -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 name
rmps (ps) Remove paging space. PS must have been turned off
and then the system rebooted before it can be removed.
Note : Need to change the swapon entry in /sbin/rc.boot script if you are
changing the default paging space from /dev/hd6. You also need to
do a "bosboot -a -d /dev/hdiskx" before the reboot.
--------------------------------------------------------------------------------
SCHEDULING
--------------------------------------------------------------------------------
crontab -l List out crontab entrys
crontab -e Edit crontab entrys
crontab -l > (filename) Output crontab entrys to a file
crontab (filename) Enter a crontab from a file
crontab -r Removes all crontab entrys
crontab -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 at
Command or schell script {return}
{CTRL D}
at -l
atq Lists out jobs scheduled to run via at command
at -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 of
setgroups Shows user and process groups
chmod abcd (filename) Changes files/directory permissions
Where a is (4 SUID) + (2 SGID) + (1 SVTX)
b is (4 read) + (2 write) + (1 execute) permissions for owner
c is (4 read) + (2 write) + (1 execute) permissions for group
d is (4 read) + (2 write) + (1 execute) permissions for others
-rwxrwxrwx -rwxrwxrwx -rwxrwxrwx
Ζ?Ζ?Ζ?
- - -
???
Owner Group Others
-rwSrwxrwx = SUID -rwxrwSrwx = SGID drwxrwxrwt = SVTX
chown (new owner) (filename) Changes file/directory owners
chgrp (new group) (filename) Changes file/directory groups
umask Displays umask settings
umask abc Changes users umask settings
where ( 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 owner
read ----- and execute for group
read ----- and execute for other
mrgpwd > file.txt Creates a standard password file in file.txt
passwd Change current user password
passwd -f Change current users gecos (user description)
passwd -s Change current users shell
pwdadm (username) Change a users password
lsgroup ALL Lists all groups on the system
mkgroup (new group) Creates a group
chgroup (attribute) (group) Change a group attribute
rmgroup (group) Removes a group
--------------------------------------------------------------------------------
USERS
--------------------------------------------------------------------------------
env Displays values of environment variables
printenv
id Displays current user's uid and gid details
id (user) Displays user uid and gid details
whoami Displays current user details
who am i (or who -m)
who Displays details of all users currently logged in.
w
uptime Displays number of users logged in, time since last
reboot, and the machine load averages.
lslicense Displays number of current user licensese
chlicense -u (number) Changes the number of user licenses
lsuser ALL Lists all users details
lsuser (username) Lists details for user
lsuser -a(attribute) (username or ALL) Lists user attributes
lsuser -a home ALL
mkuser -a(attributes) (newuser) Add a new user
chuser (attributes) (user) Change a user
chuser login=false (user) Lock a user account
rmuser -p (user) Removes a user and all entries in security files
usrck -t ALL Checks all the user entires are okay.
fuser -u (logical volume) Displays processes using the files in that LV
lsattr -D -l sys0 -a maxuproc Displays max number of processes per user
chdev -l sys0 -a maxuproc=(number) Changes max number of processes per user
--------------------------------------------------------------------------------
REMOTE USERS
--------------------------------------------------------------------------------
ruser -a -f (user) Adds entry into /etc/ftpusers file
ruser -a -p (host) Adds entry into /etc/host.lpd file
ruser -a -r (host) Adds entry into /etc/hosts.equiv file
ruser -d -f (user) Deletes entry in /etc/ftpusers file
ruser -d -p (host) Deletes entry in /etc/host.lpd file
ruser -d -r (host) Deletes entry in /etc/hosts.equiv file
ruser -s -F Shows all entries in /etc/ftpusers file
ruser -s -P Shows all entries in /etc/host.lpd file
ruser -s -R Shows all entries in /etc/hosts.equiv file
ruser -X -F Deletes all entries in /etc/ftpusers file
ruser -X -P Deletes all entries in /etc/host.lpd file
ruser -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.
lsitab -a Lists all entries in inittab
lsitab (ident eg tty1) Lists the tty1 entry in inittab
mkitab ("details") Creates a new inittab entry
chitab ("details") Ammends an existing inittab entry
rmitab (ident eg tty1) Removes an inittab entry.
chitab "tty1:2:respawn:/usr/bin/getty /dev/tty1"
--------------------------------------------------------------------------------
ODM
--------------------------------------------------------------------------------
odmget -q "name=lp1" CuDv ?ore Gets lp1 info from pre-defined database.
odmget -q "name-lp1" CuAt ?ore 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=Undetermined
errclear (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 of
days 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 20
vmstat -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 20
iostat -d (drive) (interval) (count) Limits report to drive statistics.
iostat -t (interval) (count) Limits report to tty statistics.
--------------------------------------------------------------------------------
DOS DISKETTES
--------------------------------------------------------------------------------
dosdir Reads directory listing of a diskette
dosdir (directory) Reads directory listing of a named directory
dosread -D/dev/fd0 C41.TXT c41.txt Gets C41.TXT from diskette drive fd0
dosread -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 diskette
dosdel (dosfile) Deletes a dos file on diskette
dosformat Formats the diskette
--------------------------------------------------------------------------------
SENDMAIL
--------------------------------------------------------------------------------
sendmail -bi Creates new aliase db from /etc/aliase file.
newaliases
mailq Displays the contents of the mail queue
sendmail -q Processes the sendmail queue NOW
 
阅读(919) | 评论(0) | 转发(0) |
0

上一篇:RS6000 LED information

下一篇:AIX Commands

给主人留下些什么吧!~~