A Tutorial for AIX on Unix

by Leena Kudalkar
AIX runs on IBM's RISC processor workstations.

AIX runs on IBM's RISC processor workstations.

AIX is IBM's flavor of the Unix Operating System. It runs on IBM's RISC processors and integrates AT&T's System V UNIX with enhancements from BSD (Berkley Standard Distribution) Unix.

Beginning Basics

1

Log on as a user and change your password.

On the operating system (OS) prompt, which is "%" for C shell, type the following command:

%kpasswd

This will prompt you for the old password (given by your system administrator), new password and reconfirmation of your new password.

Now your AIX session has begun, and you are in the shell. You can type commands on the shell prompt: "%."

Note: "kpasswd" is for AIX's Kerberos Security System and corresponds to the standard UNIX command "passwd."

2

Execute the following command at the shell (OS) prompt:

% ls -al

It should show the current directory listing on the screen. Commands are either system programs or built-in shell functions. AIX is case-sensitive. Basic shell command syntax looks like this:

% command [ argument1 argument2 argument3 .... ]

Arguments (parameters) are inputs directing the behavior of the command in the form of options, keywords, file names, sizes, etc. Options are indicated with a "-" (dash) sign preceding the option letter. Multiple options can be combined on a single "-" sign.

Run the ls command again, with the two options given separately this time:

%ls -a -l

The output should be exactly the same as when the two options were combined.

'-l' tells ls to output a detailed list for files and directories and '-a' indicates that all files, including the hidden files, should be displayed.

3

Run the "man" command with a command name as an argument to learn about that command.

"% man grep" will provide a manual page for the "grep" utility explaining each optional argument.

4

Use the "more" utility program to prevent output from scrolling off the screen:

% ls -al | more

Here, the output of 'ls' is sent to a "pipe" through the "|" sign, through which it is redirected as input to the "more" utility. "More" breaks it into pages and displays one page at a time.

Press any key to see the next page of output.

Try this:

% man ls | more

5

Run "cat" to display the contents of a file:

% cat <filename> [ | more ]

Execute "tail" to display the last few lines of a file. Type:

% tail <filename> -<n - number of lines>

where n indicates last n lines. If -n is omitted, it will display the last 10 lines.

6

Observe the output of "ls -al | more." You will find some files beginning with a "." All files whose names begin with a dot are hidden. Simply running "ls" will not show them. These are the .login, .profile and .cshrc (for C shell) files. The .login file holds operating system-specific information for the user. Among other things, it specifies terminal characteristics, your search path, mappings of actions to keystrokes and other environment variable settings. An example:

set path = (/usr/ucb /bin /usr/bin /etc /usr/local . )

This will set your environment variable "path" to the above each time you log in.

7

Run the following:

% cat .login | more

% cat .cshrc | more

The .cshrc is executed every time you enter the C shell. Your chosen default shell is also specified at login.

Working with Files and Directory

1

Execute the following file operations:

% cp [<path1>/]file1 [<path2>/]file2 # to copy a file as another

% mv [<path1>/]file1 [<path2>/]file2 # to rename a file

% mv file1, file2, file3 ... <destination directory> # to move one or more files as another

% rm <filename> # to delete a file permanently

% pg <filename> # to display contents of a file page by page. Press any key to read the

                                                                         #  next page.

The "pg" (page) program gives the effect of "cat <filename> | more." Words following a "#" on a line are treated as comments and not executed. Run the man command on each of the commands above to learn about the various combinations of optional arguments.

2

Run "pwd" to print a working directory.

The output can look like this:

/u/devreportgroup/tara

At login, you are in the home directory, which is defined by setting the environment variable "HOME." It holds all your hidden startup files that set up your environment.

3

Create a new subdirectory:

% mkdir ./workfiles

% mkdir ./mysource

% mkdir workfiles/lib

A "." in the path indicates the current directory. A relative path looks like this:

../../bin

It says go up one level for each "../" in the code. Here, go up two directory levels and to the bin subdirectory at that level.

4

Change your directory:

% cd ./workspace/lib

5

Remove subdirectory mysource using "rmdir." Type:

% rmdir ./mysource or % rmdir mysource or % rmdir %HOME%/mysource

6

Change the mode (access permission) of a file or directory. Type:

% chmod < user/group/all/others - for whom > < +/- grant / remove > <r w x - access type> <file or directory name>

The u = user, g = group, a = all, o = others.

An example:

% chmod g+rw myfile (grant read/write access for myfile to the entire group to which this user belongs).

% chmod o-x legacypgm (remove execute access to legacyprogram from others who are not in this user's group).

Tips

  • check Find out about these important directories: /, /u, /bin , /usr/bin, /usr/local, /etc, /tmp, /dev.
  • check Learn about these utilities via the "man" program: grep, sort, uniq, diff, mail.
  • check Learn how to redirect output of a process to a file: % man sort > ./mydocs/sortmanpage
  • check Each command is a process. A pipe, or "|," takes input of one AIX process and feeds it as input to the next.

About the Author

Leena Kudalkar started her professional writing career with Manya Education. She has also covered science and technology for several online publications. Kudalkar holds a master's degree in computer science and a diploma in German from the University of Pune, India.

Photo Credits

  • photo_camera monitor broken image by Nicemonkey from Fotolia.com