0% found this document useful (0 votes)
23 views

02-Unix Basics

The document discusses various basic Unix commands and operations for file management and system interaction. It covers logging in and out, changing passwords, listing directories and files, checking who is logged in, creating, editing, copying and renaming files. Basic commands discussed include ls, cat, wc, cp, mv among others.

Uploaded by

yoseffisseha12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

02-Unix Basics

The document discusses various basic Unix commands and operations for file management and system interaction. It covers logging in and out, changing passwords, listing directories and files, checking who is logged in, creating, editing, copying and renaming files. Basic commands discussed include ls, cat, wc, cp, mv among others.

Uploaded by

yoseffisseha12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

1.

1 Unix Get Started


 Lab Practice: Installation of Hypervisors
 Lab Practice: Installation of Unix Operating System

1.1.1 Login Unix:


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

To log in:
 Have your userid (user identification) and password ready. Contact your system administrator if you don't have
these yet.
 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.
 Type your password at the password prompt, then press ENTER. Your password is also case-sensitive.
 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.

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:

1.1.2 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.
1.1.3 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.

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

1.1.4 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:

1.1.5 Who is Logged In?


Sometimes 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.

1.1.6 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

1.1.7 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:
1.2 Unix File Management
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.
In UNIX there are three basic types of files:
1. Ordinary Files: An ordinary file is a file on the system that contains data, text, or program instructions. In this
course, you look at working with ordinary files.
2. Directories: Directories store both special and ordinary files. For users familiar with Windows or Mac OS,
UNIX directories are equivalent to folders.
3. Special Files: Some special files provide access to hardware such as hard drives, CD-ROM drives,
1.2.1 Listing Files:
To list the files and directories stored in the current directory. Use the command: ls

The command ls supports the -1 option which would help you to get more information about the listed files:

Here is the information about all the listed columns:


1. First Column: represents file type and permission given on the file. Below is the description of all type of files.
2. Second Column: represents the number of memory blocks taken by the file or directory.
3. Third Column: represents owner of the file. This is the Unix user who created this file.
4. Fourth Column: represents group of the owner. Every Unix user would have an associated group.
5. Fifth Column: represents file size in bytes.
6. Sixth Column: represents date and time when this file was created or modified last time.
7. Seventh Column: represents file or directory name.

In the ls -l listing example, every file line began with a d, -, or l. These characters indicate the type of file that's
listed.

Meta characters have special meaning in Unix. For example * and ? are metacharacters. We use * to match 0 or
more characters, a question mark ? matches with single character
$ls ch*.doc

Displays all the files whose name start with ch and ends with .doc:
ch01-1.doc ch010.doc ch02.doc ch03-2.doc ch04-1.doc ch040.doc ch05.doc
ch06-2.doc ch01-2.doc ch02-1.doc

Here * works as meta character which matches with any character. If you want to display all the files ending with
just .doc then you can use following command:
$ls *.doc

Hidden Files:
An invisible file is one whose first character is the dot or period character (.). UNIX programs (including the shell)
use most of these files to store configuration information. Some common examples of hidden files include the files:
• . profile: the Bourne shell ( sh) initialization script
• . kshrc: the Korn shell ( ksh) initialization script
• . cshrc: the C shell ( csh) initialization script
• . rhosts: the remote shell configuration file
To list invisible files, specify the -a option to ls:

Single dot . : This represents current directory.


Double dot .. : This represents parent directory.
1.2.2 Creating Files:
You can use vi editor to create ordinary files on any Unix system. You simply need to give following command:
$ vi filename

Above command would open a file with the given filename. You would need to press key i to come into edit mode.
Once you are in edit mode you can start writing your content in the file as below:
Once you are done, do the following steps:
Press key esc to come out of edit mode.
Press two keys Shift + ZZ together to come out of the file completely.
Now you would have a file created with filemame in the current directory.
1.2.3 Editing Files:
You can edit an existing file using vi editor. We would cover this in detail in a separate course. But in short, you can
open existing file as follows:
$ vi filename

Once file is opened, you can come in edit mode by pressing key i and then you can edit file as you like.
If you want to move here and there inside a file then first you need to come out of edit mode by pressing key esc and
then you can use following keys to move inside a file:
• l key to move to the right side.
• h key to move to the left side.
• k key to move up side in the file.
• j key to move down side in the file.
So using above keys you can position your cursor where ever you want to edit.
Once you are positioned then you can use i key to come in edit mode.
Edit the file, once you are done press esc and finally two keys Shift + ZZ together to come out of the file
completely.
1.2.4 Display Content of a File:
You can use cat command to see the content of a file. Following is the simple example to see the content of above
created file:
$ cat filename This is unix file.... I created it for the first time.....
I'm going to save this content in this file.
$

You can display line numbers by using -b option along with cat command as follows:
$ cat filename -b
1 This is unix file....I created it for the first time.....
2 I'm going to save this content in this file.
$

1.2.5 Counting Words in a File:


You can use the wc command to get a count of the total number of lines, words, and characters contained in a file.
Following is the simple example to see the information about above created file:\
$ wc filename
2 19 103 filename
$

Here is the detail of all the four columns:


1. First Column: represents total number of lines in the file.
2. Second Column: represents total number of words in the file.
3. Third Column: represents total number of bytes in the file. This is actual size of the file.
4. Fourth Column: represents file name.
You can give multiple files at a time to get the information about those file. Here is simple syntax:
$ wc filename1 filename2 filename3

1.2.6 Copying Files:


To make a copy of a file use the cp command. The basic syntax of the command is:
$ cp source_file destination_file

Following is the example to create a copy of existing file filename.\


$ cp filename copyfile$

Now you would find one more file copyfile in your current directory. This file would be exactly same as original
file filename.
1.2.7 Renaming Files:
To change the name of a file use the mv command. Its basic syntax is:
$ mv old_file new_file

Following is the example which would rename existing file filename to newfile:
$ mv filename newfile
$

The mv command would move existing file completely into new file. So in this case you would fine only newfile in
your current directory.
1.2.8 Deleting Files:
To delete an existing file use the rm command. Its basic syntax is:
$ rm filename

Caution: It may be dangerous to delete a file because it may contain useful information. So be careful while using
this command. It is recommended to use -i option along with rm command.
Following is the example which would completely remove existing file filename:
$ rm filename
$

