Tuesday 19 March 2013

AIX COMMANDS

GENERAL INFORMATION


AIX (version 3.2) is IBM's version of the UNIX operating system. AIX is the native operating system on the RISC System/6000 server and on the IBM RISC Model 220 workstations. These computers can be found in CCII-108 and in ENGR-124. AIX is a case-sensitive operating system, therefore the computer differentiates between upper and lower case letters.

GETTING STARTED


Before you can use AIX, you must first login to one of the RISC workstations. A free machine should have a prompt saying login: on the screen. At this prompt, enter your userid. AIX will then ask for your password. Enter this into the computer, and if entered correctly, you will be logged onto the RISC terminal. AIX will then display your OS prompt and wait for your command. The OS prompt displayed depends on which command interpreter (shell) you are running and any configurations installed. The default is the K-shell which uses a $ as its OS prompt. Handouts are available for more information about each of the shells.

USING AIX COMMANDS


AIX allows the use of several different shells. The main shells supported on the system are the Korn shell, the Bourne shell, and the C shell. The basic command interpretation is standard among these shells. However, each shell handles certain commands in a unique way. Therefore, the syntax section of the command will specify which shell syntax is being represented when differences occur. For example, {K} represents the Korn shell and {C} represents the C shell. Due to space restrictions, not all options will be specified with a command. Instead, only the more useful functions to a normal user are documented here. For more detail on the use of a command, use the mancommand or see the IBM AIX Commands References.

The syntax field uses some notation that may need to be clarified. Optional parameters are specified within square brackets '[' and ']'. A choice between options is denoted by a vertical bar '|'. Some options require that other options be specified on the command line. These options will be placed in braces '{' and '}' because their use is mandatory with certain options.

alias/unalias


syntax: alias [aliasedCommand AIXcommand]   {C}
alias aliasedCommand=AIXcommand {K}
unalias aliasedCommand

The alias command is used to give a nickname or alter the default options for an AIX command. This is a convenient way of assigning a short name to a frequently used command and options. The alias is interpreted by the shell, and therefore will execute before an AIX command of the same name. Entering the alias command without any options will show you your current list of aliases. AIX also allows you to have an alias represent several commands. This can be done by placing the commands (separated by a semicolon) between single quotation marks.

You can remove an alias by using the unalias command. The only parameter is the aliasedCommand you wish to remove from your list of aliases.



bg {K} {C}


syntax: bg [jobNumber]

The bg command is used to place processes in the background. If no parameter is specified, the job marked with a plus sign (from the jobscommand) will be placed in the background. If you specify a job number, that job will be placed in the background. If the job is stopped, it will be made active.



biff


syntax: biff [y | n]

This command determines whether you are notified of incoming mail upon receipt. Specifying the y option will cause AIX to notify you when mail is received. The n option will cause AIX to place the mail in your mailbox without notifying you.



cal


syntax: cal [month] year

The cal command is used to display a calendar on the terminal. If you specify just one parameter, a calendar for that year will be displayed. If you specify two parameters, the first will be used to specify the month, and the second to specify the year. When specifying the month, you must use a value between one and twelve. You can not use the name of the month as a parameter. The year parameter accepts values from 0 to 9999.



calendar


syntax: calendar 

The calendar program is a daily reminder. This command works by displaying the contents of a data file called calendar for which the date is today or the next work day. The data file should contain the date, and then the note for which you are being reminded. The date can be placed anywhere on the line and can be specified with word or numbers. The date, however, can not have the day specified before the month.



cat


syntax: cat [filename1 filename2 ...]

The cat command can be used to concatenate and display the contents of a file. It reads the contents of each file passed on the command line in sequence, and writes it to standard output. If no filename is given, or if a hyphen (-) is given as a filename, cat will read from standard input. By using the append redirection, you can use cat to concatenate files or to add new lines to a file without using an editor.

example:

cat file1 file2 > > file3

will copy file1 to file3 and then concatenate file2 to the end of file3.



cd


syntax: cd [subdirectory]

The cd command can be used to change from the current directory to another directory. If no subdirectory is specified on the command line, AIX will change to your home directory. If you specify a subdirectory name that exists in the current subdirectory, AIX will change the working directory to the specified directory. You can also change to more than one subdirectory by using the forward slash between subdirectory names. To go back to the parent subdirectory, change to the .. subdirectory. You can also use the tilde (~) to represent the home directory. If no parameters are specified, the Korn shell and the C shell will change to your home directory.

examples:

cd ~docforce/AIX

will change to the AIX subdirectory in userid docforce's home directory.

cd ../../docs

will go back two levels in the directory tree and then go down to the docs subdirectory.



chfn


syntax: chfn

This command is used to change or display your gecos information. This is information, such as your name or phone number, that is not required by the system. After executing the command, you will be displayed your current string and asked if you wish to make any changes. If you hit [Y] , you will be prompted to enter the new string. All printable characters are allowed except the semicolon and colon. The semicolon should be used to delimit fields in the information.

