You are on page 1of 66

General Commands id - displays the system identity of the user lslicense - list maximum number of users last - information

ion about previous logins w - lists summary of current users who - displays information about all current users uname - displays system info type - shows path location whereis - shows path location what - displays header information about the source file whatis - displays a short description of a function basename - returns the base file name ac - displays connect time date - displays or sets the date timex - displays the elapsed time

cmp - compares two files diff - compares text files head or tail - display start or end of file od - dumps the contents of a file split - makes smaller files from a large one cut - cuts out selected text tr - translates characters sed - stream edit command to change text nl - produces an OUTPUT file by inserting the line number captoinfo - converts termcap to terminfo nvdmetoa - convert EBCDIC files to ASCII sum - displays checksum for a file

errclear - deletes entries in the error log errpt - generates an error report diag - performs hardware problem determination trace - kernel debugging

at - schedules jobs batch - run 1 or more jobs in the background nice - execute a command at a lower priority tee - used to preserve output from a pipeline login logout su - switch user lsitab - list contents of the /etc/inittab file rmitab - removes an entry from the /etc/inittab telinit - forces the init process to reread the /etc/inittab

find - finds files with matching expressions grep - searches a file for a pattern kill - stop a process stopsrc - gracefully shuts down all subsystems shutdown - shutdown system fastboot - restarts the system without running fsck fasthalt - halts the system strip - removes symbol table

xargs - constructs an argument list

top of page

ac Displays connect time totals for users Example: ac root Outputs: total 52.80 seconds top of page

at Schedules jobs to run at a later date Examples 1) at 17:00 2) banner CALL HOME > /dev/tty0 3) ^D 1) at 18:00 2) make -f /u/roger/makefile 3) ^D at -l at -r root.686858340.a What it does At 5:00 p.m., message CALL HOME is written to terminal tty0

Compiles files specified in /u/roger/makefile. Results of this compilation are sent to user's mailbox who initiated the 'at' request.

List jobs in at queue. root.686858340.a Mon Oct 07 12:59:00 1991 Removes a job from at queue. at file: root.686858340.a deleted

top of page

basename Returns the base file name of a string Example: echo `basename \`pwd\`` Returns the name of the current directory your in. Does not show the full pathname of that directory. top of page

batch

Run 1 or more jobs in the background. All output will be sent to the mail system. Jobs submitted are started immediately. Example: batch job1 job2 ^D Note: Once a batch job starts, it's job number can't be seen via the at -l because that job is no longer in the batch queue - it's a running process. Further, once a batch job is running, it can't be canceled by the at -r <job #> command since this only cancels jobs that are still pending in the batch/at queue. top of page

captoinfo Converts a termcap source file to a terminfo source file Example: captoinfo Wyse150.tc > wyse150.ti Once the termcap file (*.tc) has been translated to a terminfo (*.ti) file, compile the .ti file with the tic compiler (tic wyse150.ti). top of page

cmp Compares two files for differences Example: cmp test1 test2 If the files are identical, no message is displayed, else the first difference is displayed. top of page

cut Cuts out selected text from a file or environment variable Examples What it does

echo `date|cut -d' ' -f2` cat /etc/passwd|cut -d: f1,3

Oct (returns the month from the date command ) Will output the 1st and 3rd field delimited by ':' from the /etc/passwd file: root:0 daemon:1 bin:2 lpd:104

top of page

date Displays or sets the date/time. Date format is: mmddHHMM.SSyy Example: date 02030830.0054 (This sets the date/time to Feb 03 08:30:00 CST 1954) top of page

iag Performs hardware problem determination

FORMAT & CERTIFY: Writes all of the ID fields and writes a bit pattern in all of the data fields. Also reassigns data blocks that are BAD during formatting. If too many BAD BLOCKS, a message is sent to alert operator. If data resides on the PV being formatted, it will be removed - lost forever. CERTIFY DISK Reads all ID and data fields. Checks for BAD DATA in the ID and data fields. If too many BAD BLOCKS, a message is sent to the alert operator that it's time to get another disk drive before this one fails.

NOTE: The software defect map is written at block of the PV device. This map is 22 blocks in size (AIX 3.1 version) and has enough space to hold about 1400 defects. Hardware relocations are performed only on WRITE operations where a READ request will return an I/O error back to the requesting application. top of page

diff Compares text files for differences

Example: diff -wi filea fileb -w ignores all spaces and tab characters -i case insensitive top of page

errclear Deletes entries in the error log Example: errclear 0 (Truncates the errlog to 0 bytes) top of page

errpt Generates an error report from entries in the error log Examples errpt -a|pg errpt -aN hdisk1 What it does Produces a detailed report for each entry in the error log Displays an error log for ALL errors occurred on this drive. If more than a few errors occur within a 24 hour period, execute the CERTIFY process under DIAGNOSTICS to determine if a PV is becoming marginal.

/etc/lpp/disagnostics/bin/run_ela Use this script to DETERMINE or JUSTIFY hard file REPLACEMENT. A message will be displayed on the CONSOLE device if a THRESHOLD value has been reached in regards to the number of hard file errors logged by the errpt utility. The following message may be seen: HDISKx : ERROR LOG ANALYSIS INDICATES A HARDWARE FAILURE. (x represents the hdisk number) top of page

fastboot Restarts the system without checking the file systems with the fsck command top of page

fasthalt

Halts the system top of page

find Finds files with matching expressions. Note: If the following error message is generated find: 0652-081 cannot change directory to </transfer/printers>: file access permissions do not allow the specified action. This means that the user you are currently logged in as (even root) doesn't have the authority to READ that directory. Examples find / -name jan92.rpt -print What it does Search all file systems for any file named jan92.rpt

find / -size +1000k -exec ls -l {} \; Searches all file systems to report back those files larger than 1MB in size -print find / -size 0 -print Find all files of ZERO length find / -type f -exec grep bananas {} \; -print find /usr/lpp/FINANCIALS print | xargs chown roger.staff find / -user roger -print find / -nouser -print find / -group staff -print find / -nogroup staff -print find . -perm 600 -print | xargs chmod 666 find / -mtime +100 -print find . -mtime 0 -print Searches all plain files to determine if the string 'bananas' is contained within it Changes the ownership of all files under /usr/lpp/FINANACIALS to be owned by user roger and have a group ownership of staff. Find all files owned by user roger Displays all unowned files in the system Find all files owned by group staff List all files that belong to a non-existent group not found in /etc/group Find all the files that have READ/WRITE permissions set for the owner of a file and change those permissions to READ/WRITE for everybody. Search all file systems for files that have not be modified in over 100 days. List all files in the current directory that have changed during the current 24 hour period.

find / -name /transfer -prune -o - List the name of all files from the / (root) directory except for the NFS file system named /transfer print find . -name PERSONAL -prune List the name of all files in or below the current directory, except the directory named PERSONAL or files in that -o -print

directory. find / -fstype nfs -print find . -newer disk.log -print List the name of all the files that reside in an NFS file system Display all files that have been modified more recently than the file named disk.log

top of page

grep Searches a file for a pattern. Grep stands for Global Regular Expression Printer Examples grep -i WhereIs * What it does Search all files in current directory to determine if the string 'WhereIs' is contained within it. The -i option ignores the case of letters (WhereIs is same as whereis) List all configured printers List any file that has a .doc suffix that contains a number (0-9) followed by a capital letter (A-Z). List any file that has a .doc suffix that contains any number except 0 to 5 and is followed by a capital letter (A-Z) Displays lines that BEGIN with the word IBM Displays lines that END with the word IBM Displays only those lines that consist of the phrase 'IBM IS GREAT'

lsdev -C|grep lp grep [0-9][A-Z] *.doc grep [^0-5][A-Z] *.doc grep "^IBM" *.doc grep "IBM$" *.doc grep "^IBM is GREAT$" *.doc