You can remove multiple files at a tile as follows:


$ rm filename1 filename2 filename3
$

1.3 Unix Directories


A directory is a file whose sole job is to store file names and related information. All files whether ordinary, special, or
directory, are contained in directories. UNIX uses a hierarchical structure for organizing files and directories. This
structure is often referred to as a directory tree . The tree has a single root node, the slash character ( /), and all other
directories are contained below it.

1.3.1 Home Directory:


The directory in which you find yourself when you first login is called your home directory. You will be doing much of
your work in your home directory and subdirectories that you'll be creating to organize

your files. You can go in your home directory anytime using the following command:
$cd ~

Here ~ indicates home directory. If you want to go in any other user's home directory, then use the following
command:
$cd ~username

To go in your last directory you can use following command:


$cd –

To determine where you are within the filesystem hierarchy at any time, enter the command pwd to print the current
working directory:
$pwd /user0/home/amrood

1.3.2 Listing Directories:


To list the files in a directory you can use the following syntax:
$ls dirname
Following is the example to list all the files contained in /usr/local directory:
$ls /usr/local

X11 bin gimp jikes sbin

ace doc include lib share

atalk etc info man ami

1.3.3 Creating Directories:


Directories are created by the following command:
$mkdir dirname

Here, directory is the absolute or relative pathname of the directory you want to create. For example, the command:
$mkdir mydir

Creates the directory mydir in the current directory. Here is another example:
$mkdir /tmp/test-dir

This command creates the directory test-dir in the /tmp directory. The mkdir command produces no output if it
successfully creates the requested directory.

If you give more than one directory on the command line, mkdir creates each of the directories. For example:
$mkdir docs pub

Creates the directories docs and pub under the current directory.

1.3.4 Creating Parent Directories:


Sometimes when you want to create a directory, its parent directory or directories might not exist. In this case, mkdir
issues an error message as follows:
$mkdir /tmp/amrood/test

mkdir: Failed to make directory "/tmp/amrood/test";

No such file or directory

In such cases, you can specify the -p option to the mkdir command. It creates all the necessary directories for you. For
example:
$mkdir -p /tmp/amrood/test

Above command creates all the required parent directories.


1.3.5 Removing Directories:
Directories can be deleted using the rmdir command as follows:
$rmdir dirname

Note: To remove a directory make sure it is empty which means there should not be any file or sub-directory inside this
directory.
You can create multiple directories at a time as follows:
$rmdir dirname1 dirname2 dirname3
$

Above command removes the directories dirname1, dirname2, and dirname2 if they are empty. The rmdir command
produces no output if it is successful.
1.3.6 Changing Directories
You can use the cd command to do more than change to a home directory: You can use it to change to any directory by
specifying a valid absolute or relative path. The syntax is as follows:
$cd dirname

Here, dirname is the name of the directory that you want to change to. For example, the command:
$cd /usr/local/bin

Changes to the directory /usr/local/bin. From this directory you can cd to the directory /usr/home/amrood using the
following relative path:
$cd ../../home/amrood

1.3.7 Renaming Directories


The mv (move) command can also be used to rename a directory. The syntax is as follows:
$mv olddir newdir

You can rename a directory mydir to yourdir as follows:


$mv mydir yourdir

1.3.8 The directories . (dot) and .. (dot dot)


The filename . (dot) represents the current working directory; and
The filename .. (dot dot) represent the directory one level above the current working directory, often referred to as the
parent directory.
If we enter the command to show a listing of the current working directories files and use the -a option to list all the
files and the -l option provides the long listing, this is the result.
$ls -la

drwxrwxr-x 4 teacher class 2048 Jul 16 17.56 .

drwxr-xr-x 60 root 1536 Jul 13 14:18 ..

---------- 1 teacher class 4210 May 1 08:27 .profile

-rwxr-xr-x 1 teacher class 1948 May 12 13:42 memo

1.4 Unix File Permission


File ownership is an important component of UNIX that provides a secure method for storing files. Every file in UNIX
has the following attributes:

• Owner permissions: The owner's permissions determine what actions the owner of the file can perform on the
file.
• Group permissions: The group's permissions determine what actions a user, who is a member of the group that
a file belongs to, can perform on the file.
• Other (world) permissions: The permissions for others indicate what action all other users can perform on the
file.
ls -l /home/amrood
-rwxr-xr-- 1 amrood users 1024 Nov 2 00:10 myfile

drwxr-xr--- 1 amrood users 1024 Nov 2 00:10 mydir

The permissions are broken into groups of threes, and each position in the group denotes a specific permission, in this
order: read (r), write (w), execute (x):

• The first three characters (2-4) represent the permissions for the file's owner. For example -rwxr-xr- represents
that onwer has read (r), write (w) and execute (x) permission.
• The second group of three characters (5-7) consists of the permissions for the group to which the file belongs.
For example -rwxr-xr-- represents that group has read (r) and execute (x) permission but no write permission.
• The last group of three characters (8-10) represents the permissions for everyone else. For example -rwxr-xr-
represents that other world has read (r) only permission.

1.4.1 File Access Modes:


The permissions of a file are the first line of defense in the security of a Unix system. The basic building blocks of Unix
permissions are the read, write, and execute permissions, which are described below:

1. Read: Grants the capability to read i e. view the contents of the file.
2. Write: Grants the capability to modify or remove the content of the file.
3. Execute: User with execute permissions can run a file as a program.

1.4.2 Directory Access Modes:


Directory access modes are listed and organized in the same manner as any other file. There are a few differences that
need to be mentioned:

1. Read: Access to a directory means that the user can read the contents. The user can look at the
filenames inside the directory.
2. Write: Access means that the user can add or delete files to the contents of the directory.
3. Execute: Executing a directory doesn't really make a lot of sense so think of this as a traverse
permission. A user must have execute access to the bin directory in order to execute ls or cd command.

1.4.3 Changing Permissions:


To change file or directory permissions, you use the chmod (change mode) command. There are two ways to use chmod:
symbolic mode and absolute mode.

Using chmod in Symbolic Mode:

$ls -l testfile

-rwxrwxr-- 1 amrood users 1024 Nov 2 00:10 testfile

$chmod o+wx testfile

$ls -l testfile

-rwxrwxrwx 1 amrood users 1024 Nov 2 00:10 testfile

$chmod u-x testfile

ls -l testfile

