Web | This Site

Unix for Beginners
Unix Shell Programming
Advanced Unix
Unix Useful References
Unix Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Unix - Getting Started

# What is Unix ?

The UNIX operating system is a set of programs that act as a link between the computer and the user.

The computer programs that allocate the system resources and coordinate all the details of the computer's internals is called the operating system or kernel.

Users communicate with the kernel through a program known as the shell. The shell is a command line interpreter; it translates commands entered by the user and converts them into a language that is understood by the kernel.

- Unix was originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.

- There are various Unix variants available in the market. Solaris Unix, AIX, UP Unix and BSD are few examples. Linux is also a flavour of Unix which is freely available.

- Several people can use a UNIX computer at the same time; hence UNIX is called a multiuser system.

- A user can also run multiple programs at the same time; hence UNIX is called multitasking.

# Unix Architecture:

Here is a basic block diagram of a UNIX system:

The main concept that unites all versions of UNIX is the following four basics:

- Kernel: The kernel is the heart of the operating system. It interacts with hardware and most of the tasks like memory management, tash scheduling and file management.

- Shell: The shell is the utility that processes your requests. When you type in a command at your terminal, the shell interprets the command and calls the program that you want. The shell uses standard syntax for all commands. C Shell, Bourne Shell and Korn Shell are most famous shells which are available with most of the Unix variants.

- Commands and Utilities: There are various command and utilities which you would use in your day to day activities. cp, mv, cat and grep etc. are few examples of commands and utilities. There are over 250 standard commands plus numerous others provided through 3rd party software. All the commands come along with various optional options.

- Files and Directories: All data in UNIX is organized into files. All files are organized into directories. These directories are organized into a tree-like structure called the filesystem.

# System Bootup:

If you have a computer which has UNIX operating system installed on it, then you simply need to turn on its power to make it live.

As soon as you turn on the power, system starts booting up and finally it prompts you to log into the system, which is an activity to log into the system and use it for your day to day activities.

# Login Unix:

When you first connect to a UNIX system, you usually see a prompt such as the following:

    login:

## To log in:

1. Have your userid (user identification) and password ready. Contact your system administrator if you don't have these yet.

2. Type your userid at the login prompt, then press ENTER. Your userid is case-sensitive, so be sure you type it exactly as your system administrator instructed.

3. Type your password at the password prompt, then press ENTER. Your password is also case-sensitive.

4. If you provided correct userid and password then you would be allowed to enter into the system. Read the information and messages that come up on the screen something as below.

    login : amrood
    amrood's password:
    Last login: Sun Jun 14 09:32:32 2009 from 62.61.164.73
    [amrood]$

You would be provided with a command prompt ( sometime called $ prompt ) where you would type your all the commands. For example to check calendar you need to type cal command as follows:

    [amrood]$ cal
         June 2009
    Su Mo Tu We Th Fr Sa
        1  2  3  4  5  6
     7  8  9 10 11 12 13
    14 15 16 17 18 19 20
    21 22 23 24 25 26 27
    28 29 30

    [amrood]$

# Change Password:

All Unix systems require passwords to help ensure that your files and data remain your own and that the system itself is secure from hackers and crackers. Here are the steps to change your password:

1. To start, type passwd at command prompt as shown below.

2. Enter your old password the one you're currently using.

3. Type in your new password. Always keep your password complex enough so that no body can guess it. But make sure, you remember it.

4. You would need to verify the password by typing it again.

    [amrood]$ passwd
    Changing password for amrood
    (current) Unix password:******
    New UNIX password:*******
    Retype new UNIX password:*******
    passwd: all authentication tokens updated  successfully

    [amrood]$

Note: I have put stars (*) just to show you the location where you would need to enter the current and new passwords otherwise at your system, it would not show you any character when you would type.

# Listing Directories and Files:

All data in UNIX is organized into files. All files are organized into directories. These directories are organized into a tree-like structure called the filesystem.

You can use ls command to list out all the files or directories available in a directory. Following is the example of using ls command with -l option.

    [amrood]$ ls -l
    total 19621
    drwxrwxr-x  2 amrood amrood      4096 Dec 25 09:59 uml
    -rw-rw-r--  1 amrood amrood      5341 Dec 25 08:38 uml.jpg
    drwxr-xr-x  2 amrood amrood      4096 Feb 15  2006 univ
    drwxr-xr-x  2 root   root        4096 Dec  9  2007 urlspedia
    -rw-r--r--  1 root   root      276480 Dec  9  2007 urlspedia.tar
    drwxr-xr-x  8 root   root        4096 Nov 25  2007 usr
    -rwxr-xr-x  1 root   root        3192 Nov 25  2007 webthumb.php
    -rw-rw-r--  1 amrood amrood     20480 Nov 25  2007 webthumb.tar
    -rw-rw-r--  1 amrood amrood      5654 Aug  9  2007 yourfile.mid
    -rw-rw-r--  1 amrood amrood    166255 Aug  9  2007 yourfile.swf

    [amrood]$

Here enteries starting with d..... represent directories. For example uml, univ and urlspedia are directories and rest of the enteries are files.

# Who Are You?

While you're logged in to the system, you might be willing to know : Who am I?

The easiest way to find out "who you are" is to enter the whoami command:

    [amrood]$ whoami
     amrood

    [amrood]$

Try it on your system. This command lists the account name associated with the current login. You can try who am i command as well to get information about yourself.

# Who is Logged In?

Sometime you might be interested to know who is logged in to the computer at the same time.

There are three commands are available to get you this information, based on how much you'd like to learn about the other users: users, who, and w.

    [amrood]$ users
     amrood bablu qadir

    [amrood]$ who
    amrood ttyp0 Oct 8 14:10 (limbo)
    bablu  ttyp2 Oct 4 09:08 (calliope)
    qadir  ttyp4 Oct 8 12:09 (dent)

    [amrood]$

Try w command on your system to check the output. This would list down few more information associated with the users logged in the system.

# Logging Out:

When you finish your session, you need to log out of the system to ensure that nobody else accesses your files while masquerading as you.

## To log out:

1. Just type logout command at command prompt, and the system will clean up everything and break the connection

# System Shutdown:

The most consistent way to shut down a Unix system properly via the command line is to use one of the following commands:

Command | Description
--- | ---
halt | Brings the system down immediately.
init 0 | Powers off the system using predefined scripts to synchronize and clean up the system prior to shutdown
init 6 | Reboots the system by shutting it down completely and then bringing it completely back up
poweroff | Shuts down the system by powering off.
reboot | Reboots the system.
shutdown | Shuts down the system.

You typically need to be the superuser or root (the most privileged account on a Unix system) to shut down the system, but on some standalone or personally owned Unix boxes, an administrative user and sometimes regular users can do so.

Advertisement

Online Image Processing

Indian Baby Names