grep -v "^ *$" testfile > Removes all the blank lines from the source file 'testfile' and redirects the output to a new file named 'goodfile'. goodfile top of page

head Displays the first 10 lines (default) of a file. Example: head -25 /tmp/phase2.out (Displays the first 25 lines of the file /tmp/phase2.out.) top of page

id

Displays the system identity of the user Examples id id -ru top of page uid=0(root) gid=0(system) Displays the UID of the current login process 0 What it does

last Display information about previous logins stored in the /usr/adm/wtmp accounting file Examples last reboot|head -5 last roger last tty0 top of page What it does List last 5 times systems has been rebooted Display times user roger has logged in/out of the system Display times users have logged in/out of port tty0

login Initiates a new user session. Example: login -h rs6000 root Login to the root account on a machine whose hostname is rs6000 top of page

logout Terminates all processes on the port your logged in on, including your login shell. Note: exit will perform the same action as logout. Example: logout (Logs you off the system. Login prompt will reappear.) top of page

lsitab

List contents of the /etc/inittab file Example: lsitab -a top of page

lslicense List maximum number of users that can be concurrently logged in Example: lslicense Outputs: Maximum number of concurrent users: >32 top of page

kill Sends a signal to stop or suspend a process from running Example: kill -l (Lists valid signals to use with the kill command.) top of page

nl Produces an output file by inserting the line number of each line of an input file at the beginning of each line Example: nl /etc/passwd > /tmp/user.list top of page

nice Execute a command at a lower priority. Super-user may run commands with a higher priority by using a negative number. Higher numbers mean lower priorities (base priority is 10) Examples nice -n 15 make nice -10 /usr/bin/mview What it does Run the 'make' command at the low priority of 15 Run the 'mview' application at a high priority of 10

top of page

nvdmetoa Convert EBCDIC files to ASCII Examples nvdmetoa <AS400.dat >AIXver3.dat nvdmetoa 132 <AS400.txt >AIXver3.txt top of page What it does Converts an EBCDIC file taken off an AS400 and converts to an ASCII file for the RS/6000 Converts an EBCDIC file with a record length of 132 characters to an ASCII file with 132 bytes per line PLUS 1 byte for the linefeed character.

od Dumps the contents of a file in the requested format (ASCII,octal, hex, or extended character set) Examples od -c /tmp/rc.net.out 1) od -cd 2) \<FUNCTION KEY> 3) \<SHIFT><FUNCTION KEY> 4) \<ALT><FUNCTION KEY> top of page rmitab Removes an entry from the /etc/inittab file Example: rmitab ice (Removes the ice stanza from the /etc/inittab file) top of page sed Stream edit command to change text. Examples What it does What it does -c displays bytes as ascii characters By typing in this command, one may check the control codes being generated by function keys. From the command line, you press the '\' (backslash) character, then press a function key which results in the escape sequence for that key to be displayed.

cat /tmp/mytest | sed -e "s/reports/report/" > /tmp/mytest sed -e 's/ *$//' < SOURCE_FILE > DESTINATION_FILE sed '/total/d' /tmp/report > /tmp/report1 sed 's/[ ]//g' /ibm/report > /tmp/report top of page

All instances of the string "reports" is replaced with the string "report" for the file named /tmp/mytest Removes trailing blanks, not internal blanks, from each line in a file Delete all lines that contains the word total

sed '/^$/d' /tmp/report > /tmp/report1 Delete all blank lines from file Delete all tabs from file

shutdown Shutdown system operations Examples shutdown +0 shutdown -Fr shutdown -Fm What it does Shuts down a system immediately. Shuts down the system cleanly, followed by rebooting the system. Shuts down the system into maintenance mode. When using the 'm' option, make sure you are at the console, because thats where control will be returned to.

top of page

split Makes smaller files from a large one. Each of the new files can be up to a specified number of lines long. The smaller files are each named with the input filename or a specified name, followed by an 'x' and an increasing two letter sequence (xaa, xab, etc). top of page stopsrc Example: stopsrc -a Gracefully shuts down all subsystems controlled by the SRC - System Resource Controller. top of page

strip

Removes symbol table and other Extended Common Object File Format (XCOFF) data from an executable image. Example: strip /usr/bin/uniplex Reduces the storage overhead required by an executable file. This translates to less real memory usage required to have program run. top of page

su Runs a sub-shell with the effective user ID of the username passed in as a parameter to this command (root if no parameter is passed). Type in 'exit', or 'logout' to return to previous user's session. Examples su roger What it does Sets up environment as if you had logged in as user roger WITHOUT executing /etc/environment, $HOME/.profile or changing directories to $HOME for user roger.

su - root Initializes the user environment from attributes set in the /etc/security/user database and /etc/environment file, followed by executing the $HOME/.profile and changing directories to $HOME. Basically sets up the environment as if you had logged in as root. top of page

sum Displays a checksum for a file. Often used to validate if a file has been corrupted by comparing the suspect file's checksum to that of a known good file. Used to verify if a file has been corrupted or a file transfer was sent/received properly. Example: sum /unix Outputs: 13042 1253 /unix top of page

tail Displays the last 10 lines (default) of a file.

Example: tail /tmp/phase2.out top of page

tee Used to preserve intermediate outputfrom within a pipeline to a file for later processing or review Example: find . -cpio /dev/fd0 -print | tee /tmp/BACKUP.LOG A list of the files backed up by the cpio command will be saved by the tee utility in a file named /tmp/BACKUP.LOG top of page

telinit Examples telinit q telinit 1

What it does Forces the init process to re-read the /etc/inittab Brings the operating system into maintenance (single-user) mode. Same as typing in init 1

top of page

timex Displays the elapsed time it took for a command to execute. Real time is amount of time user waited for the process to execute. CPU time is amount of time that the process actually used the cpu. Example: timex find /tmp -print|backup -ivqf/dev/null top of page

tr Translates characters in a file. Handy for translating files from uppercase (DOS files) to lowercase (UNIX files). Examples tr '~' '\012' </tmp/DOSFILE > What it does Replace the tilde as a DELIMITER character in file

/tmp/UNIXFILE tr -d '\15' < file1 > file2 top of page

DOSFILE with a NEWLINE character in file UNIXFILE. Remove CR from file1 and creates a new file named file2

trace Kernel debugging to trace the events associated with the device your are monitoring. Examples traceon traceoff top of page type Shows path location of the specified command Example: type basename Outputs: basename is /usr/bin/basename top of page turns trace on turns trace off What it does

uname Displays attributes relating to hardware/software. Examples uname -a uname -m What it does Displays system name, operating system version, LAN network number, type of hardware running and so on. XXYYYYYYMMSS (machine ID) where...

XX=Feature of operating system. Always 00 YYYYYY=CPU ID. Value stored in ROM on processor board MM=Model number. Set to 7th & 8th digits returned by lscfg -v command SS=Submodel number. Always 00

uname -rv uname -S `hostname`

-r=release, -v=version. Results: 2 3 (Version 3 Release 2) Since the system name can be set in two places (hostname and uname -S), just set them to the same string.

top of page

w Lists summary of current user activity top of page

what Displays header information about the source files required to build the executable file your reviewing, timestamps as to when the source files where compiled, their build level, and so on. Example: what /unix top of page

whatis Displays a short description of the function a command performs Example: whatis vmstat Outputs: vmstat(1) - Reports virtual memory statistics. top of page

whereis Shows path location of the specified command Example: whereis motd Outputs: motd: /etc/motd top of page

who Displays information about all users currently on local system. When you log in, the login program writes a record in the /etc/utmp file. This record includes your user name, date, time of login, and the login tty/pts device. The who command checks this file to find out which users are

currently logged in, along with the hostname and display terminal they are logged under. Examples who -b who -r who -u What it does Displays date system was last booted system boot Nov 17 13:58 Displays run-level of machine Displays information about users currently logged in. The line activity field will EITHER have...