chmod


syntax: chmod [u,g,o][+,-][access][filename,subdirectory]
chmod [accessMode] [filename,subdirectory]

This command allows you to set access modes of your files and directories. Access modes can be granted to three classes of users. The first class is the user (u), the second class is your group (g), and the third is others (o). Access modes consist of read (r), write (w), and execute (x). The first syntax shows the letter instructions for assigning access. The second syntax shows the numerical method.

For the first syntax, you must specify the groups for which you are changing access modes. Next you should specify a plus or a minus depending on whether you are adding or removing access respectively. Last, you should specify the files or subdirectories for which the access is begin changed. If you wish to set several different access modes, you can use a comma to separate them.

For the second syntax you specify the octal codes for the access for the three groups. The second parameter should be the files or subdirectories to be changed. The access mode consists of three octal digits whose values are based of the r, w, and x bits respectively. Therefore, a value of 3 represents r and w access (bits 1 and 2 are set).

examples:

chmod g+w,o-r program.c

would grant write access to the user's group and remove read access from the others group for the file program.c.

chmod 735 docs

grants r, w, and x to the user , w and x to the group, and r and x to others for the subdirectory docs.





chsh


syntax: chsh [userid]

Issuing this command allows you to change your login shell as stored in the /etc/passwd file. If a userid is specified, the shell for that user will be changed. When the command is run, it will display a list of all the available shells. AIX will then ask if you want to change your current shell. If you specify y, you will be asked to enter the full path name of the shell to use.



cp


syntax: cp [i,r] filename1 filename2

This command will copy a file from filename1 to filename2. If the -i option is specified, AIX will prompt you before overwriting a file that currently exists. The -r option will recursively copy a directory and its contents.

example:

cp -i docs/aix.commands ~boss/man/aix.commands

will copy the file aix.commands from the docs subdirectory and place it in userid boss's man subdirectory. If the file already exists, you will be asked if you wish to continue.



del


syntax: del filename

This command will delete the specified file, even if it is write protected. When you use this command, AIX will verify that you want to delete the specified file. Hitting the [ENTER] or pressing [Y] will confirm the deletion of the file. Pressing any other key will cause AIX to quit the command without deleting the file.



df


syntax: df [filename,directory]

This command displays information about the mounted file systems, total space, and space available. If you enter df without any parameters, it will display information about all the mounted file systems. If you specify a file or a subdirectory, AIX will display information about the specified file system containing the file or directory.

diff


syntax: diff [-w,-i,-e] file1 file2

This command compares the specified text files and displays which lines differ. The -w option tells AIX to ignore tabs and spaces. The -ioption will cause AIX to ignore the case of letters and the -e option creates a script that can be used by ed to recreate file1 from file2.

example:

diff -e prog1 prog2 > changes.backup

will create a file called changes.backup that contains command to change file2 to file1.

du


syntax: du [-r,-s][-a[file]][directory]

This command can be used to display disk usage for the specified area. The -r specifies inaccessible files and directories. The -s option will display the total disk usage for the specified files or directories. You can use the -a option followed by a list of space separated filenames to specify which files the disk usage is to sum.

e


syntax: e [filename [line [column [searchkey]]]]

This command executes the INed full-screen editor. If no filenameis specified, e will display the last file edited. The cursor will also be placed at the place it was located when you last edited the file. You can also specify the line and column to start editing. If a searchkey is specified, the editor will start a search from the specified location for the specified string. To exit the editor, press [CTRL] [D] .



echo


syntax: echo {msg | $variable}

This command is used to write msg to standard output or display the contents of a shell variable. Shell variables' contnets can be diplayed by placing the variable name after the $. You can display command line arguments by using a dollar sign followed by the argument number. For example, $0will display the first command line argument -- the fil ename. Specifying an asterisk instead of a number will display all the arguments. If you specify a msg, the shell will write the string to the terminal.



ed


syntax: ed [filename]

This command brings up a line editor. This editor operates in either command mode or text input mode. By default, it starts in command mode. Edworks by copying the specified filename to a temporary buffer, therefore making changes to that copy. The original file is not altered until the write command is issued. To exit the editor, press [ESC] : [Q] .



emacs


syntax: emacs [+ line] filename

This command invokes the emacs editor. with the file filename. The + option can be used to start editing on a specific linenumber. [CTRL] [H] [T] will bring up a tutorial for a novice emacs user. For more information, please see the emacs handout.



enq