-rw-rwxrwx 1 amrood users 1024 Nov 2 00:10 testfile

$chmod g=r-x testfile


$ls -l testfile

-rw-r-xrwx 1 amrood users 1024 Nov 2 00:10 testfile

$chmod o+wx,u-x,g=r-x testfile

$ls -l testfile -rw-r-xrwx 1 amrood users 1024 Nov 2 00:10 testfile

Using chmod with Absolute Permissions:

ls -l testfile

-rwxrwxr-- 1 amrood users 1024 Nov 2 00:10 testfile

$ chmod 755 testfile

$ls -l testfile

-rwxr-xr-x 1 amrood users 1024 Nov 2 00:10 testfile

$chmod 743 testfile

$ls -l testfile

-rwxr---wx 1 amrood users 1024 Nov 2 00:10 testfile

$chmod 043 testfile

$ls -l testfile

----r---wx 1 amrood users 1024 Nov 2 00:10 testfile

Changing Ownership:
Command : chown (The chown command stands for "change owner" and is used to change the owner of a file.)
basic syntax is as follows:
$ chown user filelist

The value of user can be either the name of a user on the system or the user id (uid) of a user on the system. For eg
$ chown amrood testfile $

Changes the owner of the given file to the user amrood.


NOTE: The super user, root, has the unrestricted capability to change the ownership of a any file but normal
users can change only the owner of files they own.
Changing Group Ownership:
Command: chrgp (The chgrp command stands for "change group" and is used to change the group of a file.)
basic syntax is as follows:
$ chgrp group filelist

The value of group can be the name of a group on the system or the group ID (GID) of a group on the system. For eg:
$ chgrp special testfile $

Changes the group of the given file to special group.

SUID and SGID File Permission:


Often when a command is executed, it will have to be executed with special privileges in order to accomplish its task. As
an example, when you change your password with the passwd command, your new password is stored in the file
/etc/shadow.

As a regular user, you do not have read or write access to this file for security reasons, but when you change your
password, you need to have write permission to this file. This means that the passwd program has to give you additional
permissions so that you can write to the file /etc/shadow.

Additional permissions are given to programs via a mechanism known as the Set User ID ( SUID) and Set Group ID ( SGID)
bits. When you execute a program that has the SUID bit enabled, you inherit the permissions of that program's owner.
Programs that do not have the SUID bit set are run with the permissions of the user who started the program.

This is true for SGID as well. Normally programs execute with your group permissions, but instead your group will be
changed just for this program to the group owner of the program.

The SUID and SGID bits will appear as the letter "s" if the permission is available. The SUID "s" bit will be located in the
permission bits where the owners execute permission would normally reside. For example, the command
$ ls -l /usr/bin/passwd

-r-sr-xr-x 1 root bin 19031 Feb 7 13:47 /usr/bin/passwd*

Which shows that the SUID bit is set and that the command is owned by the root. A capital letter S in the execute
position instead of a lowercase s indicates that the execute bit is not set. If the sticky bit is enabled on the directory,
files can only be removed if you are one of the following users:
• The owner of the sticky directory
• The owner of the file being removed
• The super user, root
To set the SUID and SGID bits for any directory try the following:
$ chmod ug+s dirname

$ ls -l drwsr-sr-x 2 root root 4096 Jun 19 06:45 dirname

1.5 Unix Basic Utilities


So far you must have got some idea about Unix OS and nature of its basic commands. This course would cover few very
basic but important Unix utilities which you would use in your day to day life.

1.5.1 Printing Files:


Before you print a file on a UNIX system, you may want to reformat it to adjust the margins, highlight some words, and
so on. Most files can also be printed without reformatting, but the raw printout may not look quite as nice. Many versions
of UNIX include two powerful text formatters, nroff and troff. (They are not covered in this class but you would quit a lot
material on the books for these utilities. )

The pr Command:
The pr command does minor formatting of files on the terminal screen or for a printer. For example, if you have a long
list of names in a file, you can format it onscreen into two or more columns.

Here is the syntax of pr command:


pr option(s) filename(s)

The pr changes the format of the file only on the screen or on the printed copy; it doesn't modify the original file.
Following table lists some pr options:

Option Description
-k Produces k columns of output
-d Double-spaces the output (not on all pr versions).
-h "header" Takes the next item as a report header.
-t Eliminates printing of header and top/bottom margins.
-l PAGE_LENGTH Set the page length to PAGE_LENGTH (66) lines. Default number of lines of text 56.
-o MARGIN Offset each line with MARGIN (zero) spaces.
-w PAGE_WIDTH Set page width to PAGE_WIDTH (72) characters for multiple text-column output only.
Before using pr, here are the contents of a sample file named food

Let's use pr command to make a two-column report with the header Restaurants:

The lp and lpr Commands:


The command lp or lpr prints a file onto paper as opposed to the screen display. Once you are ready with formatting
using pr command, you can use any of these commands to print your file on printer connected with your computer.

To print a file named food on the default printer, use the lp or lpr command, as in this example:
$lp food

request id is laserp-525 (1 file)

The lp command shows an ID that you can use to cancel the print job or check its status. If you are using lp command,
you can use -nNum option to print Num number of copies. Along with the command lpr, you can use -Num for the same.
If there are multiple printers connected with the shared network, then you can choose a printer using dprinter option
along with lp command and for the same purpose you can use -Pprinteroption along with lpr command. Here printer is
the printer name.

The lpstat and lpq Commands:


The lpstat command shows what's in the printer queue: request IDs, owners, file sizes, when the jobs were sent for
printing, and the status of the requests. Use lpstat -o if you want to see all output requests rather than just your own.
Requests are shown in the order they'll be printed:
$lpstat -o

laserp-573 john 128865 Nov 7 11:27 on laserp

laserp-574 grace 82744 Nov 7 11:28


laserp-575 john 23347 Nov 7 11:35

The lpq gives slightly different information than lpstat -o:


$lpq

laserp is ready and printing

Rank Owner Job Files Total Size

active john 573 report.ps 128865 bytes

1st grace 574 ch03.ps ch04.ps 82744 bytes

2nd john 575 standard input 23347 bytes

The cancel and lprm Commands:


The cancel terminates a printing request from the lp command.

The lprm terminates lpr requests.

You can specify either the ID of the request (displayed by lp or lpq) or the name of the printer.
$cancel laserp-575