a dot (.) if there has been activity on the terminal within the past minute OR the number of hours/minutes since activity last occurred OR is marked with 'old' if the line has been quiet for more than 24 hours.

who -a /usr/adm/wtmp who -u /etc/security/failedlogin

Displays the name, terminal, and date users logged into the system Displays the account, terminal and date that a failed login was attempted.

/usr/lib/acct/fwtmp < /usr/adm/wtmp > Creates an ASCII version of the /usr/adm/wtmp file that can be read by the system administrator /tmp/ACCT.INFO top of page xargs Constructs an argument list and executes a command Examples find /u/netinst -print | xargs chmod 500 find /u/netinst -print | xargs chown netinst find /u/netinst -print | xargs chgrp staff What it does Files under /u/netinst will have permissions changed to 500 Files under /u/netinst will have ownership changed to netinst Files under /u/netinst will have group changed to staff

FILE COMMANDS

File Commands Understanding the AIX File System | Maximums | Path Definitions/Usage File System Disk Status crfs - create new df - display status of mounted file mkfs - create systems chlv - expand beyond max LV's du - display disk usage chfs - change attributes istat - display dates of access for a file fsck - check or fix ls - display contents of a directory rmfs - remove fuser - display users using a file system mount - mount umount - unmount sync - flushes system buffers to disk Directories & Files ln - link files or directories cat - display contents of text or ascii file unlink - unlink a file or directory cp - copy files or directories mv - rename files or directories del - delete file mvdir - rename directories rm - remove files or directories dircmp - compare files in different directories

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 Physical Volumes

What is it Examples A Physical Volume is an actual physical device, A system with 2 drives, could i.e. disk drive. Each disk drive contains a contain Physical Volume's hdisk0 Physical Volume. Physical Volume's are broken and hdisk1. into Physical Partitions (PP's) where each

Physical Partition is 4MB in size. 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. Volume Group rootvg could contain Logical Volume's hd1, hd2, hd3. Where the mounting points for hd1 = '/' (root), hd2 = /usr, hd3 = /tmp

Logical Volumes

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

Here's a table to help make this clearer, I hope. Physical Volume drive 1 = hdisk0 drive 2 = hdisk1 Volume Group rootvg datavg Logical Volume hd1 mounted as / 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 lspv lspv <physicalvolume> lspv -l <physicalvolume> lspv -p <physicalvolume> lspv -s <physicalvolume> lsvg -n <physicalvolume> Examples What it does Displays a list of all Physical Volume's with the drive name and associated Volume Group's 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 Displays what Logical Volumes reside on the named Physical Volume along with Logical Partition's Physical Partition's and Mounting Point. Displays distribution of Physical Partitions for each Logical Volume that reside on the named Physical Volume along with State, Region, Type and Mounting Point. Displays Physical Volume, total, free and used Physical Partitions. Displays total, free and used Physical Partitions and other information.

Volume Group Information What it does

lsvg lsvg <volumegroup> lsvg -p <volumegroup> lsvg -l <volumegroup> Examples lslv <logicalvolume> lslv -l <logicalvolume> top of page

Displays all Volume Groups Displays all Volume Groups, total, free and used Physical Partitions Displays Physical Volume, State and Physical Partition information Displays Logical Volume name, Type, Logical Partitions, Physical Partitions, Physical Volumes, Logical Volume State and Mounting Point What it does Displays Volume Group, Mirror State, Mount Point and more... Displays Physical Volume, Copies, Distribution info

Logical Volume Information

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 /bin /sbin /dev /etc /home /lib /tmp /usr /usr/adm /usr/bin /usr/lib /usr/spool/mail /usr/sbin /usr/share /usr/share/man /usr/share/dict /usr/share/info /usr/share/lib /usr/share/lpp /var/adm /var/preserve /var/spool /var/tmp top of page utilities

What's in it

files needed to boot the machine and mount the /usr file system special files (I/O devices) miscellaneous administrative utilities user directories and files libraries temporary files. Needs to be at least 12 MB common executables that are shared across the same architecture administrative commands and files utilities (overflow for /bin) archive libraries, text processing macros Email files utilities used in system administration, including smit architecture-independent, shareable text files manual pages spelling dictionary and its indexes InfoExplorer database files architecture-independent data files, including terminfo data about optional program products (OPP) system logging and accounting files preserved data from interrupted edit sessions spool iles for printing temporary files

cat Concatenates or displays one or more files.

Examples cat -v textfile tput clear | cat -v

What it does The -v option will display non-printing characters. 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 cp /u/roger/test.c /tmp cp -ipr . /tmp/temp

What it does Copies the file test.c in the directory /u/roger to the /tmp directory 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 beingcopied to it's new destination. -r Copies all files and subdirectories.

cp -r /usr/data /home/data top of page

Copies all files and directories from /usr to /home

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 du /tmp du -s /tmp du -a /u/roger/doc.txt top of page What it does Displays total number of 512 byte blocks used by /tmp filesystem and all directories underneath it Summarizes disk allocation for /tmp filesystem (including ALL files and subdirectories) in 512 byte blocks Summarizes disk allocation for a particular file

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 To make sure the /dev/hd1 (/u file system) is not damaged, followed by mounting that file system for user access.

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

-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 dd count=1 bs=4k skip=31 seek=1 if=/dev/hd4 of=/dev/hd4 fsck /dev/hd4 2>&1 | tee /tmp/fsck.errors top of page

The -y option gives fsck permission to automatically repair file systems when necessary. Use this command in case the superblock is corrupted. This will restore the BACKUP COPY of the superblock to the CURRENT copy.

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 ln test1 test2 ln -s /tmp ./junk 1) cd /u/COMPANY 2) ln -s /u/roger/* top of page

What it does Creates a link from the original file named test1 to a new file named test2 Links subdirectory junk under the current directory to directory /tmp. All the files under /u/roger will now have links to /u/COMPANY.

ls Displays the contents of a directory Options -a -d -e -l -t -F -R -b ls -ld . ls -ld .. ls -aeltFR ls -l ls -lc ls -lu top of page List directories only Indicates if a file has extended security information - 11th character: + means yes, means no Long listing - more detail Sorts by time of last modification (latest listed first) 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 Lists all subdirectories recursively Lists garbage or hidden characters in octal What it does List directory attributes for CURRENT directory List directory attributes for PARENT directory (one level up) Lists all files and subdirectories under current directory Displays the last time the data in a file has been changed. Displays the last time the attributes of a file have been changed. Displays the last time the data in a file has been accessed. What it does Lists all entries including hidden files that start with a "."

Examples

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 mount What it does Displays attributes about all file systems that are on-line

mount /u/data Mounts the file system named /u/data for accessibility. If you don't have enough room in the /tmp filesystem for a specific utility to mount /usr/tmp /tmp 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 - Mount a remote file system (type=nfs) on the mount point named /transfer, that v nfs /transfer resides on node cad top of page

mv Renames one or more files

mv report1 report2 (Renames the file named report1 to eport2) 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 rm -i * rm -r /u/roger/docs rm -i S\&e38912 What it does Will prompt the user to remove each of the files in the current directory beforeremoving them EXCEPT for hidden files. Will recursively remove all files and any subdirectories found under /u/roger/docs. 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. Removes all files from current directory including hidden files (file names such as {}, -exec, ;, etc) 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 ... Removes all files named mbox found under any of the subdirectories located in /home.

rm `find . -print` rm ./-junkfile

rm /home/*/mbox

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) top of page

Network Commands Subnet Mask Addressing /etc/hosts.equiv - Defines which client HOSTS are permitted to execute commands /etc/hosts.lpd arp - Translation table between TCP/IP addresses and network host

$HOME/.netrc - Specify automatic login information $HOME/.rhosts - Defines which client USERS are NOT required to supply a login password ping - Sends an ICMP ECHO_REQUEST finger - Lists the current users logged

