[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Quick Beginnings

Basic Command Line Tasks

A procedure is presented for each of the following tasks:

Displaying Your User ID

The whoami command displays your user ID (login name). For example, at the system prompt, type:

whoami

The system displays your user ID on the next line, and the system prompt returns:

denise
$

Changing or Creating Your Password

In addition to your user ID, it is also recommended that you have a password. A password verifies your identity to the system and protects your data from unauthorized access. You can set or change a password using the passwd command. Your password does not appear on the screen when you type it.

  1. At the system prompt, type:
    passwd
    If you do not have a password, skip step 2.

  2. The following prompt displays:
    Changing password for userID
    userID's Old password:
    This request keeps an unauthorized user from changing your password while you are away from your system. Type your current password.

  3. The following prompt displays:
    userID's New password:
    Type your new password.

  4. The following prompt displays:
    Enter the new password again:
    This request protects you from setting your password to a mistyped string that you cannot recreate. Type your new password again.

Examples

  1. To change the password of the user denise, type:
    passwd
    The system displays information similar to the following:
    Changing password for "denise"
    denise's Old password:
    denise's New password:
    Enter the new password again:
    $

  2. The following example shows what occurs when you incorrectly type the current password:
    $ passwd
    Changing password for "denise"
    denise's Old password:
    Your entry does not match the old password.
    You are not authorized to change "denise's" password.
    $

  3. The following example shows what occurs when you incorrectly retype the new password:
    $ passwd
    Changing password for "denise"
    denise's Old password:
    denise's New password:
    Enter the new password again:
    The password entry does not match, please try again.
    denise's New password:
    Enter the new password again:
    $

Listing Files

You can display the contents of directories to which you have access with the li or ls commands. The li command displays your files and directories in alphabetical order in four columns. The ls command also displays your files and directories in alphabetical order but adjusts the number of columns according to the width of your terminal or window.

A file system consists of groups of directories and the files within the directories. The following illustration is an example of a file system.

A file system is commonly represented as an inverted tree. The root directory, symbolized by a / (slash) symbol, defines a file system and appears at the top of a file-system-tree diagram. Directories branch downward from the root directory in the tree diagram and contain files and subdirectories. Branching creates unique paths through the directory structure to every object in the file system.

Files are typically grouped in a special type of file called a directory. Grouping information improves organization, access time, and flexibility. Directories contain files, subdirectories, or a combination of both.

A file is a collection of data in a format that can be read from or written to. Files contain either ASCII information that users can read or binary information that the system interprets. Executable programs, simple text, software applications, printer definitions, and commands are all stored in files and treated in a uniform fashion by the operating system.

Each directory, except for root, has one parent directory and may have one or more child directories. In the illustration,"Example File System", directory B is parent to directory C and directory B is child to Root.

The path name for each file and directory in the file system consists of the names of every directory that precedes it in the tree structure.

Since all paths in a file system originate from the root directory, each file in the file system has a unique relationship to the root directory known as the absolute path name. Absolute path names begin with the / (slash) symbol. The absolute path name of file h within the example file system is /B/c/h. Notice that there are two files named g. Because the absolute paths to these files are different, /B/g and /B/c/g, each file named g has a unique name within the system. Every component of a path name is a directory except the final component. The final component of a path name can be a file name.

Another way of writing the path name of a file is the relative path name. The relative path name describes a file relative to your current directory. If your current directory is /B, to get to file h the relative path is C/h. Relative path names do not begin with the / (slash) symbol.

Displaying the Files in Your Current Directory

When you log in, the system puts you in a directory called your home directory. Your home directory is where you keep your personal files. The directory you are currently working in is called your current or working directory.

To display the files in your current directory, at the prompt, type:

ls

The system displays information similar to the following:

letter.041393
mail
swprint
testfile

If the directory listing is very long, the top portion scrolls off the screen. To prevent this from happening, use the ls command piped to the pg command. At the prompt, type:

ls | pg

This command prints the contents of the directory one screen at a time. Each screen is followed by a prompt (: ). If you press the Enter key, another page is displayed.

To display the contents of the current directory and distinguishing program files and directories, use the ls command with the -F flag. The -F flag puts a / (slash) after the name if it is a directory and a * (star) after the name if its a program. At the prompt, type:

ls -F

The system displays information similar to the following:

letter.041393
mail/
swprint*
testfile

In the previous example, mail is a directory, swprint is a program, letter.041393 and testfile are other data or text files.

Displaying Hidden Files

Hidden files are files with names that begin with a . (dot). These files are normally used for initialization or control files and they are not listed when using the ls command. To list all the files in a directory, use the ls command with the -a flag.

At the prompt, type:

ls -a

The system displays information similar to the following:

.profile
.xinitrc
barchart.ps
letter.041393
swprint
testfile

In the previous example, the files .profile and .xinitrc are hidden files.

Displaying the Contents of a File

The pg command prints the contents of text files one screen at a time. Each screen is followed by a prompt (: ). If you press the Enter key, another page is displayed.

To display the contents of a short file named TimeLog , at the prompt, type:

pg TimeLog

The system displays information similar to the following:

Start-up --> Mon Jun  7 08:16:20 CDT 1993
Logout   --> Mon Jun  7 18:25:55 CDT 1993
 
Start-up --> Tue Jun  8 07:05:46 CDT 1993
Logout   --> Tue Jun  8 15:57:05 CDT 1993
 
Start-up --> Wed Jun  9 08:06:15 CDT 1993
Logout   --> Wed Jun  9 18:27:16 CDT 1993
$

Displaying Your Current Directory Path Name

The pwd (present current directory) command prints your current directory path name.

At the prompt, type:

pwd

The system displays information similar to the following:

/u/denise
$

In the previous example, /u/denise is the current directory.

Changing to Another Directory

The cd (change directory) command changes your location in the file system from one directory to another. If you have the proper permissions, you can access any directory in the file system. The format of the cd command is:

cd PathName

The following example uses the cd command to change to the directory /usr/bin followed by the pwd command to verify the current directory.

$cd /usr/bin
$pwd
/usr/bin
$

To go to your home directory from any directory, at the prompt, type:

cd

The following example uses the cd command alone:

$ pwd
/u/denise/work/93
$ cd
$ pwd
/u/denise
$

To go to the parent directory of your current directory, at the prompt, type:

cd ..

The following example uses the cd .. command.

$ pwd
/u/denise/work/93
$ cd ..
$ pwd
/u/denise/work
$

Running an Application in the Command Line Interface

Running an application in the command line interface is the same as entering a command.

To run an application, at the prompt, type the application name:

>ApplicationName

The application program then takes over until you exit the program.

Getting Help in the Command Line Interface

There are various tools available to help you when you need more information on commands and the operating system. These tools are:

Online Documentation

To access and view the online Base Documentation Library with a Version 3.2 HTML-compatible web browser, type the following path:

/usr/share/man/info/en_US/a_doc_lib/aixgen/topnav/topnav.htm

To access and view the online Extended Documentation Library, type the following path:

/usr/share/man/info/en_US/a_doc_lib/aixgen/wxinfnav/topnav.htm

help Command

The help command presents a one-page display of information for new users.

At the prompt, type:

help

The system displays information similar to the following:

Look in a printed manual for general help if you can.  You should 
have someone show you some things and then read "Using and Managing 
AIX" manual. 

The commands: 
    man -k keyword      lists commands relevant to a keyword 
    man command         prints out the manual pages for a command 
are helpful; other basic commands are: 
    cat                 - concatenates files (and just prints them out) 
    ex                  - text editor 
    ls                  - lists contents of directory 
    mail                - sends and receives mail 
    msgs                - system messages and junk mail 
    passwd              - changes login password 
    sccshelp            - views information on the Source Code Control System 
    smit                - system management interface tool 
    tset                - sets terminal modes 
    who                 - who is on the system 
    write               - writes to another user 
You could find programs about mail by the command:      man -k mail 
and print out the man command documentation via:        man mail 
You can log out by typing "exit". 

man Command

The man command displays information on various reference articles, such as commands, subroutines, and files.

To obtain information about a command, at the prompt, type:

man CommandName

The information that the man command provides can also be obtained in the AIX Version 4.3 Base Documentation CD.

Logging Off from the Command Line

At the prompt, do one of the following:

After you log off, the system displays the login: prompt.

Attention: Do not power off the system. Turning off the system ends all processes running on the system. If other users are working on the system or if jobs are running in the background, data may be lost. Perform proper shutdown procedures before you stop the system. For more information on shutting down or rebooting your system, see "System Startup, Logging In, Shutting Down and Rebooting

Related Information

For more information about commands and how to read command syntax diagrams, see the Commands Overview in AIX Version 4.3 System User's Guide: Operating System and Devices.

The AIX Version 4.3 Quick Reference provides a handy guide to the common tasks you perform on the system.


[ Previous | Next | Contents | Glossary | Home | Search ]