request "laserp-575" cancelled

To cancel whatever request is currently printing, regardless of its ID, simply enter cancel and the printer name:
$cancel laserp

request "laserp-573" cancelled

The lprm command will cancel the active job if it belongs to you. Otherwise, you can give job numbers as arguments, or
use a dash (-) to remove all of your jobs:
$lprm 575

dfA575diamond dequeued

cfA575diamond dequeued

The lprm command tells you the actual filenames removed from the printer queue.

1.5.2 Sending Email:


You use the Unix mail command to send and receive mail. Here is the syntax to send an email:

Here are important options related to mail command:

Option Description
-s Specify subject on command line.
-c Send carbon copies to list of users. List should be a comma-separated list of names.
-b Send blind carbon copies to list. List should be a comma-separated list of names.
Following is the example to send a test message to admin@yahoo.com.
You are then expected to type in your message, followed by an "control-D" at the beginning of a line. To stop simply type
dot (.) as follows:
Hi,

This is a test .

Cc:

You can send a complete file using a redirect < operator as follows:

To check incoming email at your Unix system you simply type email as follows:

1.6 Unix Pipes and Filters


You can connect two commands together so that the output from one program becomes the input of the next program.
Two or more commands connected in this way form a pipe. To make a pipe, put a vertical bar (|) on the command line
between two commands. When a program takes its input from another program, performs some operation on that input,
and writes the result to the standard output, it is referred to as a filter.

1.6.1 The grep Command:


The grep program searches a file or files for lines that have a certain pattern. The syntax is:
$grep pattern file(s)

The name "grep" derives from the ed (a UNIX line editor) command g/re/p which means "globally search for a regular
expression and print all lines containing it."

A regular expression is either some plain text (a word, for example) and/or special characters used for pattern matching.

The simplest use of grep is to look for a pattern consisting of a single word. It can be used in a pipe so that only those
lines of the input files containing a given string are sent to the standard output. If you don't give grep a filename to read,
it reads its standard input; that's the way all filter programs work:

$ls -l | grep "Aug"


-rw-rw-rw- 1 john doc 11008 Aug 6 14:10 ch02
-rw-rw-rw- 1 john doc 8515 Aug 6 15:30 ch07
-rw-rw-r-- 1 john doc 2488 Aug 15 10:51 intro
-rw-rw-r-- 1 carol doc 1605 Aug 23 07:35 macros
$

There are various options which you can use along with grep command:

Option Description

-v Print all lines that do not match pattern.

-n Print the matched line and its line number.

-l Print only the names of files with matching lines (letter "l")

-c Print only the count of matching lines.


-i Match either upper- or lowercase.

Next, let's use a regular expression that tells grep to find lines with "carol", followed by zero or more other characters
abbreviated in a regular expression as ".*"), then followed by "Aug". Here we are using -i option to have case insensitive
search:

$ls -l | grep -i "carol.*aug"


-rw-rw-r-- 1 carol doc 1605 Aug 23 07:35 macros
$
1.6.2 The sort Command:
The sort command arranges lines of text alphabetically or numerically. The example below sorts the lines in the food
file:
$sort food Afghani
Cuisine Bangkok Wok
Big Apple Deli
Isle of Java
Mandalay
Sushi and Sashimi
Sweet Tooth
Tio Pepe's Peppers
$
The sort command arranges lines of text alphabetically by default. There are many options that control the sorting:

More than two commands may be linked up into a pipe. Taking a previous pipe example using grep, we can further
sort the files modified in August by order of size. The following pipe consists of the commands ls, grep, and sort:
Option Description

-n Sort numerically (example: 10 will sort after 2), ignore blanks and tabs.

-r Reverse the order of sort.


-f Sort upper- and lowercase together.

+x Ignore first x fields when sorting.

$ls -l | grep "Aug" | sort +4n


-rw-rw-r-- 1 carol doc 1605 Aug 23 07:35 macros
-rw-rw-r-- 1 john doc 2488 Aug 15 10:51 intro
-rw-rw-rw- 1 john doc 8515 Aug 6 15:30 ch07
-rw-rw-rw- 1 john doc 11008 Aug 6 14:10 ch02
$

This pipe sorts all files in your directory modified in August by order of size, and prints them to the terminal screen.
The sort option +4n skips four fields (fields are separated by blanks) then sorts the lines in numeric order.

1.6.3 The pg and more Commands:


A long output would normally zip by you on the screen, but if you run text through more or pg as a filter, the display
stops after each screenful of text. Let's assume that you have a long directory listing. To make it easier to read the
sorted listing, pipe the output through more as follows:

$ls -l | grep "Aug" | sort +4n | more


-rw-rw-r-- 1 carol doc 1605 Aug 23 07:35 macros
-rw-rw-r-- 1 john doc 2488 Aug 15 10:51 intro
-rw-rw-rw- 1 john doc 8515 Aug 6 15:30 ch07
-rw-rw-r-- 1 john doc 14827 Aug 9 12:40 ch03
.
.
.
-rw-rw-rw- 1 john doc 16867 Aug 6 15:56 ch05
--More--(74%)

The screen will fill up with one screenful of text consisting of lines sorted by order of file size. At the bottom of the
screen is the more prompt where you can type a command to move through the sorted text. When you're done with
this screen, you can use any of the commands listed in the discussion of the more program.
1.7 Unix Processes Management
When you execute a program on your UNIX system, the system creates a special environment for that program. This
environment contains everything needed for the system to run the program as if no other program were running on
the system. Whenever you issue a command in UNIX, it creates, or starts, a new process. When you tried out the ls
command to list directory contents, you started a process. A process, in simple terms, is an instance of a running
program. The operating system tracks processes through a five digit ID number known as the pid or process ID . Each
process in the system has a unique pid. Pids eventually repeat because all the possible numbers are used up and the
next pid rolls or starts over. At any one time, no two processes with the same pid exist in the system because it is the
pid that UNIX uses to track each process.

1.7.1 Starting a Process:

When you start a process (run a command), there are two ways you can run it:
• Foreground Processes
• Background Processes
Foreground Processes:
By default, every process that you start runs in the foreground. It gets its input from the keyboard and sends its
output to the screen. You can see this happen with the ls command. If I want to list all the files in my current
directory, I can use the following command:

$ls ch*.doc