hostname uname nameserver & resolv.conf ifconfig - Configures or displays the network interface

on iptrace - Debug trace utility for ip packets ipreport - Generates a packet trace report spray - Sends a specified number of packets no - Configures network options netstat - Show network statistics nfsstat - Lists statistics about network file system

Subnet Mask Addressing Assume a configuration as follows... SOURCE ADDR = 128.100.0.1 DESTINATION ADDR = 128.100.69.100 SUBNET MASK = 255.255.255.0 BROADCAST MASK = 128.100.0.255 In this case, the DESTINATION PACKET will go to the DEFAULT GATEWAY ADDRESS Assume a configuration as follows... SOURCE ADDR = 128.100.0.1 DESTINATION ADDR = 128.100.69.100 SUBNET MASK = 255.255.0.0 BROADCAST MASK = 128.100.255.255 In this case, the DESTINATION PACKET will NOT go to the DEFAULT GATEWAY ADDRESS and will be routed within the local network. To determine via the SUBNET MASK if a destination packet goes to the GATEWAY node or not, follow these simple rules: 1. Perform a LOGICAL AND of the destination address of the mask of the local subnet address 2. Perform an EXCLUSIVE OR on the result of the previous operation and the local net address of the local interface (eg., source address) 3. If the result of the previous operation is a ZERO, the destination is assummed to be reachable directly through one of the local interfaces ELSE the packet is forwarded to the DEFAULT GATEWAY ADDRESS. top of page

$HOME/.netrc Automatic login information for the ftp and rexec commands. syntax: machine <hostname> login <username> password <password> If this file contains a password entry (optional), the file permissions must be set to 600 (rw for owner only) or else the error message rshd: 0826-813 Permission is denied is generated. The file .netrc must exist on the client that your executing the ftp or rexec command from and the <hostname> must specify the name of server to connect to. For FTP only, you can initiate file transfers via a macro definition (up to 16 macros can be defined). This file resides on the client machine. An example of the contents of a .netrc file... machine sys8 login transfer password now macdef init get /tmp/database.log /tmp/log/database.log quit top of page

$HOME/.rhosts Defines which client users are not required to supply a login password for the rcp, rlogin, or rsh commands using a user account on the server. The file resides on the server machine under the home directory of the user account being logged into. An ALIAS entry cannot be specified. syntax: <hostname> <username> top of page

/etc/hosts.equiv Defines which clients are permitted to execute commands by the lpd, rlogind, rcpd, or rshd daemons without supplying a password. syntax: <hostname> top of page

/etc/hosts.lpd Defines which clients are permitted to print jobs to the print server. top of page

arp - Address Resolution Protocol Displays the translation table between TCP/IP addresses and network addresses. This physical address is six bytes long and is unique for every network board. The first three bytes of the address represent a vendor's ID. The last three bytes are assigned by the manufacturer. Some examples...
NOVELL 00 00 1B NOVELL 08 00 14 3COM 02 60 8C SUN 08 00 20 IBM 08 00 5a DEC AA 00 04

Note that an IP address is really assigned to a network interface and not a host. A host may have more than 1 network interface as illustrated by the output of the netstat -i command. Useful tool for debugging network problems.

For example, if you are using the DOS SERVER daemons to connect PCs to the RS/6000 and connections aren't being made, check the arp table to see if there is a hostname entry for the name of the PC you are connecting from. If there is an entry in the arp table, then you know that packets are getting across and the problem lies with the DOS SERVER or PC DOS CLIENT software. Further, you may have configured two or more hosts with the same internet address. If this is the case, its possbile that one connection may get hung. That's because the entry in your arp table gets overwritten by the new connection. View the arp table and you'll find that the internet address may now be bound to a new physical network address. The connection that is hung, will not show the correct physical address for that IP address. It shows the new physical address of the machine that has the same IP address of the previous connection. Another reason to use this utility for a debugging tool is to show what network adapter card address is mapped to an internet address. If by chance, you have two nodes on your network with the same internet address, you will have periodic problems keeping a connection to one of those two machines until a unique internet address is assigned to each machine.

Examples: arp -a (Displays all addresses that have been translated by the address resolution protocol.)

Outputs: dospc (193.0.0.8) at 10:0:5a:2b:69:64 [token ring] eai1 (192.0.0.3) at (incomplete) An incomplete entry in the network address field means the node in question could not be contacted. Probably reasons are:

node doesn't exist on the network node isn't connected to network network is not terminated properly problem with network cabling software on destination host has a bug

arp -d dospc (Remove the dospc entry from the arp table) top of page

finger Lists the current users logged in from remote machines, including username, hostname, idle time, and so on Example: finger -i (alias f -i) top of page

host This command returns the internet address when a hostname is specified or the hostname when the internet address is specified. Examples host www.ahinc.com host 209.218.236.72 top of page What it does www.ahinc.com 209.218.236.72 www.ahinc.com 209.218.236.72

hostname Sets or displays the name of the host system Examples What it does

hostname hostname rs520 top of page

Displays the current hostname value Sets the name of the machine to rs520. Make ure that you set the system name to rs520 by executing the uname command

uname Sets or displays the system name Examples uname -S rs520 uname -a top of page Sets the system name List the system name What it does

ifconfig Configures or displays the network interface parameters for a tcp/ip network Examples ifconfig en0 What it does Indicates if the en0 interface is up and running. en0: flags=2000063<UP,BROADCAST,NOTRAILERS,RUNNING,NOECHO> inet 192.0.0.1 netmask 0xffffff00 broadcast 192.0.0.255 Before this command is executed the state of the en0 interface is down (doesn't show UP): en0: flags=2000062<BROADCAST,NOTRAILERS,RUNNING,NOECHO> inet 192.0.0.1 netmask 0xffffff00 broadcast 192.0.0.255 After this command is executed the state of the en0 interface is: en0: flags=2000063<UP,BROADCAST,NOTRAILERS,RUNNING,NOECHO> inet 192.0.0.1 netmask 0xffffff00 broadcast 192.0.0.255 Adapter statistics for the ethernet card get reset to zero. See the netstat -v display for further information.

ifconfig en0 up

1) ifconfig en0 down 2) ifconfig en0 detach top of page

iptrace Debug trace utility for IP packets Examples iptrace -a -s 193.0.0.1 -i en0 network.log What it does All TCP/IP packets that originate from host address of 193.0.0.1 with a ethernet network interface (en0) will be logged to the file network.log.

top of page

ipreport Generates a packet trace report generated from the iptrace facility Example: ipreport network.log Dumps the packets that were trapped from the iptrace session in ascii format for inspection. Must kill the iptrace process before this report can be displayed. top of page

nameserver (resolv.conf) Examples What it does If the arp -a or host commands hang, usually means the name server host ahinc or daemon (/etc/named) is not running. Use the command ps -ef|grep named arp -a to check if named is running. Telnet login responce is very slow. Make sure the /etc/resolv.conf file has a valid entry in it and the /etc/hosts file has the appropriate entries for all known client nodes. Contents of an example of a /etc/resolv.conf: nameserver 192.168.1.1 domain ahinc.com When using the named process, each node should have at least the loopback and local host name defined in the /etc/hosts file. top of page netstat Shows network statistics

What it does netstat -f inet List statistics of AF_INET address family for remote communications netstat -f unix netstat -m List statistics of AF_UNIX address family for local communications. Shows current network interfaces that are up and running.

Examples

If a network interface shows an asterik next to it (en0*), this means your interface is down. Use the ifconfig command to bring the network back up. If the Ierrs field (input errors) is nonzero, this means their are no more kernel memory buffers left to store an incoming frame or indicates a frame error has been detected. If the field Coll field has a colllision rate greater than 1% of the packets sent/received, then a serious network problem exists.

netstat -r