syntax: enq [-B charPair,-c,-C,-m text,-M file,-n,-N copies,-P queue,-r,-R priority,-t name,-T title] file
enq [-a priority,-# jobNumber]
enq [-A,-L,-q] [-# jobNumber] [-w seconds]
enq [-D,-G,-K,-L,-U]
enq [-x jobNumber,-X]

This command is used for communicating with shared resources, such as a printer. The first syntax is used to process files, such as sending a file to a printer. The second syntax is used to change the priority of a print job. The third syntax can be used to display the status of a queue. If you wish to change the status of the queue, you will need syntax number four. Finally, to cancel a print job, you would use syntax five. The next page has a table showing the various options and their definition.



opt description                             opt description
------------------------------------------------------------------------------
-B controls the printing of burst pages -a changes the priority
-c copies the file -# specifies the job number
-C use mail command instead of write -q displays the status of the default queue
-m submits an operator message w/ write -A provides status of all queues
-M submits an operator message w/ mail -L specifies the long status
-n notifies you when job done -w specify continuous output of queue status
-N specify number of copies -D downs the device
-P specify the queue -G dies gracefully
-r remove the file after printing -k kills are current jobs
-R set the priority -U brings up the device
-t labels the output for delivery to name -x ancels the printing of the specified job
-T puts title on the header page -X cancels the printing of your jobs



env


syntax: env

This command displays the current environment settings. It will display one variable per line.



fg {K} {C}


syntax: fg [jobNumber]

The fg command can be used to move a process to the foreground. If no job number is specified, AIX will make the job listed with a plus sign (from the jobs command) the foreground process. If you wish to make a certain background process the one to run in the foreground, use the job number preceded with a percent sign as the parameter.

example:

fg %3

This example will place job 3 as the foreground process.



find


syntax: find directory [-name filename] [-depth] [-group Group] [-ls] [-user userid] [-size n] [-links n]
[-atime n] [-mtime n] [-perm permissionCode] [-nogroup Group] [-prune] [nouser userid]
[-newer filename] [-print] [-exec command\;] [-ok command\;]

This command is useful for finding files that meet the specified criteria. The first parameter is the subdirectory in which AIX is to search. The variable n in the search criteria options represents an integer. A positive number means greater than or equal to n and a negative number represents no more than n. The next page contains a table showing the various options and a brief description.

opt description opt description ------------------------------------------------------------------------------ -name finds the specified filename -mtime files modified n days ago -depth do files first, than directories -perm finds file with a permission code of perm -group files who belong in Group -nogroup files who don't belong in Group

-ls all files -prune doesn't recurse into subdirectories -user files belonging to userid -nouser files not belonging to userid -size files of size n blocks -newer files modified more recently than filename -links files with n links -print print the pathnames of found files

-atime files access n days ago -exec executes the given command when filename is found; using {} to represent the found file -ok same as -exec but AIX confirms before execution example:

find . -atime +30 -atime-60 -exec mv {} /nobackup \;

This example moves all files that have not been accessed in the last 30-60 days from the current subdirectory down into the /nobackup subdirectory.



finger


syntax: finger [-m,-l,-s,-h,-p] [name]

This command can be used to display the users who are currently logged into the system or information about a specific user. If no options are specified, AIX will display a list of all the users who are currently on the system. If you specify a name, AIX will show information about users whose names matche name. If the - m option is specified, AIX will only search for login names to match name. The -l option will cause AIX to display the long list of information. In contrast, the -s option will display a short list of information. Using a -h will prevent the display of the user's .project file and -p will suppress the .plan file. If you wish to query users at a remote site, use the site's name preceded with an '@' character.



ftp


syntax: ftp [-i] [host]

This AIX command lets you login to another computer and transfer files. In order to use the file transfer protocol (ftp), you must have an account on the host system. The -i option tells AIX not to confirm each file to be transferred during multiple file transfers. For more information, see the handout on FTP for AIX.



grep


syntax: grep [-c,-i,-l,-n,-p,-v,-w,-x] pattern [file1 file2 ...]

This is a useful command for finding a string of text in the specified files. If more than one filename is specified in the search list, grepwill display the name of the file in which the pattern was found. If the pattern is not a simple string, you will have to enclose it with quotation marks. Character ranges are enclosed within brackets ([ and ]). Using the caret (^) will tell AIX to match patterns that begin with the specified range of characters. Filenames specified on the command line should be separated by spaces and can contain wildcards.

Below is a table containing some of the options and a brief description of each.

opt description                            opt description
-----------------------------------------------------------------------------
-c displays a count of matching lines -p displays paragraph containing pattern
-i ignores case in comparisons -v displays lines not matching pattern
-l list names of files with matching lines -w performs a word search
-n displays line number within file -x display lines that match exactly



groups


syntax: groups [userid]

This command will display the groups for which the specified useridis a member. If no userid is specified, group information for the current account will be displayed.



head


syntax: head [-count] [file1] [file2...]

This command is used to display the first few bytes or lines of a file. By default, AIX will display the first 10 lines of the specified files. Using a dash followed by a number will cause AIX to display the first countlines of the files. If no file is specified, standard input is used.



history


syntax: history {c} {k}

The history command will display the last set of commands issued from your terminal. To reissue one of these commands, issue the history character followed by the history number, relative history number, keyword pattern, or the keyword for the command. By default, the history character will be the exclamation mark (!). In order to use the history facilities of C shell, you must specify a value for the history environment variable. The value specified sets the number of commands history records. As a shortcut, you can issue the history character twice to repeat the last command issued to AIX.

History substitutions can also be used to edit old commands and build new commands as well as repeat them. To build a new command, simply enter the history command to repeat in the proper operand of the new command. To edit an old command, you will need to use one of the special word identifiers in the command. Most word identifiers must be preceded with a colon. The few exceptions are the '\^', '$', '*', '-', and '%'. Below is a table showing the various word identifiers and their definitions.



opt description                         opt description
-------------------------------------------------------------------------------
0 first word (the command name) \^ first parameter
n nth parameter $ last parameter
% word matched by a preceding search x-y xth parameter to yth parameter
-y command name to yth parameter * all parameters
x* xth through last parameters x- xth through next to last parameters

Examples:

!4

will reissue command number 4 in the history list

!?77?

will repeat the command whose second and third characters are sevens

!! > prog1.out

will repeat the last command and redirect its output to prog1.out

more !3:1

will issue the more command with history command number three's first parameter

For more information please see the appropriate shell reference:




info


syntax: info [-h topic] [-l library | -n {bl cl ed ti}][-s string]

InfoExplorer version 1.2.0 places a user interface on accessing the on-line help. This program provides an easy to use interface to the man pages. The -h option can be used to specify a topic for which you are requesting help. The -l option specifies which database library to use. The -n option can be used to specify what categories to search. Valid categories are: Book Contents List (bl), Commands List (cl), Education Menu (ed), and Task Index (ti). If you wish to search for all topics that discuss a particular string, use the -s option.

The InfoExplorer uses windows and menus to navigate around the help system. To move the cursor, simply use the arrow keys. To access the main menu (at the top of the window), you can press [CTRL] [O] and then use the arrow keys to highlight the appropriate menu command. Selections can be done by pressing [ENTER] with the desired command or option highlighted. For more information , please see the InfoExplorer handout.



jobs {K} {C}


syntax: jobs [-l]   {c}

This command displays a list of all the processes running on the current account. The display will consist of four columns. The first shows the job id, the second shows a plus sign, dash, or space. The plus sign denotes the current job and the dash represents the next to current job. The third column displays the status of the job. The fourth column will denote the command being executed by the job. If the -l option is specified, the process id will be displayed before the process status column.



join


syntax: join [-t char] [-1 fieldNo] [-2 fieldNo] file1 file2

The join command is used to join matching lines of two files whose contents are sorted in ascending order. As an additional requirement, the two files must have the same join field. By default, join uses tabs and spaces to separate a line into fields and the first field is used as the join field. The fieldNo parameters are used to specify which field in the two files is to be used as the join field. The -t option lets you specify which char to use as the field separator.



kill


syntax: kill [-signal] processID

This command is used to terminate a process. For the processID, you can specify a percent sign followed by the job ID returned by the jobscommand, or the process ID returned by the ps command. Some processes may ignore the SIGTERM signal sent by the kill command. To terminate these processes, you must specify the -kill signal.

example:

kill -kill %3

would kill job number three, even if it ignores the SIGTERM signal.

kill -kill 48360

would kill the process with ID 48360.



ln


syntax: ln [-s] file1 file2 [directory]

This command can be used to link file1 to file2. This has the effect of creating an alias. You can also specify a directory to which the specified files are to be linked. The -s option can be used to create a symbolic link between the two files. If the files are on different file systems, the -s option must be specified.



logout


syntax: logout

This command should be issued to terminate your session and allow the next user to access the computer. The logout command will not execute if there are any stopped jobs. To logout, you must first kill or activate the jobs. The logoutcommand will not terminate any jobs running in the background. It is imperative that you remember to kill all background jobs before logging out.



lp


syntax: lp [-c] [-dQueue] [-m] [-nNumber] [-tTitle] [-w] filenames

The lp command can be used to send a list of files to a printer. All filenames to be printed should be separated by spaces. The -coption tells AIX to immediately copy the file instead of making a link to the file. If this option is not specified, any changes to the file specified on the command line will be written to the printout if made before the printer finishes printing the file. By default, your printout will go to the Panasonic printer located in the same lab as you. You can change to another queue by using the -d option and specifying the proper Queue to which your file is to be sent. The -m option can be used if you wish mail to be sent to your account upon completion of the printing. The -w option will send a message to your first terminal upon completion of the printing. Specifying -t and then the Title will tell AIX to print the Title on the banner page. You can specify the number of copies to print by issuing a -n followed by the number of copies. By default, lp will only print one copy of the specified files.



lpq


syntax: lpq [-l] [+ delay] [-P printer] [jobNumber] [userID]

This command can be used to display the contents of a specific print queue. If no parameters are specified, lpq will display all the files on the default queue. The -loption can be used to display more information about the files on the queue. The + option lets you watch a queue by continually showing you the queued files every delay seconds. To view another queue, specify its name after the -P option. You can also view a specific file by typing its jobNumber o the command line, or you can view all your queued files by specifying your userID.



lpr


syntax: lpr [-# copies] [-c class] [-h] [-i spaces] [-m] [-P printer] [-r] [-s] [-T title] [-w width] [-p] files

The lpr command is a controllable printing command. By default, lpr will print a banner page before printing the specified set of files. It is recommended that this command be used for printing because this banner page prevents sequential files from being printed on the same page when a formfeed is not sent at the end of a file.

This command has many options, enabling you to control how the file is printed and what actions are done when the file is done printing. You can specify the number of copies to be printed after the -# option. The -c option specifies the class to use as the job classification. Using the -h option lets you suppress the printing of the burst page. You can change the indentation from the left margin by specifying the number of spaces to indent after the -i option. AIX will send you mail upon completion of the printing process if you specify the -m option. Specifying a printer after the -P option will cause AIX to send to the specified printer instead of the default printer. If this option is not specified, lpr will send to the printer specified by the LPDEST environment variable, the printer specified by the PRINTER variable, or .the default printer in that order. You can specify the -r option to have AIX remove the file upon completion of the printing process. By default, lprcopies the file to the printing area. If a file is large, and your account has a quota, you may not be able to print the file. Using the -s option alleviates this problem by making a symbolic link to the file instead of physically copying the file. The -t option can be used to specify a title for use by the pr command. If your printout is wider than the 80 character default, you can specify the width by using the -woption. If you wish to format your output with the pr command, you can specify the -p option. This works almost identically to the command pr | lpr.



lprm


syntax: lprm [-P printer] [jobNumber] [userID] [-]

This command lets you remove files from a print queue. Specifying the -Poption lets you select the queue from which the files will be deleted. You can delete files by one of three methods. The first method is to place a dash as a parameter. This will remove all the jobs from the print queue. Specifying a jobNumber will remove only that specific job from the queue. The third approach is to specify a userID which will remove all jobs owned by that user. As with the lpr command, lprm selects a print queue by the following order: -P option, LPDEST environment variable, PRINTER, environment variable, or the default printer.



ls


syntax: ls [-A][-a][-d][-i][-L][-N][-R][-r][-s][-F|-p][-b|-q]
[-C|-m][[{-c|-u}[-l][-t]] | [[-g|-n][[{-c|-u}[-l][-t]] |
[-g|-n|-l|-o|-e] [-t]]] [files] [directories]

This is one of the most useful AIX commands. It is used to display the contents of a directory. As you can see from the syntax, there are many combinations of options with the ls command. Most people will find a combination they like and use it in an alias to the ls command. On the next page is a table of the various options and a brief description.



opt description                             opt description
-------------------------------------------------------------------------------
-A all entries except . and .. -a all entries
-c uses inode modification time -C sorts vertically in multi-column format
-d only the specified directory name -e mode,links,owner,group,size,time, and name
-f turns off the -l,-t,-s,and -r flags -F places /,*,=,|, and @ based on the types of files
-g same as -l except no owner is displayed -i displays the inode number in the 1st column
-L contents of a symbolic link -l lists mode, links, owner, group, size, and time
-m separates entries with a comma -n same as -l except uses IDs instead of names
-N does not follow symbolic links -o same as -l except no group is displayed
-p puts a / after each subdirectory name -q displays nonprintable chars as a ?
-r reverses the order of the sort -R list all subdirectories recursively
-s gives size in kilobytes -t sorts by last modification time
-u uses time of last access for sorting -x sorts output horizontally
-1 forces one entry per line



mail


syntax: mail [-f] [address]

This command can be used to read your electronic mail (E-mail) or to send E-mail to another user. If you do not specify any options, AIX will open your mailbox and display your awaiting mail messages. If the -f option is specified, AIX will display a listing of the messages in your mailbox. To send mail, type the recipient's full E-mail address as the parameter to the mailcommand. For more detailed information, please see the Mail handout.



man


syntax: man {[-k | -f] [section] | [title]}

This command displays the manual pages for the specified command. If you specify the -k option, AIX will display a one-line synopsis of each manual entry which contains the specified title. The -f option will display a one-line synopsis for the command specified by title. If you just specify a title, AIX will use the more command to display the contents of the man pages for that entry. Below is a table showing the various section numbers, and the topics they represent.



opt description                        opt description
-------------------------------------------------------------------------------
1 Commands, daemons 6 commands, daemons
2 system calls, subroutines, kernel services, library routines, functions
3 system calls, subroutines, kernel services, library routines, functions
4 files 7 files
5 files 8 commands, daemons



mesg


syntax: mesg [y | n]

This command specifies whether or not another user can write to your terminal. If you do not specify any parameters, mesg will report your terminal's current message receiving status. The y option can be specified to allow users to send messages, and the n option will allow only the root user to send messages.



mkdir


syntax: mkdir [-m mode] [-p] directories

The mkdir command is used to create a new subdirectory. Each subdirectory specified by the directories parameter should be separated with the space character. You can change the access mode of the directories created by specifying -m and then the access privileges to be given to that subdirectory. The -p option can be specified to create any intermediate subdirectories necessary. In order to create a subdirectory, you must have write permission in the parent directory. If the -m option is not specified, AIX will assign the access modes set by the umask command.

examples:

mkdir -m 755 $HOME/docs/AIX

will create the subdirectories docs and docs/AIX with r and x privileges if they did not already exist



more


syntax: more [filename]

The more command is used to display text files or output from other applications when used with a pipe from the AIX command line. This command displays text one screen at a time, pausing after each screen. When pausing, the word "more" will be displayed at the bottom of the screen. If a filename was specified, more will also display the percentage of the file that has been displayed. While more is pausing, certain commands can be entered to control the program. Pressing the [ENTER] will cause more to display the next line of the text, and pressing the spacebar will cause the next screen of text to be displayed. You can x more lines by issuing the command x|[space]where x is the number of lines to display and [space] is the spacebar. The x|b command will skip back xscreens of text. Pressing [D] will display 11 more lines of text. Searching for the xth occurrence of a string can be done by issuing the x|/string command. You can quit by pressing [Left Arrow] , display the current line number by pressing the equals key, display help by pressing [H] , and invoke the vi editor on the current line by pressing [V] . Shell command can be invoked by placing the command after an exclamation mark. Pressing [.] will cause AIX to repeat the last command issued. The :fcommand will display the current file and line number. You can skip to the xth file on the command line by issuing the x:n command and x:p will move to the xth previous file on the command line.



mv


syntax: mv [-i] {file | directory} {newname | directory}

This command can be used to rename or move a file. Specifying the -ioption will cause AIX to prompt you before overwriting any existing file. By default, AIX will overwrite any existing files in the specified path. To rename a file or directory, specify its name followed by the newname to be used. To move a file, specify its name and then the directoryto which the file is to be moved.



nice


syntax: nice [-n priority] command

The nice command allows you to change the priority of your process. Unless you are root, you will be unable to raise your priority level, however, you can lower it. If you do not specify a specific priority with the -n command, AIX will use a default value. The command will be executed just as if typed by itself on the command line.



passwd


syntax: passwd [-f] [-s] 

This command lets you change your password, user information, or default shell. If no parameters are specified, AIX will let you change your password. AIX will ask for your old password and then your new password twice. If your passwords were entered correctly all three times, it will be changed. Thus, the next time you login, you will need to use the new password. The -foption invokes the chfn command, allowing you to change your user information. The -s option invokes the chsh command which lets you change your default shell.



pg


syntax: pg [-f] [+linenumber] [+/pattern/] [files]

The pg command formats the specified files on the display. When the screen is full, pg will pause the display allowing you to enter commands. Pressing [ENTER] will display the next page of data. You can advance or go back x pages by specifying the number of pages after a plus or minus sign respectively. Pressing [L] will display the next line of text. Pressing d and -d will scroll the screen forward or backward half a page respectively. The dollar sign can be used to go to the end of the text, provided the pg command is not used in a pipeline. Pressing [Left Arrow] will quit and return you back to the AIX prompt. If your input is from a pipeline, you can quit with dump by pressing the [CTRL] \ key combination. The -f option tells AIX not to split long lines. You can start the display at the specified linenumber when you precede the option with a plus sign. You can also start the display at the first line containing the text pattern specified between slashes.



ping


syntax: ping [-c count] [-i wait] [-R] address

This command sends an echo request to the specified address. If the specified host is running, it will send back a reply. By default, this exchange will continue until stopped by pressing [CTRL] [C] . Specifying the -c option lets you set the number of packets to send at count. The -i option lets you specify the wait time between echo requests. You can also have ping display the path taken to reach the host with the -R option. Upon completion of the echo requests, a summary will be printed showing the minimum, average, and maximum times.



pr


syntax: pr [-h "string"] [-o indent] files

This command formats the input into pages, each with its own header. You can set the string displayed in the header with the -h option. You can also set the number of spaces to indent the text with the -o option.



ps


syntax: ps [-e] [-f] [-l] [-U "username1, username2, ..."]

The ps command can be used to display the current statuses of processes running on the terminal. If no options are specified, AIX will show all processes belonging to the user's current shell. The -e option will display all process except kernels. The -f option can be used to generate a full listing or the -l option to generate a long listing. The -U option should be followed by a list of comma separated userID's in quotation marks. This will display all processes owned by the specified usernames. You must remember to place a space after the comma when separating the usernames. The -U option is AIX specific.



pwd


syntax: pwd

This command will display your present working directory. All directories in the path are separated by a forward slash.



qprt


syntax: qprt [-b margin] [-c] [-e option] [-E option] [-g page] [-i indent]
[-K option] [-l pageLength] [-L option] [-n] [-N copies]
[-p pitch] [-P queue] [-q quality] [-r] [-t margin]
[-v lines] [-w width] [-W option] [-Z option] files

This command can be used to start a print job. The bottom and top margins can be set by specifying the margin to be used with the -b and -t options respectively. The -c option tells AIX to make a copy of the file for printing, so that changes can be made to the file before it finishes printing. You can specify the page number on which printing is to begin with the -g option. The -i option indents the text the specified number of spaces. You can set the pageLength value of the -l option to specify the number of lines per page. The -noption will tell AIX to notify you when the print job has completed printing the number of copies specified with the -N option. You can set the pitch (characters per inch) with the -p option. As with the lpr command, you can override the default print queue settings by using the -P option to specify the receiving queue. The quality specified by the -q option can be used to set the print quality to a value of 0 to 3 representing fast printing to enhanced quality respectively. The -r option will remove the files being printed after they have completed printing. The -v option lets you specify the number of line per inch. The width can also be set by using the -woption.

Many commands are toggles that accept as an option the plus sign or the exclamation mark. The + means you want the option enabled, and the ! means the option is to be disabled. Below is a table showing the various option and their definitions.



opt  description                       opt   description
-------------------------------------------------------------------------------
e emphasized print E double high print
K condensed print L truncate lines
W double-wide print Z send a formfeed after printing



quota


syntax: quota [-g]

This command is used to display your disk usage and quota information. If you specify the -g option, it will specify disk information about the groups for which the current account is a member.



renice


syntax: renice priority

This command is similar to the nice command in that it alters the priority of a running process. By default, renice effects only those processes of the current user. The priority parameter specifies the level to which the processes are to be set. Legal values are 0 to 20 with 20 being the lowest priority.



rlogin


syntax: rlogin [-l userID] host

This command lets you login to a remote host. By default, AIX will assume the same userID as the current user. If you wish to specify a different userID, place it after the -l option.



rm


syntax: rm [-e] [-f] [-i] [-r] filenames...

The rm command allows you to delete the specified files and directories. The -e option will display a message after each file is deleted. The -f option will not prompt the user before deleting write- protected files, but the -i option will. Using -r will cause AIX to recursively delete subdirectories and their contents when a directory is specified as a filename.



rmdir


syntax: rmdir [-p] subdirectory

This command lets you remove an empty subdirectory from the system. If you specify the -p option, rmdir will remove all directories specified in the path if they contain no files and you have write permission to the directory.



set


syntax: set variable[=value]

This command can be used to set shell variables. The shell variablewill be assigned the optional value specified. If no value is specified, the variable will be created in the shell.



setenv {K} {C}


syntax: setenv variable [value]

This command is used to set environment variables. The variablewill be set with the value specified. Values which include spaces should be included within quotation marks.



sort


syntax: sort [-t character] [-A] [-b] [-c] [-d] [-f] [-i] [-m] [-n] [-o file] [-r]

This command can be used to sort the contents of a file, merge sorted files, and check if a file has already been sorted. Sort uses, by default, blank characters as field separators. This field character can be changed by specifying the character after the -t option. The -Aoption sorts the file in a byte-by-byte order using the ASCII collating sequence. The -b option will ignore all leading spaces and tabs to find the first column in a field. The -c option will return a nonzero value if the file is not already sorted. You can force AIX to sort the file based only on letters, digits, and spaces if you specify the -d option. The -f option will convert lowercase letters to uppercase before making the comparisons. Specifying -i will cause AIX to ignore all nonprintable characters during comparisons. You can merge two sorted files with the - mcommand. If you will be sorting numerical data, use the -n option to specify a sort by numerical value. The output file is specified with the -o option. The sort can be done in reverse order if you specify the -r option.



spell


syntax: spell [-v] [+ filename] [file]

This command can be used to check the spelling in a file. By default, the spell command will write all words to standard output it can not match to the spell file or derive from words in the spell file. You should use the spellin command to create your own dictionary that contains words used in your documents. The - v option will cause the command to display all possible derivations for words not found in the word file. The + command should be followed by the filename of any additional word lists to be used.



stop {K} {C}


syntax: stop [jobNumber]

This command will stop the execution of a background process. To restart the process in the background, use the bg command. If no job is specified, the last current process will be stopped (marked by a + by the jobs command).



stty


syntax: stty [-a]

This command can be used to set, reset, or report current standard input parameters. If you do not specify any options, stty will display some basic parameter settings. The -a option will display all parameter settings.



tail


syntax: tail [-n number] [-c number] [filename]

This command will display the last 10 lines of a file. Specifying the -nor the -c option will display the file starting at line numberor byte number of the file respectively.



talk


syntax: talk userID

This command brings up a windowed interface that allows you to "talk" electronically with the specified userID. Pressing [CTRL] [C] will exit the talk program.



tar


syntax: tar {[-c | -r | -t | -u | -x]} [-f file1] [files | directory]

This command is used to create and manipulate archive files. Tar files will have a .Z extension. The -f option will access the archive file, file1 This option must be specified when working with files, otherwise the default backup device /dev/rmt0. The -c option will create a new archive file that includes those files specified by files. The -r option will append files to the archive file. The -t option will display the names of the files in the archive, and the -v option will display each filename as it is processed. The -u option will add those files that are new or modified since last storage into the archive file. Using -x will extract the files from the archive.



tee


syntax: tee [-a] [-i] [file]

This command writes standard input to standard output and the specified file. The -a option causes tee to append the text to fileinstead of overwriting it. The -i option will ignore interrupts.

example:

cat prog1.output | tee ~prof/submit/ross.prog1.output

will display the contents of prog1.output and copy it to the file ~/prof/submit/ross.prog1.output.



time


syntax: time command

This command can be used to measure the amount of time needed to run command.



tn


syntax: tn [host] [port]

The tn command can be used to login to a remote host using port. Pressing [CTRL] [T] will place you in command mode so that you can execute local commands. For more information, please see the tn3270 handout.



touch


syntax: touch [-a] [-c] [-f] [-m] [-r file][-t YYMMDDhhmm]
{files | directories}

This command can be used to update the last access and modification times of the specified files or directories. The -a option will change the access times and the -m option will alter the modification time. Specifying -c will prevent touch from creating the file if it doesn't exist. The -f option will attempt to change the times regardless of the write permissions of the files. You can set the time to that of another fileby specifying the -r option or you can set the time manually by specifying it with the -t option. The time should be entered in the order year, month, date, hours, and minutes.



tty


syntax: tty [-s]

This command writes the name of your terminal to standard output. Specifying the -s option will prevent the displaying of the full path.



umask


syntax: umask [mode]

The umask command is used to display or change the default access modes for new files and directories. If no parameters are specified, umaskwill display the current setting. If the mode is specified, all new files will have the specified access bits cleared. For example, if you have the command umask 077 in your login script, all new files and directories will be created with the access mode 700 (read, write, and execute for the owner only).



uname


syntax: uname [-a]

This command will display the name and version number of the current operating system. Specifying the - a option will specify all information about the operating system. The default is to just display the operating system name.



uniq


syntax: uniq [-c | -d | -u] [infile] [outfile]

This command can be used to remove duplicated, sequential lines from infileand places the uniq file in outfile. The -c option will display a count showing the number of times each line appears in the file. The -d and -u options display only those lines that are repeated and unique respectively. If no files are specified, standard in and standard out are used.



vi


syntax: vi [files

This command brings up the vi full screen editor, which is based on the ex editor.. Any files specified on the command line will be edited in the order in which they appear. vi makes a copy of the file to a edit buffer, so any changes made do not effect the actual file until you save. For more information , please see the handout on the vieditor.



w


syntax: w [-h] [-s]

This command displays a summary of the current activity on the computer. The -h option can be used to prevent the display of the header. The -s option will display a short list of information, as opposed to the default information.



wc


syntax: wc [-k] [-l] [-w] [files]

This command displays the number of lines, words, and bytes in the specified files. The -k, -l, and -w options specify whether to count characters, lines, or words respectively.



whatis


syntax: whatis command

This command gives a brief description about command. This command serves the same function as man -f command. It will display the header of the man page for the specified command.



whereis


syntax: whereis file

This command searches your path for the specified file.



who


syntax: who [-m] [-w] [am i]

This command displays a list of the users currently logged into the system. The -m option can be specified to display information about the current user. This is the same as typing the am i option. The -H option will place a header on the output. The -w option will display a plus for those users whose terminal allows writes by other users, and a dash for those who do not allow writes.



whoami


syntax: whoami

This command will display the userID of the current user.

write


syntax: write userID

This command enables you to send a message to another user. After issuing the command, all text entered will be sent to the specified userID. To stop the write command, send an end of text character ( [CTRL] [D] ).



HELPFUL HINTS


AIX has many commands, and more options than can be covered here. For more information, please see the AIX Command Reference Manuals, the manpages, or see the other AIX subject handouts.

No comments:

Post a Comment