This would display all the files whose name start with ch and ends with .doc:
ch01-1.doc ch010.doc ch02.doc ch03-2.doc
ch04-1.doc ch040.doc ch05.doc ch06-2.doc
ch01-2.doc ch02-1.doc

The process runs in the foreground, the output is directed to my screen, and if the ls command wants any input (which it does not),
it waits for it from the keyboard. While a program is running in foreground and taking much time, we cannot run any other commands
(start any other processes) because prompt would not be available until program finishes its processing and comes out.

Background Processes:
A background process runs without being connected to your keyboard. If the background process requires any keyboard input, it waits.

The advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes
to start another!

The simplest way to start a background process is to add an ampersand ( &) at the end of the command.

$ls ch*.doc &

This would also display all the files whose name start with ch and ends with .doc:

ch01-1.doc ch010.doc ch02.doc ch03-2.doc


ch04-1.doc ch040.doc ch05.doc ch06-2.doc
ch01-2.doc ch02-1.doc

Here if the ls command wants any input (which it does not), it goes into a stop state until I move it into the foreground and give
it the data from the keyboard.

That first line contains information about the background process - the job number and process ID. You need to know the job number
to manipulate it between background and foreground.

If you press the Enter key now, you see the following:

[1] + Done ls ch*.doc &


$

The first line tells you that the ls command background process finishes successfully. The second is a prompt for another command.

1.7.2 Listing Running Processes:


It is easy to see your own processes by running the ps (process status) command as follows:

$ps
PID TTY TIME CMD
18358 ttyp3 00:00:00 sh
18361 ttyp3 00:01:31 abiword
18789 ttyp3 00:00:00 ps

One of the most commonly used flags for ps is the -f ( f for full) option, which provides more information as shown in the following
example:

$ps -f
UID PID PPID C STIME TTY TIME CMD
amrood 6738 3662 0 10:23:03 pts/6 0:00 first_one amrood 6739
3662 0 10:22:54 pts/6 0:00 second_one amrood 3662 3657 0
08:10:53 pts/6 0:00 -ksh

amrood 6892 3662 4 10:51:50 pts/6 0:00 ps -f

Here is the description of all the fileds displayed by ps -f command:

Column Description

UID User ID that this process belongs to (the person running it).

PID Process ID.

PPID Parent process ID (the ID of the process that started it).

C CPU utilization of process.

STIME Process start time.

TTY Terminal type associated with the process

TIME CPU time taken by the process.

CMD The command that started this process.

There are other options which can be used along with ps command:

Option Description

-a Shows information about all users

-x Shows information about processes without terminals.

-u Shows additional information like -f option.

-e Display extended information.

1.7.3 Stopping Processes:

Ending a process can be done in several different ways. Often, from a console-based command, sending a CTRL+ C keystroke (the
default interrupt character) will exit the command. This works when process is running in foreground mode.
If a process is running in background mode then first you would need to get its Job ID using pscommand and after that you
can use kill command to kill the process as follows:

$ps -f
UID PID PPID C STIME TTY TIME CMD
amrood 6738 3662 0 10:23:03 pts/6 0:00 first_one amrood
6739 3662 0 10:22:54 pts/6 0:00 second_one amrood
3662 3657 0 08:10:53 pts/6 0:00 -ksh
amrood 6892 3662 4 10:51:50 pts/6 0:00 ps -f
$kill 6738
Terminated

Here kill command would terminate first_one process. If a process ignores a regular kill command, you can use kill -9 followed
by the process ID as follows:

$kill -9 6738
Terminated

1.7.4 Parent and Child Processes:

Each unix process has two ID numbers assigned to it: Process ID (pid) and Parent process ID (ppid). Each user process in the system
has a parent process.
Most of the commands that you run have the shell as their parent. Check ps -f example where this command listed both process
ID and parent process ID.

1.7.5 Zombie and Orphan Processes:


Normally, when a child process is killed, the parent process is told via a SIGCHLD signal. Then the parent can do some other task or
restart a new child as needed. However, sometimes the parent process is killed before its child is killed. In this case, the "parent of
all processes," init process, becomes the new PPID (parent process ID). Sometime these processes are called orphan process.

When a process is killed, a ps listing may still show the process with a Z state. This is a zombie, or defunct, process. The process
is dead and not being used. These processes are different from orphan processes.They are the processes that has completed execution
but still has an entry in the process table.

1.7.6 Daemon Processes:

Daemons are system-related background processes that often run with the permissions of root and services requests from other
processes.
A daemon process has no controlling terminal. It cannot open /dev/tty. If you do a "ps -ef" and look at the tty field, all daemons will have
a ? for the tty.
More clearly, a daemon is just a process that runs in the background, usually waiting for something to happen that it is capable of
working with, like a printer daemon is waiting for print commands.

If you have a program which needs to do long processing then its worth to make it a daemon and run it in background.

1.7.7 The top Command:


The top command is a very useful tool for quickly showing processes sorted by various criteria.
It is an interactive diagnostic tool that updates frequently and shows information about physical and virtual memory, CPU
usage, load averages, and your busy processes.
Here is simple syntax to run top command and to see the statistics of CPU utilization by different processes:

$top
1.8 Unix Communication
When you work in a distributed environment then you need to communicate with remote users and you also need to
access remote Unix machines. There are several Unix utilities which are especially useful for users computing in a
networked, distributed environment. This course lists few of them:

1.8.1 The ping Utility:

The ping command sends an echo request to a host available on the network. Using this command you can check if
your remote host is responding well or not.
• The ping command is useful for the following:
• Tracking and isolating hardware and software problems.
• Determining the status of the network and various foreign hosts.
• Testing, measuring, and managing networks.

Syntax:
Following is the simple syntax to use ping command:

$ping hostname or ip-address

Above command would start printing a response after every second. To come out of the command you can terminate
it by pressing CNTRL + C keys.

Example:
Following is the example to check the availability of a host available on the network:

$ping google.com
PING google.com (74.125.67.100) 56(84) bytes of data.
64 bytes from 74.125.67.100: icmp_seq=1 ttl=54 time=39.4 ms
64 bytes from 74.125.67.100: icmp_seq=2 ttl=54 time=39.9 ms
64 bytes from 74.125.67.100: icmp_seq=3 ttl=54 time=39.3 ms

64 bytes from 74.125.67.100: icmp_seq=4 ttl=54 time=39.1 ms