If the non-loopback entry has a G in Flags field (g=gateway), then the ping command may hang. Change the Flags field to U only. Make sure the ROUTED daemon is running. To start: startsrc -s routed. Route Tree for Protocol Family 2: Displays statistics for each protocol (ip, icmp, tcp, udp) Shows statistics about network interface cards installed.

netstat -nr netstat -sr netstat -s netstat -v

If the Xmit Carrier Lost field contains a non-zero value, you most likely have a problem with your ethernet cable. The errpt command should contain entries for the eth? device where o ? is=first ethernet adapter o 2=second ethernet adapter, etc These error entries should cycle between ENT_ERR6 and ENT_ERR2 and reference problems with the ethernet cable itself. Use the ping command to further identify the problem and also validate through diagnostics that the network adapter card is good. XMIT MAX COLLISIONS gets bumped when the transmitter has tried to transmit a frame 16 times and each of the 16 failed due to a collision. XMIT UNDERRUN gets bumped when the transmitter is getting underruns. XMIT TIMEOUTS gets bumped when the transmitter on the adapter times out while trying to transmit. PACKETS TOO LONG get bumped when a packet is detected that is larger than the interface can handle (en0 of 1514+ bytes) RECEIVE DMA LOCKUPS gets bumped when the adapter card has detected itself in a lockup state. The microcode will then restart the 82586 to correct this problem and get things working again.

INTERRUPTS LOST is the number of interrupts which are not caught by that NIC device driver. When this counter is not 0, a problem exists with the device driver or NIC. NO MBUF ERRORS is the number of failed receive MBUF requests from the NIC device driver. RECV OVERRUN COUNT is stating the the NIC is getting overrun. This is not a big problem unless you see many of these. New microcode/EPROMS may reduce this number. RECV PKTS DISCARDED is stating packets are being received that can't be matched to the TYPE field. For Ethernet cards, the type of frames being received would only be 802.3/Ethernet Ver 2.0 PACKETS REJECTED NO NETID is stating that a packet came in at the LLC level and it didn't have a SAP bound to send it up to. In other words, the device driver didn't recognize the packet type that came in. Could be because your co-existing with a Novell network using IPX and your using TCP/IP.

netstat -v top of page

chdev -l ent0 -a receive_size=60

nfsstat Lists statistics about network file system (NFS) and remote procedure calls (RPC). Also distinguishes between client and server information. top of page

no Configures network options. The no command ONLY operates on the currently running kernel. This command must be run each time the system is rebooted. Examples no -o tcp_ttl=40 no -o thewall=3000 What it does Specifies the time to live for TCP packets (40 ticks). Sets the size of the mbuf pool to 3 MB (default is 2 MB). If requests for mbufs has been denied, this should prevent requests from being denied. Turns off IP forwarding Increasing the buffers to 8k, performance gains of up to 10-20% have been attained.

no -a ipforwarding=0 no -o tcp_sendspace=8192 no -o

tcp_recvspace=8192 top of page

ping Sends an ICMP ECHO_REQUEST message to a network host every second. Examples ping rs520 What it does Quick way to determine if the network host you wish to communicate with is either up and running or is configured properly. If ping intermediately reports back packets (5 packets sent, 1 is lost, 2 packets sent, 1 lost, etc), suspect a bad connection.

ping 192.0.0.255 Generates responses from all the other nodes connected on a class C network. If you wish to see what nodes are up and responding on your network, this is a simple test to run. top of page

spray Sends a specified number of packets over the network and reports back performance statistics. Examples /usr/etc/spray AIX -c 1000 -l 1400 -d 1 What it does Send 1000 packets to the host named AIX with a delay of 1 micro-second, where each packet sent is 1400 bytes. This uses the RPC protocol.

Volume Commands Logical Volumes cplv - copy contents of LV to LV chlv - change attributes mklv - create rmlv - remove

Physical Volumes chpv - change the characteristics redefinevg - determines which PV's belong to the specified VG ipl_varyon - indicates which PV is

lslv - list mklvcopy - create a copy putlvodm - reads LV data Volume Groups exportvg - export importvg - import lqueryvg or lsvg list rmlvcopy - remove a copy varyonvg - activate varyoffvg - turn off chvg - turn quorum checking off syncvg - sync VG's

BOOT drive lspv - list migratepv - migrate Other Utilities bootinfo lsps - list paging space info savebase - reads the base customized information from the ODM and restores it to the boot device restbase - reads the base customized information from the boot image and restores it in the ODM sysdumpdev schedtune - detects when the system is thrashing and suspends active processes getlvodm - determine whether the ODM or VGDA has the correct copy synclvodm - read the VGDA from the Physcial Volume specified and update the ODM

Useful Information Definitions How to perform mirroring Steps required to re-import VGs after How to move a PV to another SCSI a system re-install controller Steps required to replace a failing PV How to mirror a Boot LV from a non-root VG

Definitions Examples PHYSICAL PARTITION (PP) LOGICAL PARITITION (LP) LOGICAL VOLUME (LV) VOLUME GROUP (VG)

What it means Smallest unit a PV is divided into (4 MB partition size) 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). 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 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 One or more LVs. Represents a hard disk (hdisk0). (PV) 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.

A few notes about Mirroring Mirrored LVs that generate lots of write I/O calls, will cause a disk performance penalty (such as paging LVs). For LVs that encounter heavy read I/O calls, disk performance is increased. Since the LVM (logical volume manager) driver keeps track of the location of each disk head, the disk arm closest to the data being requested will be issued the read request. Further, mirroring can only be performed within a single VG. NFS mounted file systems cannot be mirrored. top of page

Steps required to re-import VG's after a system re-install When a system is re-installed, the disk drives may not be named in the same order as they originally appeared. If the system halts with the message 'performing Auto varyon of Volume Groups' on the console, perform these steps:

1. 2. 3. 4.

Press CTRL-C to continue and login as root Export ALL non-root volume groups export <VGName> Shutdown and reboot the system shutdown -Fr Re-import non-root volume groups importvg -y <VGName> <PVName>

top of page

Steps required to replace a failing PV from a non-root VG 1. Backup all filesystems found on the failing PV. 2. lspv -l <PV> (lspv -l hdisk2) To determine which filesystem(s) are found on the PV in question. 3. Find out how the LVs are laid-out on the PV so you will know how to re-create them when the time comes. 4. lslv -m <LV> (lslv -m oracle) You will use the output of the lslv command to serve as a template for creating a map file for this LV later on. 5. Unmount all filesystems on that PV. umount <FILESYSTEM_NAME> to unmount each filesystem from the PV in question. 6. Remove all LVs found on that PV. rmlv <LV> (rmlv /oracle) 7. Remove the questionable PV from the system. reducevg <VG> <PV> 8. Remove the PV entry from the ODM database. rmdev -l <PV_NAME> -d (rmdev -l hdisk2 -d) 9. Shutdown the system: Shutdown -F 10. Remove the bad PV and install the new PV 11. Add the new PV to the VG in question. extendvg <VG> <PV> (eg., extendvg datavg hdisk2) 12. Re-create the LVs removed from the OLD PV to the NEW PV. mklv -y<LV> -m<MAP_FILE> <VG> <PP_NUM> <PV> (mklv -y oracle -m oracle.map oraclevg 200 hdisk2) The map file is assembled from the output generated from the lslv -m command in step 2 above. Do this for each LV that existed on the removed PV. 13. Re-size the filesystems on the new PV. mkfs /dev/<LV> (mkfs /dev/oracle) Do this for each file system that existed on the removed PV. 14. Perform a filesystem check before mounting it. fsck -f /dev/<LV> (fsck -f /dev/oracle) 15. Mount all filesystems on that PV. mount <FILESYSTEM_NAME> (mount /oracle) 16. Now restore the data you backed up top of page

How to perform mirroring 1. mklv 2. mklvcopy 3. synvg -l <LV>

top of page

