[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
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).

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 alphabetic order in four columns. The ls command also displays your files and directories in alphabetic order but adjusts the number of columns according to the width of your terminal or window.

File system
A file system consists of groups of directories and the files within the directories. The Example File System illustration shows 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.

File
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 can have one or more child directories. In the Example File System illustration directory B is parent to directory C and directory B is child to root.

Path name
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.

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.

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.

Displaying Your Current Directory Path Name

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

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
$

Running an Application in the Command Line Interface

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

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

help Command

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

man Command

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

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 turn the power off to your 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.

[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]