64 bytes from 74.125.67.100: icmp_seq=5 ttl=54 time=38.8 ms
--- google.com ping statistics ---
22 packets transmitted, 22 received, 0% packet loss, time 21017ms rtt
min/avg/max/mdev = 38.867/39.334/39.900/0.396 ms
$

If a host does not exist then it would behave something like this:

$ping giiiiiigle.com
ping: unknown host giiiiigle.com
$

1.8.2 The ftp Utility:


Here ftp stands for File Transfer Protocol. This utility helps you to upload and download your file from one computer
to another computer.
The ftp utility has its own set of UNIX like commands which allow you to perform tasks such as:
• Connect and login to a remote host.
• Navigate directories.
• List directory contents
• Put and get files
• Transfer files as ascii, ebcdic or binary
Syntax:
Following is the simple syntax to use ping command:

$ftp hostname or ip-address

Above command would prompt you for login ID and password. Once you are authenticated, you would have access on the
home directory of the login account and you would be able to perform various commands.

Few of the useful commands are listed below:

Command Description

put filename Upload filename from local machine to remote machine.

get filename Download filename from remote machine to local machine.

mput file list Upload more than one files from local machine to remove machine.

mget file list Download more than one files from remote machine to local machine.

Turns prompt off, by default you would be prompted to upload or download movies using
prompt off
mput or mget commands.

prompt on Turns prompt on.

Dir List all the files available in the current directory of remote machine.

cd dirname Change directory to dirname on remote machine.

lcd dirname Change directory to dirname on local machine.

Quit Logout from the current login.

It should be noted that all the files would be downloaded or uploaded to or from current directories. If you want to upload your
files in a particular directory then first you change to that directory and then upload required files.

Example:
Following is the example to show few commands:

$ftp amrood.com
Connected to amrood.com.
220 amrood.com FTP server (Ver 4.9 Thu Sep 2 20:35:07 CDT 2009) Name
(amrood.com:amrood): amrood
331 Password required for amrood. Password:
230 User amrood logged in. ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls. total 1464
drwxr-sr-x 3 amrood group 1024 Mar 11 20:04 Mail drwxr-sr-x 2
amrood group 1536 Mar 3 18:07 Misc drwxr-sr-x 5 amrood
group 512 Dec 7 10:59 OldStuff drwxr-sr-x
2 amrood group 1024 Mar 11 15:24 bin
drwxr-sr-x 5 amrood group 3072 Mar 13 16:10 mpl
-rw-r--r-- 1 amrood group 209671 Mar 15 10:57 myfile.out drwxr-sr-x
3 amrood group 512 Jan 5 13:32 public drwxr-sr-x
3 amrood group 512 Feb 10 10:17 pvm3
226 Transfer complete. ftp> cd
mpl
250 CWD command successful. ftp> dir
200 PORT command successful.
150 Opening data connection for /bin/ls. total 7320
-rw-r--r-- 1 amrood group 1630 Aug 8 1994 dboard.f
-rw-r----- 1 amrood group 4340 Jul 17 1994 vttest.c
-rwxr-xr-x 1 amrood group 525574 Feb 15 11:52 wave_shift
-rw-r--r-- 1 amrood group 1648 Aug 5 1994 wide.list
-rwxr-xr-x 1 amrood group 4019 Feb 14 16:26 fix.c
226 Transfer complete. ftp> get
wave_shift
200 PORT command successful.
150 Opening data connection for wave_shift (525574 bytes).
226 Transfer complete.
528454 bytes received in 1.296 seconds (398.1 Kbytes/s)
ftp> quit
221 Goodbye.

1.8.3 The telnet Utility:


Many times you would be in need to connect to a remote Unix machine and work on that machine remotely. Telnet is a
utility that allows a computer user at one site to make a connection, login and then conduct work on a computer at another site.
Once you are login using telnet, you can perform all the activities on your remotely connect machine. Here is example telnet
session:

C:>telnet amrood.com
Trying...
Connected to amrood.com. Escape
character is '^]'.

login: amrood amrood's


Password:
*****************************************************
* *
* *
* WELCOME TO AMROOD.COM *
* *
* *
*****************************************************

Last unsuccessful login: Fri Mar 3 12:01:09 IST 2009


Last login: Wed Mar 8 18:33:27 IST 2009 on pts/10

{ do your work }

$ logout
Connection closed. C:>

1.8.4 The finger Utility:

The finger command displays information about users on a given host. The host can be either local or remote.

Finger may be disabled on other systems for security reasons.

Following are the simple syntax to use finger command:

Check all the logged in users on local machine as follows:

$ finger
Login Name Tty Idle Login Time Office
amrood pts/0 Jun 25 08:03 (62.61.164.115)

Get information about a specific user available on local machine:

$ finger amrood
Login: amrood Name: (null) Directory:
/home/amrood Shell: /bin/bash
On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
No mail.
No Plan.

Check all the logged in users on remote machine as follows:

$ finger @avtar.com
Login Name Tty Idle Login Time Office
amrood pts/0 Jun 25 08:03 (62.61.164.115)

Get information about a specific user available on remote machine:

$ finger amrood@avtar.com
Login: amrood Name: (null) Directory:
/home/amrood Shell: /bin/bash
On since Thu Jun 25 08:03 (MST) on pts/0 from 62.61.164.115
No mail. No Plan.

1.9 Managing UNIX help


Unix's version of help files are called man pages. If you know any command name but you do not know how to use it, then
Man Pages are here to help you at every step.

Syntax:
Here is the simple command to get the detail of any Unix command while working with the system:

$man command

Example:
Now you imagine any command for which you want to get help. Assuming you want to know about pwd then you simply need
to use the following command:

$man pwd

The above command would open a help for you which would give you complete information about pwd command. Try it yourself
at your command prompt to get more detail on
You can get complete detail on man command itself using the following command:

$man man

1.9.1 Man Page Sections:


Man pages are generally divided into sections, which generally vary by the man page author's preference. Here are some of
the more common sections:

NAME Name of the command

SYNOPSIS General usage parameters of the command.

DESCRIPTION Generally describes of the command and what it does

OPTIONS Describes all the arguments or options to the command

Lists other commands that are directly related to the command in the man page or closely
SEE ALSO
resembling its functionality.

BUGS Explains any known issues or bugs that exist with the command or its output