How to move a PV to another SCSI controller As long as all your doing is moving a PV to another SCSI adapter and not placing that PV in another VG, then just move the PV to the other SCSI adapter and reboot. When the machine comes back up and finds that the disk is no longer located in its previous slot, it finds the exact PVID of the disk on the other adapter and assumes the disk was moved. It then changes the ODM accordingly, and your back in business again. top of page

How to mirror a boot logical volume Each hard drive is a potential boot device. The bosboot command creates a bootable image in the BLV (boot logical volume), which is used to boot AIX. The first block (sector) on the disk is called the boot block or IPL record. In addition, NVRAM contains a list of boot devices which can be specified by the bootlist command. The boot device can be changed by using the bosboot and bootlist commands. The format for these commands follows: bootlist -m normal hdisk0 for normal operations bootlist -m service fd0 rmt0 hdisk0 for service operations bosboot -u -d /dev/hdisk0 bootable image in BLV on hdisk0 The bosboot command puts a bootable image in the BLV that is used to boot the system. Also, the bosboot command puts the physical sector number of the beginning ofthe bootable image on this disk, into the boot block of the disk. Since only one PSN (that of the primary copy of the BLV) is stored, therefore all copies of the BLV must reside on the SAME physical partitions of their respective devices. An example of a mirrored BLV with 3 copies follows: blk XXX, where XXX is the starting physical sector number in hex, within the specified physical partition (PP) number. Copy 1 hdisk0 LP 1: PP 1(blk 200 ) LP 2: pp 2(blk 2200) Copy 2 hdisk1 LP 1: PP 6(blk C200) LP 2: PP 7(blk E200) Copy 3 hdisk2 LP 1: PP 4(blk 8200) LP 2: PP 5(blk A200)

To use hdisk0 as the boot device, specify the following: bosboot -a -u -d /dev/hdisk0 The IPL record on hdisk0 indicates the boot image starts at PSN (physical sector number) 200. Now, the system can be booted using drive hdisk0.

To use hdisk1 as the boot device, issue the following: bosboot -a -u -d /dev/hdisk1 Because the bosboot program only looks for the PSN of the first copy, the IPL record indicates the starting PSN for the boot image as 200 instead of the correct C200. Attempts to boot with hdisk1 as the boot device will fail. To mirror the BLV and get around this problem, do the following. Insure that all the copies occupy the same physical partitions on each device. It is not important which partitions the BLV uses, but all copies must use the same relative positions on the disk device. So, the configuration should be: Copy 1 hdisk0 LP 1: PP 10(blk 20200) LP 2: pp 11(blk 22200) Copy 2 hdisk1 LP 1: PP 10(blk 20200) LP 2: PP 11(blk 22200) Copy 3 hdisk2 LP 1: PP 10(blk 20200) LP 2: PP 11(blk 22200)

To move individual partitions around and keep them in sync, use the lmigratepp command. To find available physical partitions on a disk, use lspv -m hdisk? Take the output of this command and choose two physical partition that are allocated/free on all the target disks and use these partitions to create your BLV image on multiple disk drives. If your mirroring, make sure that PTF U407433 is installed. This allows you to disable the QUORUM feature. When one disk dies, the other disk will take over without checking to see if the quorum is still meet. (chvg -Qn rootvg) When a write is performed to a disk containing mirrored copies, all copies are written simultaneously in parallel mode, and each is written sequentially in sequential mode. Should the system crash while parallel writes are being performed to mirrored copies of the data, inconsistencies may exist between the data which was actually written to the different copies. To protect against this, the Mirror Write Consistency Cache was developed to write a record to the disk each time a mirrored write is in progress, so that when the system is rebooted, a record will show that possible inconsistencies may exist, and the data from the first physical partition is rewritten to all other physical partition copies. However, by enabling the Write Consistency Check, the penalty you pay is having to do an extra read/write when doing I/O. When this feature is disabled, if the system goes down because of power failure or system crash, you will need to MANUALLY perform a syncvg when the system is rebooted. The jfslog is used to keep a record of file system metadata (superblock, inode, directories, etc) and also ensures the integrity of the file system. The impact of losing the PV containing the jfs log will be quite serious. All file systems using that log will become unavailable.

top of page

bootinfo Examples

What it does /usr/sbin/bootinfo - Displays the boot PV device (hdisk0). The boot PV does NOT always refer to hdisk0. The boot PV will ALWAYS be the PV that contains the b LV named hd5. The LV hd5 contains the boot logical volume (BLV), which contains the information needed to boot the system into a single/multi-user state bootinfo -a hdisk1 320 4 8 00-01-00-00

top of page

chlv Changes the attributes for an LV Examples chlv -x 256 hd1 What it does 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. 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>

chlv -n informixlv lv00

top of page

cplv Copy the contents from one LV to a new or existing LV Examples cplv -e newroot hd4 What it does 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 chpv -a n hdisk2 What it does 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 chvg -Qn rootvg

What it does 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 extendvg datavg hdisk3 top of page What it does Adds the PV hdisk3 to VG datavg. This increases the size of the VG by adding one or more PVs.

getlvodm Examples getlvodm -u rootvg

What it does 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. 2. 3. 4. 5. 6. 7. 8. 9. importvg -y vg2 -f hdisk1 use force option varyonvg -f vg2 use force option copy data off drive reducevg vg2 hdisk1 rmdev -l hdisk1 -d cfgmgr extendvg vg2 hdisk1 add file systems 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 ipl_varyon -i top of page

What it does Indicates which PV is your BOOT drive

lqueryvg Examples

What it does lqueryvg -p hdisk0 List the VG id in which the PV hdisk0 resides -v lqueryvg -p hdisk0 List all the LV ids/names in the VG where PV hdisk0 resides -L lqueryvg -p hdisk3 Lists all the PV ids that reside in the VG where hdisk3 resides -P

top of page

lslv List characteristics about a logical volume Examples lslv hd3 lslv -m hd3

What it does Display attributes of the LV hd3 List distribution of PPs where LV hd3 resides on PV hdisk1

lslv -l hd3 List distribution of 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: o 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: o If set to MIN, an LV will only reside on 1 drive o 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.

o o

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)

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. top of page

lspv List charactertistics of a physical volume Examples lspv hdisk0 What it does Stale partitions refers to mirroring. If the PV has no mirrored LPs, then the value for this field is zero. Display distribution of PPs for each LV that resides on the PV named hdisk0

lspv -l hdisk0 Display distribution of what LVs reside on the PV named hdisk0 lspv -p hdisk0 top of page

lsvg List characteristics about volume groups Examples lsvg rootvg lsvg -o top of page Display attributes for VG rootvg Lists all active VGs in the system What it does

lsvg -p rootvg Display PV distribution about VG rootvg

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 migratepv hdisk0 hdisk1 migratepv -l hd1 hdisk2 hdisk1 top of page

What it does Moves all LVs from hdisk0 to hdisk1 Copies all PPs for LV hd1 from hdisk2 and places them on a PV named hdisk1

mklv Creates a logical volume on a physical volume Examples 1) mklv -y hd7 -t sysdump -a e rootvg 2 hdisk0 2) sysdumpdev -P -p /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 top of page What it does 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. 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.

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 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 8) mklvcopy hd8 2 hdisk1 9) syncvg -v rootvg What it does Will mirror the operating system so that the system may be booted 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 top of page

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

putlvodm Reads LV data from the command line and writes it to appropriate ODM (Object Data Manager) class fields. Examples putlvodm -K `getlvodm -v rootvg` What it does 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 redefinevg -d hdisk0 rootvg top of page What it does Updates the ODM for a specific VG with the information stored in the VGDA

