You are on page 1of 13

Class 1

Introduction to UNIX and Basic


Commands

UNIX
An Operating System is a resource manager. It

consists of a set of software programs (routines)


that allow users and applications to access system
resources in a secure, efficient and abstract
manner
UNIX is the first serious OS created in 1969
Unix is a multi-tasking OS; It can perform multiple
tasks at the same time
It is a multi-user OS; several users can use the
same computer/OS at the same time

UNIX
More importantly for todays networked world:

UNIX is the most stable OS with powerful


networking capabilities
Unix-based machines come in different
names from various vendors:
- Sun Microsystems Sparc, Solaris
- IBM AIX
- HP computers HP-UX
- Macintosh MacOS-X

UNIX Architecture
Layered architecture: 3 parts (kernel, shell,

programs)
Kernel: is the core of the UNIX OS. It is in
direct control of the underlying hardware and
provides the low-level processor, memory
and device management functions
Example: allocating memory for programs
Shell: Acts as the interface between the user
and the kernel

UNIX Architecture
The user issues a command to the shell which

interprets it and requests the kernel through


system calls and thus arranges for its execution
After the command completes execution, the shell
returns the UNIX prompt to the user indicating it is
waiting for further commands
Several shells Bourne (sh), C-shell (csh),
Bourne Again shell (bash), Korn shell (ksh)
The core features present in all; differ in additional
features

Files & Processes


Everything in UNIX is represented a file or a

process
A file is a collection of data; could be text or
binary
A process is a currently executing program
uniquely identified by a PID (Process
Identifier)

UNIX Directory Structure


The UNIX directory structure or file system is

arranged hierarchically, like an inverted tree


The top of the hierarchy is called the root
denoted by a /

Paths
Absolute path always starts from the root /
Relative path relative to the current working

directory
Current directory: represented by a single dot
.
Parent directory: represented by 2 dots ..
Home directory: represented by a tilde ~

UNIX Commands
0) man display the manual for a command
1) date display todays date
2) clear clear screen
3) echo echo content
4) cd change directory
5) mkdir make a new directory
6) pwd display the present/current working
directory

More Commands
7) rmdir remove directory
8) ls list contents of a directory
9) cat display contents of a file
10) head display head (first 10 lines) of a file
11) tail display tail (last 10 lines) of a file
12) more display a file page-wise
13) wc display number of lines, words and
characters in a file

More Commands
14) mv move/rename a file/directory
15) cp copy a file
16) rm delete/remove a file
17) sleep delay for a specified period of time

chmod Command
18) chmod change permissions on a
file/directory
Permission values: 4 read (r) / 2 write (w) / 1
execute (x)
Example: chmod 644 fileName
sets permissions of rw-r--r-- for fileName
The first digit is for owner, the second digit for
the group that the owner belongs to and the
third digit for everyone in the system

Process Manipulation commands


Process is an executing program uniquely

identified with a PID (Process Identifier)


19) ps lists all processes
20) kill kill/stop a process
kill -9 Forcibly kill a process

You might also like