EXAMPLES Common usage examples that give the reader an idea of how the command can be used.

AUTHORS The author of the man page/command.


1.10 Unix – File System Basics

1.10.1 Directory Structure:


Unix uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system and all
other directories spreading from there.

A UNIX filesystem is a collection of files and directories that has the following properties:

• It has a root directory (/) that contains other files and directories.

• Each file or directory is uniquely identified by its name, the directory in which it resides, and a unique identifier,
typically called an inode.

• By convention, the root directory has an inode number of 2 and the lost+found directory has an inode number of 3.
Inode numbers 0 and 1 are not used. File inode numbers can be seen by specifying the -i option to ls command.

• It is self contained. There are no dependencies between one filesystem and any other.

The directories have specific purposes and generally hold the same types of information for easily locating files. Following are
the directories that exist on the major versions of Unix:

Directory Description

This is the root directory which should contain only the directories needed at the top level of the file
/
structure.

/bin This is where the executable files are located. They are available to all user.

/dev These are device drivers.

Supervisor directory commands, configuration files, disk configuration files, valid user lists, groups,
/etc
ethernet, hosts, where to send critical messages.

/lib Contains shared library files and sometimes other kernel-related files.

/boot Contains files for booting the system.

/home Contains the home directory for users and other accounts.

Used to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy
/mnt
diskette drive, respectively

Contains all processes marked as a file by process number or other information that is dynamic to the
/proc
system.

/tmp Holds temporary files used between system boots

Used for miscellaneous purposes, or can be used by many users. Includes administrative commands,
/usr
shared files, library files, and others

Typically contains variable-length files such as log and print files and any other type of file that may
/var
contain a variable amount of data

Contains binary (executable) files, usually for system administration. For examplefdisk
/sbin
and ifconfig utlities.

/kernel Contains kernel files

1.10.2 Navigating the File System:


Now that you understand the basics of the file system, you can begin navigating to the files you need. The following are
commands you'll use to navigate the system:

Command Description

cat filename Displays a filename.


cd dirname Moves you to the directory identified.

cp file1 file2 Copies one file/directory to specified location.

file filename Identifies the file type (binary, text, etc).

find filename dir Finds a file/directory.

head filename Shows the beginning of a file.

less filename Browses through a file from end or beginning.

ls dirname Shows the contents of the directory specified.

mkdir dirname Creates the specified directory.

more filename Browses through a file from beginning to end.

mv file1 file2 Moves the location of or renames a file/directory.

pwd Shows the current directory the user is in.

rm filename Removes a file.

rmdir dirname Removes a directory.

tail filename Shows the end of a file.

touch filename Creates a blank file or modifies an existing file.s attributes.

whereis filename Shows the location of a file.

which filename Shows the location of a file if it is in your PATH.

You can use Manpage Help to check complete syntax for each command mentioned here.

1.10.3 The df Command:


The first way to manage your partition space is with the df (disk free) command. The command df -k (disk free)
displays the disk space usage in kilobytes, as shown below:

$df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vzfs 10485760 7836644 2649116 75% /
/devices 0 0 0 0% /devices
$

Some of the directories, such as /devices, shows 0 in the kbytes, used, and avail columns as well as 0% for capacity.
These are special (or virtual) file systems, and although they reside on the disk under /, by themselves they do not take up disk
space.
The df -k output is generally the same on all Unix systems. Here's what it usually includes:

Column Description

Filesystem The physical file system name.

Kbytes Total kilobytes of space available on the storage medium.

Used Total kilobytes of space used (by files).

Avail Total kilobytes available for use.

Capacity Percentage of total space used by files.

Mounted on What the file system is mounted on.

You can use the -h (human readable) option to display the output in a format that shows the size in easier-to- understand notation.

1.10.4 The du Command:


The du (disk usage) command enables you to specify directories to show disk space usage on a particular directory.
This command is helpful if you want to determine how much space a particular directory is taking. Following command
would display number of blocks consumed by each directory. A single block may take either 512 Bytes or 1 Kilo Byte depending
on your system.

$du /etc
10 /etc/cron.d
126 /etc/default
6 /etc/dfs
...
$

The -h option makes the output easier to comprehend:

$du -h /etc
5k /etc/cron.d
63k /etc/default
3k /etc/dfs
...
$

1.10.5 Mounting the File System:


A file system must be mounted in order to be usable by the system. To see what is currently mounted (available for use) on
your system, use this command:

$ mount
/dev/vzfs on / type reiserfs (rw,usrquota,grpquota)
proc on /proc type proc (rw,nodiratime)
devpts on /dev/pts type devpts (rw)
$

The /mnt directory, by Unix convention, is where temporary mounts (such as CD-ROM drives, remote network drives, and
floppy drives) are located. If you need to mount a file system, you can use the mount command with the following syntax:

mount -t file_system_type device_to_mount directory_to_mount_to

For example, if you want to mount a CD-ROM to the directory /mnt/cdrom, for example, you can type:

$ mount -t iso9660 /dev/cdrom /mnt/cdrom

This assumes that your CD-ROM device is called /dev/cdrom and that you want to mount it to /mnt/cdrom. Refer to the mount
man page for more specific information or type mount -h at the command line for help information.
After mounting, you can use the cd command to navigate the newly available file system through the mountpoint you just made.

1.10.6 Unmounting the File System:


To unmount (remove) the file system from your system, use the umount command by identifying the mountpoint or device
For example, to unmount cdrom, use the following command:

$ umount /dev/cdrom

The mount command enables you to access your file systems, but on most modern Unix systems, the automount function makes
this process invisible to the user and requires no intervention.

1.10.7 User and Group Quotas:


User and group quotas provide the mechanisms by which the amount of space used by a single user or all users within a
specific group can be limited to a value defined by the administrator.

Quotas operate around two limits that allow the user to take some action if the amount of space or number of disk blocks start to
exceed the administrator defined limits:

• Soft Limit: If the user exceeds the limit defined, there is a grace period that allows the user to free up some space.
• Hard Limit: When the hard limit is reached, regardless of the grace period, no further files or blocks can be allocated.

There are a number of commands to administer quotas:


Command Description

quota Displays disk usage and limits for a user of group.

edquota This is a quota editor. Users or Groups quota can be edited using this command.

quotacheck Scan a filesystem for disk usage, create, check and repair quota files