reducevg Removes one or more PVs from a VG 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. Examples

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 rmlv lv00 What it does 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 rmlvcopy lv00 2 rmlvcopy lv00 1 hdisk2 top of page What it does Removes both copies of the LV lv00 Only the copy (LV:lv00) that exists on PV hdisk2 is removed.

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. What it does schedtune -h 0 Disables memory load control. Memory load control is ENABLED by default. schedtune schedtune -D top of page Determine current settings for load control. Resets memory load control to its default characteristics Examples

syncvg Synchronizes stale partitions within VG. syncvg is automatically run when the VG is varied on ('varyonvg' command). Examples syncvg -v rootvg syncvg -l lv00 top of page What it does Synchronizes stale partitions on any PV that belongs to VG rootvg. Synchronizes the LV lv00 so that all copies are identical

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 synclvodm rootvg hd1 top of page

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

sysdumpdev Operations performed on the system dump device Examples sysdumpdev -p sysdumpnull sysdumpdev -p hd7 updatevg rootvg top of page What it does Turns off the dump device Reactives the dump device Resynchronizes the VG information in the ODM

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 Varys-off ALL PVs associated with the VG named oracle. Essentially 2) varyoffvg oracle makes that VG inaccessible top of page

varyonvg Activates a VG. Takes the information stored in the ODM database and updates the kernel. Examples varyonvg oracle What it does 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

Installation Commands mksysb - System backup before updates and preparation lssrc -a - Subsystem information bffcreate - Extract images from tape instupdt - Install, reject or update installp - Install mods xlpp - Generates a numbered list of tape images ifregs - Generate a list of PTF's that need to be installed lppchk - Determines if any files are corrupt lslpp - Show attributes of licensed products PowerChute - Configuration for APC UPS auto shutdown

mksysb - System backup before updates Whenever an update to the system is attempted

Always make sure that a smit mksysb backup of the system was made. If something goes wrong during the update process you will have the ability to restore the system back to it's previous state. If not followed, MURPHY'S LAW could come into play. When applying an update, bring the system down to maintenance mode using the command shutdown -Fm. This way you are absolutely sure that no one else can effect the update process. Make sure the following three file systems are mounted: /, /tmp, and /usr. If /tmp or /usr are unmounted, re-mount them since they will be needed during the update process. If the system was preloaded (there are installable images under the /usr/sys/preload directory), make sure you: o Backup those images to a tape for later reference (Optional) o Remove the /usr/sys/preload directory and its contents. o Once those images are installed, no need to keep them lying around

top of page

lssrc -a The command lssrc -a will list all src controlled installed subsystems. If you only want to list active subsystems, use the command lssrc -a |grep active. If you are going to update a subsystem that is currently active, you need to de-activate each of the subsystem(s) using one of the following commands:

stopsrc -g <SubSystem Group> stopsrc -s <SubSystem Name>

Some subsystems (eg., DOS SERVER) may have to manually be brought down with the kill command. If these steps aren't taken, the lpp may fail to install. top of page

bffcreate What it does bffcreate -qv -d/dev/rmt1.1 -X pci sna snamEn_US extracts the pci, sna, and snamEn_US backup images from the tape device and places them under the /usr/sys/inst.images directory (default for install images) for future installation. bffcreate -qv -d/dev/rmt0.1 -X all extracts all the images on the tape to /usr/sys/inst.images. Examples

top of page

instupdt Install, reject, and/or update licensed program products (lpps). Examples instupdt -r What it does Rejects applied updates that have yet to be committed. Use this command if one or more lpps failed to install properly. You may have to manually change the stat of the OPP rom broken to installed. If a

second go around fails, use the next 2 commands. lslpp -l Determines if the state of the lpp is something other than 'installed'. Use this command to correct If the state is not installed. Do not use this command without first consulting an AIX system engineer.

odme lpp

instupdt -qI -d/dev/rmt0.1 -v -X -F bosadt.xde.obj bosadt.xde.obj Installs the bosadt.xde.obj lpp from the tape device. If the lpp already exists, the '-F' option will force an install of a lower version of an lpp over a higher version (overwrite option). instupdt -qI -d/dev/rmt0.1 -v -X bosnet.tcpip.obj Installs the lpp image named bosnet.tcpip.obj for the first time. -q=quiet mode (suppresses prompt for device) -I=install -X=expand file system if necessary to install lpp -v=verify installed files for correct checksums instupdt -acq -d/dev/rmt0.1 -v -X bosnet.tcpip.obj Installs original release of bosnet.tcpip.obj and then applies the newest update for that lpp. -ac=apply and committ smit instupdt_list_problems instupdt -qU -dev/rmt0.1 -ac -X bosnet.tcpip.obj Lists the problems fixed in this current release. Updates lpp named bosnet.tcpip.obj with newest release. Must have an installed image in order to apply an update.

In other words, you can't apply an update to an image that doesn't exist on your system. top of page

installp Examples installp -C installp -c -g -X all What it does Used to cleanup after a failed lpp install/update Commits all applied LPPs or PTFs

installp -q -d/dev/rmt1.1 -l > /tmp/toc.list Lists the table of contents for the install/update media and saves it into a file named /tmp/toc.list installp -s Lists the lpps that have been applied but not yet committed or rejected.

top of page

xlpp Examples xlpp -f /dev/rmt0 -lv > /tmp/TableOfContents What it does Generates a numbered list of available images on tape device /dev/rmt0.

xlpp -vf/dev/rmt0 -I <directory> <TapeNumber> Extracts one image at a time. Specify the number of the image TapeNumber rather than the name of the image. Also specify the directory where the image will reside. TapeNumber is the number of the image file as listed in the /tmp/TableOfContents file generated in the above step. top of page

ifregs Examples ifreqs > /tmp/ifreqs.list installp -f /tmp/ifreqs.list produces a list of PTFs that need to be applied/committed. What it does

top of page

lppchk Determines if any files belonging to the specified lpp are corrupt and if so will set the lpp to broken. Examples lppchk -c bosext2.dosutil.obj What it does Verifies file checksum and length for the dosutil.obj, against the checksum/file length settings stated in the /etc/security/sysck.cfg file. Displays information about missing PTFs or information about the incorrect state of a PTF. Verifies that the files belonging to the specified LPP exist and are of the correct file size.

lppchk -v lppchk -f bos.obj

top of page

lslpp Show attributes of license program products installed Examples lslpp -A lslpp -l lslpp -h lslpp -f bosext2.dosutil.obj lslpp -p x_st_mgr.obj lslpp -acl|egrep APPLIED What it does Generates the fixes for particular U numbers List of license program products installed Shows history (version level) of license program products List of files that belong to the license program product selected List of prerequisites objects that need to be updated with x_st_mgr List of LPPs installed but not committed. Whenever an update is done, make sure you first check to see if that object that is to be updated has pre-requisites. If it does, make sure these objects (xxxxx.obj) get updated, too. Verifies the LPPs installed were installed correctly. sysck used to verify contents of files at install/update time.

lslpp -v

Once the lpp image is applied, the sysck utility will consult the config file named /etc/security/sysck.cfg to verify file length and checksums. If no problems are encountered, the image will be committed and marked installed else is set to broken.

top of page

PowerChute configuration The rs/6000 normally has two serial ports that can be used to connect the cable from the UPS device: tty0 or tty1. You need the correct cable from APC. You need to disable the tty port. This can done in smit. You can also use the command pdisable tty0 or tty1. 1. 2. 3. 4. 5. 6. Enter smit Select Devices Select TTY Select Change/Show characteristics Select the correct tty, either tty0 or tty1 Change the baud rate to 2400

Depending on the APC model, you need to set the value for clocal in the Stty attributes for runtime and login. clocal must be in the list of attributes if you are using an APC model

Smart-UPS Matrix-UPS Advanced port of Share-UPS SmartSlot Expansion Chassis port Pass-through port of PowerNet SNMP Adapter

clocal must NOT be in the the list of attributes if you are using an APC model

Back-UPS Pack-UPS Pro Network PowerCell Basic port of Share-UPS SmartSlot Interface Expander port

Korn Shell Commands $HOME/.hushlogin $HOME/.sh_history exec

$HOME/.profile alias, unalias history

kill set, unset

process control

Korn shell The Korn shell is a command interpreter that allows an end user to type in commands to communicate to the AIX system. By default, when a user logins, a shell process is started The default AIX shell is /usr/bin/ksh. A '-' is prefixed to the name of the ksh program to indicate that this shell initially read the contents of the files /etc/environment, /etc/profile, and $HOME/.profile.

/etc/environment specifies the basic environment for all processes /etc/profile specifies variables to be added to the environment by the shell $HOME/.profile specifies variables specific to user to be added to the environment by the shell

Other available shells are...


/bin/bsh the Bourne shell /bin/csh the C-shell /bin/sh the Standard shell

top of page

$HOME/.hushlogin If the ./hushlogin file exists, it will suppress the displaying of the /etc/motd file (message of the day file) and the message for unsuccessful login attempts for that user account. top of page

$HOME/.profile The .profile file is used to personalize a user's account and/or sets the environment the user will operate under. The following table represents some examples of settings that can be set in the .profile file. Variables What it does

PRINTER=mylaser

Controls default printer. When you use the lp command with no additional flags to specify which queue to print to, by default it will go to the printer queue named after the equal sign. Will cause an automatic log off after 60 minutes (3600 seconds) if no keyboard activity encountered or no output is generated to the display after the timeout period has expired. There is a 60 second pause before the ksh is exited. Controls the amount of time permitted between the ESCape character and any other components of an ESCape sequence. The AIX Extended Curses library has a built-in timeout which sets the maximum amount of time permissible between the receipt of the ESC character and the second character of the escape sequence. Won't allow you to overwrite a file with the redirection symbol (eg., cat junk > goodstuff). To overwrite the noclobber option when noclobber is enabled, type '>|' when redirecting output (eg., cat smit.log >| smit.bck).

TMOUT=3600

ESCDELAY=1000

set -o noclobber

set -o ignoreeof set -o vi stty -olcuc -iuclc -xcase

Disables ^D to logout; you must type exit to exit the shell Enable command line editing/playback using vi commands -olcuc maps lower case to upper case on output. -iuclc=maps upper case to lower case on input. -xcase won't allow you to login unless in lower case.

top of page

alias, unalias Assign a name or an abbreviated name that makes sense or is shorter for a command. Examples alias alias "dir=ls" unalias name What it does Lists the aliases that are currently defined. Creates an alias. dir will output the same contents as the ls command. Removes an alias. unalias dir

top of page

exec Executes the command line directly without creating a new process (PID) (current shell is overlaid with command specified on the command line). When the command has finished or is terminated, control is returned to the init process, thereby logging off the user. Typically you will see this command used as the last entry in the $HOME/.profile. Examples exec /usr/bin/smit Changing standard input (stdin) exec <FileNameForInput exec </dev/tty exec <&exec </dev/null Changing standard output (stdout) exec >WriteToFileName exec >/dev/tty exec >&exec >/dev/null top of page Reassigns standard input from the keyboard to a file Reassigns standard input back to the keyboard Closes standard input Associate standard input to null device Reassigns standard output from your terminal display to a file Reassigns stardard output back to your terminal Closes standard output Associate standard output to null device What it does Will execute the System Management Interface Tool (SMIT) program - overlaying the current shell program

$HOME/.sh_history Contains the history of user commands executed on the command line for each login session. top of page

history List the last 16 commands executed from the command line. (Uses .sh_history) Examples history ! 310 What it does Re-executes the item labled 310 in the .sh_history file

-25 r vi

List the last 25 commands executed from the command line. Default number of commands listed is 16. Re-executes the latest 'vi' session stored in the .sh_history file

top of page

kill Sends a signal to a running process to inform it to do something. Typically you use the signal KILL to terminate or suspend a process. Examples kill -9 5344 What it does Will terminate the process with a process id (PID) of 5344. A signal value of -9 means that the signal can't be caught by the application but is intercepted by AIX to terminate the process in question. Lists valid signals to use with the kill command. Easy way to terminate all processes running in the system EXCEPT your current shell and the /etc/init process. Suspends the PID 3901. Execute the ps -elf|grep 3901 command and the status field (marked 'S') will have a 'T', meaning the process is suspended.. Resumes the suspended process whose PID is 3901

kill -l kill -

kill -STOP 3901

kill -CONT 3901 top of page

process control Pressing ^Z will suspend a process. To unsuspend a process, use the fg command to bring that process to the foreground again or to leave the process running in the background. Examples ^Z jobs -l fg 3934 What it does Will suspend the current PID. Example output: [1] + 8193 Stopped List all current jobs suspended Will bring suspended job PID 3934 to the foreground. If only one command is listed when jobs -l is executed, you only need to type fg to bring the only suspended

process back to the foreground. 4011 Will run the suspended job with a PID of 4011 in the background now

top of page

set, unset Set positional parameters for the current shell. Examples set `date`; echo $1 $2 $3 $4 $5 $6 echo $6 set -o set -o noclobber set +o noclobber set -o vi set +o vi set o xtrace set +o xtrace unset ENV What it does Thu Nov 14 20:12:47 CST 2002 Displays the year - 2002 Displays current settings for the set command. Won't allow a user to overwrite a file with the same file name. Use -o to turn on or +o to turn off Enable users to use 'vi' commands to manipulate command line entry. Use -o to turn on or +o to turn off Displays commands and their arguments as they are executed. Normally, you would place the 'set -x' command at the beginning of a script file. Used to undefine a system variable. Removes the system variable ENV from your user environment

top of page

Other Tips

System Information Console commands Spooler Controls

Capture Error Messages Files that keep growing File system - allocate more space 132 columns for HP Laser Printers

Console Commands

smit chcons (To change assigned console port at next boot) swcons /dev/x (To immediate change assigned console port - temporary change) lscons (shows name of current assigned tty or console port)

File system - allocate more space


chfs -a size='+500' /usr/acct (To enlarge file system) Use chlv -x 256 <lv-name> if you get an errorwhen running the above command (To expand beyond maximum LV's)

top of page

Spooler Controls

Spooler Daemon o startsrc -s qdaemon (start printer spooler) o stopsrc -s qdaemon (stop print spooler) lpstat -t (List spoolers and and existing jobs) cancel jobnumber (To cancel a spooled print job, example: cancel 450) /etc/qconfig (Spooler configuraton stanzas for port/lp config info) /usr/spool/locks/LCK..ttyXX (Where lock files are stored) To list spoolers, use any of the following... o lsque o lsallq -c o lsquedev o lsvirprt

top of page

Capture Error Messages To capture error messages to a file...

Edit the file /etc/syslog.conf o Find the debug line. o Make it active and change /dev/console to /tmp/<filename> Create the file /tmp/<filename> Now you need to stop and start the syslog deamon o ps -ef | grep syslogd (Displays the PID for syslogd) o kill -9 <PID value> (kill the current process for syslogd) o /etc/syslogd (Starts the syslog deamon)

top of page

Files that keep growing

Periodical the following files have to be decreased in size. You can use cat /dev/null command Example: cat /dev/null >/var/adm/sulog

/var/adm/sulog /var/adm/cron/log /var/adm/wtmp /etc/security/failedlogin /var/adm/ras/errlog (use errclear w/parameters)

top of page

System Information

ls -b (list garbage file names in octal) lscfg (lists installed devices, -v for versions or -c) lsgroup (lists user groups) lsuser (lists users) lscons (displays the current console tty value) lsswconfig -a (lists the s/w catalog) lsdev -C -c <class> -H (lists devices) lsattr -l <class> -a <item> -E (for current) o class values =tty, printer, tape, disk, adapter, dlc, bus, diskette, if, memory, logical_volume, mouse, port

top of page

You might also like