setquota This is also a command line quota editor.

This announces to the system that disk quotas should be enabled on one or more
quotaon
filesystems.

This announces to the system that disk quotas should be disabled off one or more
quotaoff
filesystems.

repquota This prints a summary of the disc usage and quotas for the specified file systems

You can use Manpage Help to check complete syntax for each command mentioned here.

1.11 Unix – Useful Commands


This quick guide lists commands, including a syntax and brief description. For more detail, use:

$man command

1.11.1 Files and Directories:


These commands allow you to create directories and handle files.
Command Description

Cat Display File Contents

Cd Changes Directory to dirname

Chgrp change file group

Chmod Changing Permissions

Cp Copy source file into destination

File Determine file type

Find Find files

Grep Search files for regular expressions.

Head Display first few lines of a file

Ln Create softlink on oldname

Ls Display information about file type.

Mkdir Create a new directory dirname

More Display data in paginated form.

Mv Move (Rename) a oldname to newname.

Pwd Print current working directory.

Rm Remove (Delete) filename


Rmdir Delete an existing directory provided it is empty.

Tail Prints last few lines in a file.

Touch Update access and modification time of a file.

1.11.2 Manipulating data:


The contents of files can be compared and altered with the following commands.

Command Description

Awk Pattern scanning and processing language

Cmp Compare the contents of two files

Comm. Compare sorted data

Cut Cut out selected fields of each line of a file

Diff Differential file comparator

Expand Expand tabs to spaces

Join Join files on some common field

Perl Data manipulation language

Sed Stream text editor

Sort Sort file data

Split Split file into smaller files

Tr Translate characters

Uniq Report repeated lines in a file

Wc Count words, lines, and characters

Vi Opens vi text editor

Vim Opens vim text editor

Fmt Simple text formatter

Spell Check text for spelling error

Ispell Check text for spelling error

Ispell Check text for spelling error

Emacs GNU project Emacs

ex, edit Line editor

Emacs GNU project Emacs

Emacs GNU project Emacs

1.11.3 Compressed Files:


Files may be compressed to save space. Compressed files can be created and examined :

Command Description

compress Compress files

Gunzip Uncompress gzipped files

Gzip GNU alternative compression method

uncompress Uncompress files

Unzip List, test and extract compressed files in a ZIP archive

Zcat Cat a compressed file

Zcmp Compare compressed files

Zdiff Compare compressed files

Zmore File perusal filter for crt viewing of compressed text

1.11.4 Getting Information:


Various Unix manuals and documentation are available on-line. The following Shell commands give information:

Command Description

apropos Locate commands by keyword lookup

Info Displays command information pages online

Man Displays manual pages online

Whatis Search the whatis database for complete words.

Yelp GNOME help viewer

1.11.5 Network Communication:


These following commands are used to send and receive files from a local UNIX hosts to the remote host around the world.

Command Description

ftp File transfer program

Rcp Remote file copy

rlogin Remote login to a UNIX host

Rsh Remote shell

Tftp Trivial file transfer program

telnet Make terminal connection to another host

Ssh Secure shell terminal or command connection

Scp Secure shell remote file copy

Sftp secure shell file transfer program

Some of these commands may be restricted at your computer for security reasons.
1.11.6 Messages between Users:
The UNIX systems support on-screen messages to other users and world-wide electronic mail:

Command Description

evolution GUI mail handling tool on Linux

Mail Simple send or read mail program

Mesg Permit or deny messages

Parcel Send files to another user

Pine Vdu-based mail utility

Talk Talk to another user

Write Write message to another user

1.11.7 Programming Utilities:


The following programming tools and languages are available based on what you have installed on your Unix.

Command Description

Dbx Sun debugger

Gdb GNU debugger

Make Maintain program groups and compile programs.

Nm Print program's name list

Size Print program's sizes

Strip Remove symbol table and relocation bits

Cb C program beautifier

Cc ANSI C compiler for Suns SPARC systems

Ctrace C program debugger

Gcc GNU ANSI C Compiler

Indent Indent and format C program source

Bc Interactive arithmetic language processor

Gcl GNU Common Lisp

Perl General purpose language

Php Web page embedded language

Py Python language interpreter

Asp Web page embedded language

CC C++ compiler for Suns SPARC systems

g++ GNU C++ Compiler


Javac JAVA compiler

appletvieweir JAVA applet viewer

netbeans Java integrated development environment on Linux

Sqlplus Run the Oracle SQL interpreter

Sqlldr Run the Oracle SQL data loader

Mysql Run the mysql SQL interpreter

1.11.8 Misc Commands:


These commands list or alter information about the system:

Command Description

Chfn Change your finger information

Chgrp Change the group ownership of a file

Chown Change owner

Date Print the date

determin Automatically find terminal type

Du Print amount of disk usage

Echo Echo arguments to the standard options

Exit Quit the system

Finger Print information about logged-in users

groupadd Create a user group

Groups Show group memberships

homequota Show quota and file usage

Iostat Report I/O statistics

Kill Send a signal to a process

Last Show last logins of users

Logout log off UNIX

Lun List user names or login ID

Netstat Show network status

Passwd Change user password

Passwd Change your login password

printenv Display value of a shell variable

Ps Display the status of current processes


Ps Print process status statistics

quota -v Display disk usage and limits

Reset Reset terminal mode

Script Keep script of terminal session

Script Save the output of a command or process

Setenv Set environment variables

Sty Set terminal options

Time Time a command

Top Display all system processes

Tset Set terminal mode

Tty Print current terminal name

Umask Show the permissions that are given to view files by default

Uname Display name of the current system

Uptime Get the system up time

useradd Create a user account

Users Print names of logged in users

Vmstat Report virtual memory statistics

W Show what logged in users are doing

Who List logged in users

Unix – Builtin Functions

The most of the part of this course covered Bourne Shell but this page list down all the mathematical builtiin functions available in
Korn Shell.
The Korn shell provides access to the standard set of mathematical functions. They are called using C function call syntax.

Function Description

Abs Absolute value

Log Natural logarithm

Acos Arc cosine

Sin Sine
Asin Arc sine

Sinh Hyperbolic sine

Cos Cosine

Sqrt Square root

Cosh Hyperbolic cosine

Tan Tangent

Exp Exponential function

Tanh Hyperbolic tangent

Int Integer part of floating-point number

You might also like