You are on page 1of 28



Specially For DAE Computer I.T





There Is A Great Blessing Of Allah, Allah Give Me Such Ability And Confidence To Accomplish The Goal.

My Name Is MUHAMMAD SHUMRAIZ SHARIF. I Have Passed BS-IT From Virtual University Of
Pakistan. Before BS, I Have Also Passed D.A.E In Computer Information Technology. From Pak
Polytechnic Institute Lahore. I Have Done CCNA, CCNP Course From PUCIT Lahore. I Have Been
Teaching Computer Subjects Since 2015 In Abbas College Of Technology. Almost Hundred above
Students Passing Out From This Course. I Will Special Thanks To Mr. Shahid Jahangir (Principal) And
ACT Staff For Giving Me A Platform.

It’s all Due to my Parents prayers and hardworking for me.

I Am Very Thankful To My Dear Friends & Co-Writers They All Are Include In All to All Process For
Next Generation Of Our Pakistan.
Mr. Farhan Akhtar (BS_IT), Mr. Ahmed Iqbal (BS_SE), Ghulammuhiyudin (BCS)
Prof Readers;
Mr. Bilawal Sheikh (M Phil CS)  Principal in Punjab Education Dept.
Mr. Abdul Ahad (MIT)  Senior Officer I.T at Punjab Police (PPIC3).
At Last I Am Request To Readers Please Send Me Your Valuable Suggestions For Improvements.




(Computer Instructor in Abbas College Of Technology)

(Computer Hardware & I.T Trainer In Click College Of I.T)
0340-4088566 ABBAS COLLEGE OF TECHNOLOGY 03404088566


OperaTIng SySTem COmpleTe nOTeS

Q# 01- What are the General Operations of Computer?

The Four main Computer Operations are:-

1) Accepting input.

2) Performing processing.

3) Outputting results.

4) Storage (for data, output or programs).

Q# 02- What is Interrupt?

An interrupt is a signal from a device attached to a computer or from a program within the computer
that causes the main program that operates the computer (the operating system ) to stop and figure
out what to do next. Almost all personal (or larger) computers today are interrupt-driven - that is,
they start down the list of computer instruction s in one program (perhaps an application such as a
word processor) and keep running the instructions until either (A) they can't go any further or (B) an
interrupt signal is sensed. After the interrupt signal is sensed, the computer either resumes running
the program it was running or begins running another program.

An operating system usually has some code that is called an interrupt handler . The interrupt handler
prioritizes the interrupts and saves them in a queue if more than one is waiting to be handled. The
operating system has another little program, sometimes called ascheduler , that figures out which
program to give control to next.

Q# 03- What is I/O devices names give the names?

Answer: list of basic Input Devices, Output devices and Both input-output devices related
to computer.

Input Devices: Output devices: Both Input-Output Devices:

1. Graphics Tablets 1) Monitor 1) Modems
2. Cameras 2) Printers (all types) 2) Network cards
3. Video Capture Hardware 3) Plotters 3) Touch Screen
4. Trackballs 4) Projector 4) Headsets (Headset consists of
5. Barcode reader 5) LCD Projection Panels Speakers and Microphone
6. Digital camera 6) Speaker(s) Speaker act Output Device
7. Gamepad and Microphone act as
8. Joystick Input device)
9. Keyboard 5) Facsimile (FAX) (It has
10. Microphone scanner to scan the document
11. MIDI keyboard and also have printer to Print
12. Mouse (pointing device) the document)
13. Scanner 6) Audio Cards / Sound Card
14. Webcam
15. Touchpads
16. Pen Input
17. Microphone
18. Electronic Whiteboard ABBAS COLLEGE OF TECHNOLOGY 03404088566


Q# 04- Give the List of storage devices and Explain them?

1) Pen Drive
2) DVD-R, DVD+R, DVD-RW, and DVD+RW disc 7) USB Devices

3) CD 8) Memory Card

4) DVD 9) Multimedia Card

5) Floppy Drive 10) RAM

6) Hard disk 11) ROM

12) Tape Drive

13) External Hard

Q# 05- Draw and Explain the Hierarchy of Storage devices?

Q# 06- What is Computer Security Issues?

Hacking unauthorized access to or use of data, systems, server or networks, including any illegal attempt, scan
or test the vulnerability of a system, server or network or to breach security or authentication measures
without express authorization of the owner of the system, server or network. Members of the University
should not run computer programs that are associated with hacking without prior authorization. Obtaining and
using such programs is not typical of normal usage and may therefore otherwise be regarded as misuse.

 Use of University owned computer equipment, including the network, for illegal activities including copying
Copyright material without permission. The vast majority of files shared on P2P (peer-to-peer) networks
violate copyright law because they were posted without permission of the artist or label.
 Sending abusive e-mails or posting offensive Web pages.
 Creation or transmission of any offensive or indecent images.

 Giving unauthorized access to University computing resources e.g. allowing an account to be used by someone
not authorized to use it.

 Deliberately creating or spreading computer viruses or worms. ABBAS COLLEGE OF TECHNOLOGY 03404088566


 Unauthorized running of applications that involve committing the University to sharing its computing
resources, e.g. network bandwidth, in an uncontrolled and unlimited way.

Q# 07- Describe the protection methods of computer operations?

Here are the TEN (10) ways to protect your data.

1. Save as you work. You should always save your work as you go and learn how to use the 'auto-save'
features in your application.
2. Make a backup. Before you make changes to critical data always make a duplicate. Even if you just
made a backup yesterday - make another.
3. Keep a copy of your data offsite. Diligently backing up your data is good practice but keep a copy of
your data offsite. If there were a fire or other disaster your onsite data backup could be lost as well.
4. Refresh your archives. Years ago you archived your data to a zip drive. Now you decide to use that
data as a baseline - are you sure there is still a zip drive that can read your data? As technology
changes, it is a good idea to transfer your data to a current data storage standard so that you aren't
stuck with irretrievable data. Information Systems & Technology (IST) provides a backup service.
5. Never open email attachments by habit. If your email reader has an option to automatically open
attachments you should disable that feature. Always run any attachments and downloaded files
through a virus scanner first.
6. Never trust disks from other people. Anytime you receive a file on any type of media check it first
for viruses!
7. Update your software. Make sure you have the latest updates for your software - especially for your
virus checking software. Make it a habit to regularly check for updates and enable automatic
updates for software that offers that feature.
8. Protect your passwords. Your user id is your identity. The key to your identity is your password.
Anytime your account accesses the network you are responsible for any activity from that account.
Remember to change your password on a regular basis.
9. Protect your computer. Use a secure operating system which requires users to be 'authenticated'.
As an added benefit these operating systems also restrict what individual users can see and do on
the system.
10. Perform regular maintenance. Learn how to use the utilities that diagnose your system for
problems. It is a good idea to run a disk-scanning program, defragment your hard drive, or whatever
else your system might need. These utilities can prevent little problems from becoming big
problems, and will keep your system running at top speed. If you need help with a big problem IST
has a hardware repair service.

Q# 08- What are the major Functions of Operating system?

1. Managing programs 8. Disk and file systems

2. Managing Memory 9. Networking
3. Handling input and output 10. Security
4. User Interface 11. Internal security
5. Services 12. External security
6. Process management 13. Graphical user interfaces
7. Memory management 14. Device drivers ABBAS COLLEGE OF TECHNOLOGY 03404088566


Q# 09- Describe the Functions of an Operating System?

Memory management

1. Memory management is the function of a computer operating system responsible

for managing the computer's primary memory. The memory management function keeps
track of the status of each memory location, either allocated or free.

Q# 10- What is Virtual memory management?

 Virtual memory that appears to exist as main storage although most of it is
supported by data held in secondary storage, transfer between the two being made
automatically as required.
 Virtual memory is a feature of an operating system (OS) that allows a computer to
compensate for shortages of physical memory by temporarily
transferring pages of data from random access memory (RAM) to disk storage.

Q# 11- Describe a hierarchical directory structure?

It's a directory path. Paths are often expressed by listing the directories along the path separated by
slashes. For instance, animals/prehistoric/dinosaurs would represent the path starting at the ABBAS COLLEGE OF TECHNOLOGY 03404088566


directory named animals, passing through its subdirectory named

prehistoric, and terminating in the sub-subdirectory dinosaurs.

Q# 12- Hierarchical File Structure

 All of the files in the UNIX file system are organized into a multi-leveled hierarchy called a
directory tree.
 A family tree is an example of a hierarchical structure that represents how the UNIX file
system is organized. The UNIX file system might also be envisioned as an inverted tree or the
root system of plant.
 At the very top of the file system is single directory called "root" which is represented by a /
(slash). All other files are "descendants" of root.
 The number of levels is largely arbitrary, although most UNIX systems share some
organizational similarities. The "standard" UNIX file system is discussed later. Example:

| | |
/bin /usr /tmp
| | | |
/public /misc /staff /students
| | |
------------ ------------------- ---------------------
| | | | | | | | |
/software /doc /john /mary /bill /carl /tom /dick /mary

The functions usually performed on a file are as follows:

 Opening a file for processing

 Reading data from a file for processing
 Writing data to a file after processing
 Closing a file after all the necessary processing has been done

Q# 13- What is Disk Management?

Disk Management is an extension of the Microsoft Management Console that allows full
management of the disk-based hardware recognized by Windows.

To open it Click Start and in the Run line type diskmgmt.msc and press enter.

Q# 14- Manage the computer resources? ABBAS COLLEGE OF TECHNOLOGY 03404088566


It manages the hardware and software resources of the system. In a desktop computer,
these resources include such things as the processor, memory, disk space and more (On a
cell phone, they include the keypad, the screen, the address book, the phone dialer, the
battery and the network connection).

Q# 15- What is the System Calls?

System calls provide the interface between a running program and the operating system. (an
instruction that interrupts the program being executed and passes control to the supervisor.
In computing, a system call is how a program requests a service from an operating system's kernel.
This may include hardware related services (e.g. accessing the hard disk), creating and executing
new processes, and communicating with integral kernel services (like scheduling). System calls
provide an essential interface between a process and the operating system.

Q# 16- What are the Types of System Calls?

1. Process control
2. File management
3. Device management
4. Information maintenance
5. Communications
Q# 17- Who is System Administrator and what are the Responsibilities of System

The System Administrator (SA) is responsible for effective provisioning, installation/configuration,

operation, and maintenance of systems hardware and software and related infrastructure. This
individual participates in technical research and development to enable continuing innovation within
the infrastructure. This individual ensures that system hardware, operating systems, software
systems, and related procedures adhere to organizational values, enabling staff, volunteers, and Partners.

This individual will assist project teams with technical issues in the Initiation and Planning phases of
our standard Project Management Methodology. These activities include the definition of needs,
benefits, and technical strategy; research & development within the project life-cycle; technical
analysis and design; and support of operations staff in executing, testing and rolling-out the
solutions. Participation on projects is focused on smoothing the transition of projects from
development staff to production staff by performing operations activities within the project life-cycle.

This individual is accountable for the following systems: Linux and Windows systems that support
GIS infrastructure; Linux, Windows and Application systems that support Asset Management;
Responsibilities on these systems include SA engineering and provisioning, operations and support,
maintenance and research and development to ensure continual innovation.

Q# 18- What is The Task / Role Of the System Administrator?

The person who is responsible for setting up and maintaining the system or server is
called as the system administrator. System administrators may be members of an ABBAS COLLEGE OF TECHNOLOGY 03404088566


information technology department. Most of the following discussion also applies to

network and Windows system admins.

Q# 19- What are the Duties of a system administrator?

The duties of a system administrator are wide-ranging, and vary widely from one
organization to another. Sysadmins are usually charged with installing, supporting,
and maintaining servers or other computer systems, and planning for and
responding to service outages and other problems.

The system administrator is responsible for following things:

1. Create a backup and recover policy 6. Documentation in form of internal wiki

2. Monitor network communication 7. Password and identity management User

3. Update system as soon as new version of OS administration (setup and maintaining

and application software comes out account)

4. Implement the policies for the use of the 8. Maintaining system

computer system and network 9. Verify that peripherals are working properly

5. Setup security policies for users. A sysadmin 10. Quickly arrange repair for hardware in

must have a strong grasp of computer occasion of hardware failure

security (e.g. firewalls and intrusion detection 11. Monitor system performance

systems) 12. Create file systems

13. Install software

Q# 20- Define and Identify the Hardware Requirements of Linux (Ubuntu)?

The Minimum System Requirements for Linux/Unix
1. 300 MHz x86 processor
2. 64 MB of system memory (RAM)
3. At least 4 GB of disk space (for full installation and swap space)
4. VGA graphics card
5. capable of 640x480 resolution

6. CD-ROM drive

Recommended Minimum System Requirements

1. 700 MHz processor (about Intel Celeron or better)

2. 512 MiB RAM (system memory)

3. 5 GB of hard-drive space (or USB stick, memory card or external drive but see LiveCD for
an alternative approach)
4. VGA capable of 1024x768 screen resolution ABBAS COLLEGE OF TECHNOLOGY 03404088566


Q# 21- What is System Programming?

System programming (or systems programming) is the activity of computer programming system
software. The primary distinguishing characteristic of systems programming when compared
to application programming is that application programming aims to produce software which
provides services to the user (e.g. word processor), whereas systems programming aims to produce
software which provides services to the computer hardware (e.g. disk defragmenter). It requires a
greater degree of hardware awareness.

Q# 22- What are the operations of Operating System Functions?

The operating system provides for several other functions including:

 System tools (programs) used to monitor computer performance, debug

 Problems or maintain parts of the system.
 A set of libraries or functions which programs may use to perform specific tasks especially
relating to interfacing with computer system components.

Q# 23- What is the Architecture of operating system Draw the diagram?

Q# 24- What is the Operating system architecture?

The computer architecture of a computing system defines its attributes as seen by the programs that
are executed in that system, that is, the conceptual structure and functional behavior of the machine
hardware. Then, the computer architect defines the functions to be executed in the hardware and
the protocol to be used by the software in order to exploit such functions. Note that the architecture
has nothing to do with the organization of the data flow, the logical design, the physical design, and
the performance of any particular implementation in the hardware.

Hence By Architecture we mean the order in which certain hardware Processes are carried out by
the OS and has nothing to do with the logical software flow of the Computer. ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 10 | P a g e

An Operating System is responsible for the following functions

1. Device management using device drivers

2. Process management using processes and threads
3. Inter-process communication
4. Memory management
5. File systems In addition, all operating systems come with a set of standard utilities. The
utilities allow common tasks to be performed such as
6. being able to start and stop processes
7. being able to organize the set of available applications
8. organize files into sets such as directories
9. view files and sets of files
10. edit files
11. rename, copy, delete files
12. communicate between processes

Q# 25- What is Kernel?

1. The kernel of an operating system is the part responsible for all other operations. When a
computer boots up, it goes through some initialization functions, such as checking memory.
It then loads the kernel and switches control to it. The kernel then starts up all the processes
needed to communicate with the user and the rest of the environment (e.g. the LAN)
2. The kernel is always loaded into memory, and kernel functions always run, handling
processes, memory, files and devices.
3. The traditional structure of a kernel is a layered system, such as Unix. In this, all layers are
part of the kernel, and each layer can talk to only a few other layers. Application programs
and utilities live above the kernel.
4. The Unix kernel looks like

Q# 26- List the names of Linux/ Unix Operating Systems? ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 11 | P a g e

Q# 27- Design Principles

Linux is a multi-user, multitasking system with a full set of UNIX-compatible tools. Its file system
adheres to traditional UNIX semantics, and it fully implements the standard UNIX networking model.

Main design goals are speed, efficiency, and standardization.

Linux is designed to be compliant with the relevant POSIX documents; at least two Linux
distributions have achieved official POSIX certification.

The Linux programming interface adheres to the SVR4 UNIX semantics, rather than to BSD behavior.

Components of a Linux System

Like most UNIX implementations, Linux is composed of three main bodies of code; the most
important distinction between the kernel and all other components.

The kernel is responsible for maintaining the important abstractions of the operating system.

 Kernel code executes in kernel mode with full access to all the physical resources of
 All kernel code and data structures are kept in the same single address space.

The system libraries define a standard set of functions through which applications interact with the
kernel, and which implement much of the operating-system functionality that does not need the full
privileges of kernel code.

Q# 28- What is Login and logout Process? ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 12 | P a g e

When you sit down at a Linux computer in the computer science lab, you will see a log-in screen with
a space for you to fill in your user name. Do so, press return, and there will be a space for your
password. Enter your password, and press return again. Your user name should be the same as the
user name that you use on other campus systems such as the Windows network. A password for the
Linux system was assigned to you when your account was created. It is probably not the same as
your Windows password. You are free to change this password, if you want, as described below. If
you forget your password, you will have to ask the system administrator to assign you a new one.

It might take some time -- ten or fifteen seconds -- for the desktop to appear. Be patient. You should
always log out when you are finished with a computer in the Math/CS computer lab. In Gnome,
there is a "Log out" commands in the "System" menu at the top of the screen. After selecting the
command, you might have to click a button to confirm your choice.

(Syntax for logout): logout command - Logout of a login shell. This command can be used by
normal users to end their own session.

Q# 29- What is the Syntax for logging out?

If you are logged in as nixcraft user and just wanted to exit a login shell type the following
command or hit CTRL+D:

$ logout

Q# 30- How you can Change your System Password?

It's easy to change your password. Just log in as usual, open a command line window (konsole), and
enter the kpasswd command. (Note the spelling: kpasswd not kpassword.) You will be asked for
your old password, then for the new password. Finally, you will be asked to re-type the new
password to verify it. The computer will reject your password if it is shorter than 5 characters. A
good password should use a mixture of letters and symbols or of upper case and lower case letters.

Q# 31- How we can change the name of file and directory?

1. All file names are case sensitive. So filename abc.txt, Abc.txt and ABC.txt all are three different files.
2. You can use upper and lowercase letters, numbers, "." (dot), and "_" (underscore) symbols.
3. You can use other special characters such as blank space, but they are hard to use and it is better to
avoid them.
4. In short, filenames may contain any character except / (root directory), which is reserved as the
separator between files and directories in a pathname. You cannot use the null character.
5. Most modern Linux and UNIX limit filename to 255 characters (255 bytes). However, some older
version of UNIX system limits filenames to 14 characters only.
6. A filename must be unique inside its directory. For example, inside /home/vivek directory you cannot
create a demo.txt file and demo.txt directory name. However, other directory may have files with the
same names. For example, you can create demo.txt directory in /tmp. ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 13 | P a g e

Q# 32- What are the Reserved Characters & Words in Linux/ Unix?

Avoid using the following characters from appearing in file names:

1. /
2. >
3. <
4. |
5. :
6. &
Please note that Linux and UNIX allows white spaces, <, >, |, \, :, (, ), &, ; , as well as
wildcards such as ? and * to be quoted or escaped using \ symbol.

Q# 33- How Do I Delete Files?

Deleting Files

The rm command removes a file (assuming you have permission to do so) without even saying hasta la
vista. Be sure you really want to delete your files before you use rm, because once the files are gone, they're
not coming back. For example, $ rm wallet

Immediately deletes the file named wallet in the current directory without prompting. If you want to be
prompted before the deletion, use the -i flag. One other rm flag is -f, which translates roughly to "Don't ask me
any questions--just delete the files." While rm normally asks for confirmation before deleting a write-
protected file, the -f (force) flag overrides this prompt. Be careful with the rm command, since the multiuser
nature of Linux does not allow for undelete as in DOS. As soon as you let go of the space occupied by a file, the
operating system is likely to use it for something else.

Deleting Directories

If you created a directory named spelunking six months ago, and now you're not so keen on crawling through
slimy caves, the rmdir command may be able to help:

$ rmdir spelunking

This command removes the specified directory, but only if it's empty. If the directory contains files or
subdirectories, you'll have to delete them using rm first. One alternative to painstakingly removing all the
contents of a directory that you just want to make disappear is to use the rm -rcommand. The -r flag
gives rm license to kill directories, their files, and even their subdirectories. Be very sure you understand
what's about to happen before using a command like this:

$ rm -r spelunking

Q# 34- What is Logging out?

Use the command "logout" to exit a given session. If you have logged in, then typed "su" to become a
super user or another user, you may need to type "exit" until your SHLVL environment value is 1.
Then you can type "logout" to exit your session. The "exit" command will take you back to previous
shell levels. ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 14 | P a g e

Q# 35- How you can Shutting Down of Linux?

The system is intended to be shutdown by the system administrator using the shutdown
command in one of the forms shown below. Many systems are set up to capture the
<CTRL><ALT><DEL> keystroke combination to issue the shutdown command through the
init program. This will work on most systems if the root user is logged in. Examples of using
the shutdown command are shown below.

shutdown -h now
shutdown -r +10 "Rebooting in 10 minutes"
shutdown -r 13:0

Q# 36- What is System Administration?

A system administrator, or sysadmin, is a person who is responsible for the upkeep,

configuration, and reliable operation of computer systems; especially multi-user computers,
such as servers.

Q# 01- What are the system administration tasks?

1. Planning - cost, capacity planning, logistics (network design, server locations, where to
install, wiring, IP address assignments, ...), network service providers (ISPs)
2. Preparing - temperature, humidity, electrical, fire, security, EIA/TIA wiring closet and cabling
standards, UPS; Change management (preparing for any service changes)
3. Installing hardware - computers, terminals, disk drives, CD-ROMs, RAM, printers, NICs,
4. Maintaining - regular preventative maintenance (daily, weekly, ...), boot and shutdown
systems when needed, printers, backup media, tune systems for performance
5. Monitoring - printers, disk space, network, servers and workstations, performance, and
security, and all log files regularly
6. Installing/upgrading/removing software - OS (kernel patches, new device drivers, ...),
applications (new versions, DLLs, new configurations), documentation
7. Backups and archives
8. Trouble-shooting - network connections, services that don't start, faulty security, ...
9. Help and educate users - This includes working with your management (who sometimes
needs the most help and education even if they don't think so), helping new users,
experienced users, and yourself
10. Problem solving - System administration is about solving problems, not memorizing how-to
directions. Often something won't work as it should. What will you do then?

Q# 37- What are the Minimum Requirements for Linux/Unix?

1. 700 MHz processor (about Intel Celeron or better)

2. 512 MB RAM (system memory)
3. 5 GB of hard-drive space (or USB stick, memory card or external drive but see Live CD for an
alternative approach)
4. VGA capable of 1024x768 screen resolution
5. Either a CD/DVD drive or a USB port for the installer media
6. Internet access is helpful ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 15 | P a g e

Q# 38- What is Kernel and its functions?

We can define a Kernel is the main component of most computer operating systems. It provides
an interface between applications and actual data processing at the hardware level.

Kernal is the part of an operating system which is responsible for interacting directly with hardware
and does this by using your device drivers. think of the kernel as a manager managing and using the
processes between the other parts of the operating system and the hardware. it executes tasks to be
done and handles errors and access to your computer.

Kernel is considered as the Heart of an Operating System. Kernel provides the lowest-level
abstraction layer for the resources (especially processors and I/O devices) that application software
must control to perform its function. It makes these facilities available to applicaton
processes through Inter- Process Communication (IPC) mechanism and System Call.

Q# 39- What is vi Editor?

The default editor that comes with the UNIX operating system is called vi (visual editor). [Alternate
editors for UNIX environments include pico and emacs, a product of GNU.]

The UNIX vi editor is a full screen editor and has two modes of operation:

1. Command mode commands which cause action to be taken on the file, and
2. Insert mode in which entered text is inserted into the file.

Q# 40- What is vi Editor Commands?

There are many commands for VI Editor

1. General Startup 2. Deleting

3. Counts 4. Copying Code
5. Cursor Movement 6. Find Commands
7. Screen Movement 8. Put Command
9. Line Editor Mode 10. Substitutions
11. ex Commands 12. Write File
13. Reading Files 14. Moving
15. Inserting 16. Miscellaneous Commands
17. Shell Escape

Q# 41- What is General Startup?

To use vi: vi filename
To exit vi and save changes: ZZ or :wq
To enter vi command mode: [esc]
To exit vi without saving changes: :q!

Q# 42- Define the three modes of vi editor?

The vi editor can be a little difficult to learn, so I've been writing some vi tutorials here recently. One of the first things to
know about vi is that it typically functions in three different modes:
1. Command mode
2. Insert mode
3. Last line mode ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 16 | P a g e

Here's a quick description of each vi mode.

1) vi command mode
When you first start editing a file with the vi editor yoou will be in vi command mode. In this mode
you can issue many vi commands, including commands like insert, append, and delete, and other
search and navigation commands that let you move around your file.
2) vi insert mode
Once you issue a vi insert, append, or open command, you will be in vi insert mode. If you're working
with a modern vi implementation, your vi editor is typically configured to show the current mode of
operation, so when you go into insert mode, you'll see a text string like this on the last line of your vi
editor window:
3) vi last line mode
The last vi mode is known as vi last line mode. You can only get to last line mode from command
mode, and you get into last line mode by pressing the colon key, like this :

Q# 43- What is "The Shell"?

Simply put, the shell is a program that takes your commands from the keyboard and gives them
to the operating system to perform. In the old days, it was the only user interface available on a
Unix computer. Nowadays, we have graphical user interfaces (GUIs) in addition to command line
interfaces (CLIs) such as the shell.
On most Linux systems a program called bash (which stands for Bourne Again SHell, an
enhanced version of the original Bourne shell program, sh, written by Steve Bourne) acts as the
shell program.
Q# 44- What are the Functions of the shell?
As programs get longer and more complex, they become more difficult to design, code, and
maintain. As with any large program, it is often useful to break a single, large task into a
number of smaller tasks.
To get familiar with this idea, let's consider the description of an everyday task -- going to
the market to buy food. Imagine that we were going to describe the task to a man from
Our first top-level description might look like this:
 Leave house
 Drive to market
 Park car
 Enter market
 Purchase food
 Drive home
 Park car
 Enter house

This description covers the overall process of going to the market; however a man from Mars will
probably require additional detail. For example, the "Park car" sub task could be described as

1. Find parking space

2. Drive car into space
3. Turn off motor
4. Set parking brake
5. Exit car
6. Lock car ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 17 | P a g e

Of course the task "Turn off motor" has a number of steps such as "turn off ignition" and "remove
key from ignition switch," and so on.

This process of identifying the top-level steps and developing increasingly detailed views of those
steps is called top-down design. This technique allows you to break large complex tasks into many
small, simple tasks.

As our script continues to grow, we will use top down design to help us plan and code our script. If
we look at our script's top-level tasks, we find the following list:

1. Open page
2. Open head section
3. Write title
4. Close head section
5. Open body section
6. Write title
7. Write time stamp
8. Close body section
9. Close page

All of these tasks are implemented, but we want to add more. Let's insert some additional tasks after
task 7:

7. Write time stamp

8. Write system release info
9. Write up-time
10. Write drive space
11. Write home space
12. Close body section
13. Close page

Q# 45- What is the Bourne shell?

The Bourne shell (sh) is a shell, or command-line interpreter, for computer operating systems.
The Bourne shell was the default Unix shell of Unix Version 7.

Q# 46- How to Invoke Correctly Linux(ubuntu) Commands ?

Whether you’re a new Linux user or you’ve been using Linux for a while, we’ll help you get started
with the terminal. The terminal isn’t something you should be scared of – it’s a powerful tool with
lots of uses.
Q#47- What is Basic Terminal Usage?
Launch a terminal from your desktop’s application menu and you will see the bash shell.
There are other shells, but most Linux distributions use bash by default. ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 18 | P a g e

You can launch a program by typing its name at the prompt. Everything you launch here
– from graphical applications like Firefox to command-line utilities – is a program. (Bash
actually has a few built-in commands for basic file management and such, but those
function like programs, too.) Unlike on Windows, you don’t have to type the full path to a
program to launch it. For example, let’s say you wanted to open Firefox. On Windows,
you’d need to type the full path to Firefox’s .exe file. On Linux, you can just type:

Press Enter after typing a command to run it. Note that you don’t need to add an .exe or
anything like that – programs don’t have file extensions on Linux.

Q# 48- What is Use of Linux(Ubuntu) Commands to manipulate files and


Folder/Directory Permissions

Directories have directory permissions. The directory permissions restrict different actions
than with files or device nodes.
Permission Action chmod option
Read (view contents, i.e. ls command) r or 4

Write (create or remove files from dir) w or 2

Execute (cd into directory) x or 1

 read restricts or allows viewing the directories contents, i.e. ls command

 write restricts or allows creating new files or deleting files in the directory.
(Caution: write access for a directory allows deleting of files in the directory even if
the user does not have write permissions for the file!) ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 19 | P a g e

 execute restricts or allows changing into the directory, i.e. cd command

What the permissions mean

The first three letters, after the first - or d, are the permissions the owner has. The next three letters
are permissions that apply to the group. The final three letters are the permissions that apply to
everyone else. Each set of three letters is made up of r w and x. r is always in the first position, w is
always in the second position, and x is always in the third position. r is the read permission, wis the
write permission, and x is the execute permission. If there is a hyphen (-) in the place of one of these
letters it means the permission is not granted, and if the letter is present then it is granted.
In case of folders the mode bits can be interpreted as follows:
 r (read) stands for the ability to read the table of contents of the given directory,
 w (write) stands for the ability to write the table of contents of the given directory (create new files,
folders; rename, delete existing files, folders) if and only if execute bit is set. Otherwise this
permission is meaningless.
 x (execute) stands for the ability to enter the given directory with command cd and access files,
folders in that directory.

Q# 49- How we can correctly use the Linux (Ubuntu) Commands to search and
view the content?
Here are a few ways to use find
$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'
The 1st command would find files having the letters index as the beginning of the file name.
The search would be started in the directory /home/david and carry on within that directory
and its subdirectories only.
The 2nd command would search for the same, but the case of the filename wouldn't be
considered. So all files starting with any combination of letters in upper and lower case such
as INDEX or indEX or index would be returned.

$ find -name met*

The above command would start searching for the files that begin with the letters 'met'
within the current directory and the directories that are present within the current
directory. Since the directory is not specified as the second parameter, Linux defaults to
using the current directory as the one to start the search in.
Q# 01- What is meant by Printing a File Using Linux(Ubuntu) Commands?
By far, the most simplistic way to print in the Linux operating system is to send the file to be
printed directly to the printing device. One way to do this is to use the cat command. As
the root user, one could do something like
# cat thesis.txt > /dev/lp
In this case, /dev/lp is a symbolic link to the actual printing device---be it a dot-matrix, laser
printer or plotter.
The lpd, the line printing daemon(a background process). The line printing daemon then
tells the printer how to print the file.
When lpr is executed, it first copies the specified file to a certain directory (the spool
directory) where the file remains until lpd prints it. Once lpd is told that there is a file to
print, it will copy of itself (what we programmers call forking). This copy will print our file
while the original copy waits for more requests. This allows for multiple jobs to be queued
at once.
The syntax of lpr(1) is a very familiar one, ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 20 | P a g e

$ lpr [ options ] [ filename ... ]

If filename is not specified, lpr expects input to come from standard input (usually the
keyboard, or another program's output). This enables the user to redirect a command's
output to the print spooler. As such,
$ cat thesis.txt | lpr
Q# 50- What is Print files Using Linux (ubuntu) Scheduling Commands?
The command you use to schedule one-shot jobs is called “at”. The way to schedule
repeating jobs is through a “crontab” (which is a portmanteau word made from CRON
TABle, similar to INITtialization TABle and other *nix-y portmanteau words). Oddly enough,
the command used to view, edit and store crontabs is called “crontab”.
Unlike some of the other dæmons we have covered in this series, these two have interactive
user programs that control them. Because of this, we will cover the basics of using these
two dæmons as a non-privileged user (I hope you aren't logging in to your Linux system as
root!), then we will go over the dæmons and how they work, then we will cover some fine
points of “non-user” or system-scheduled jobs, and finally some of the little “gotchas” that
sometimes cause commands to behave differently than you expect when you run them
through a scheduler.
Using at
The at command is used to schedule one or more programs for a single execution at some
later time. There are actually four client commands:
at: Runs commands at specified time
atq: Lists pending commands
atrm: Cancels pending jobs
batch: Runs commands when system load permits
The Linux at command accepts a number of time specifications, considerably extending the
POSIX.2 standard.
Linux Filesystem Hierarchy
This will provide a brief introduction to the Linux File system Hierarchy
Q# 51- Where is Program Files?
Linux has no single location for most of its executable (think \*.exe) files. Instead, these files
may be located in one of multiple, mostly pre-determined, locations. Most notably:
/bin contains non-administrator executable files necessary for system booting.
/sbin contains administrator executable files necessary for system booting.
/usr/bin contains non-administrator executable files not necessary for system booting.
/usr/sbin contains administrator executable files not necessary for system booting.,
Specifically, the directories that will be searched consist of a colon-separated list of
directories in the PATH environment variable. To see this environemnt variable, type:
echo $PATH
On my system, this gives:
Examples of paths are
Q# 52- Where is my Trash Bin? ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 21 | P a g e

The Trash Bin is not a directory belonging to the filesystem hierarchy itself; instead,
the Trash Bin is most often implemented by the desktop environment and its window
manager. You cannot rely on there being a Trash Bin on all installations of Linux.
Q# 53- Where are my configuration files?
Most user-specific configuration files are stored in "hidden" text files known as dot files. Dot
files are files whose names are prefixed with a dot (.), and are often located in the user's
home directory; having their name prefixed with a dot keeps them hidden from normal ls
commands; for example, running ls on my machine shows:

The include directory contains header files for use in the programming languages "C" and
"C++". If you are not programming in either of these languages, then you will likely not have
to worry about this directory. The directory is usually located in /usr and /usr/local, but
not /.
The lib directory contains files which provide common functionality to multiple programs,
usually in the form of architecture-dependent binary data. The "lib" stands for "library".
The share directory contains data that is "architecture-independent"; this means that the
directory contains data that may be shared by multiple computers with different
architectures that are running the same distribution of Linux. Note that data under this
directory is likely not shareable between multiple distributions (such as Ubuntu, Fedora, and
Specific directories.
These are specific directories with the Linux filesystem that are noteworthy.
Contains files essential for booting the Linux kernel. This usually includes the kernel itself,
the initramfs, and files.
This directory contains device files (note: "device", not "developer"). Device files may be
thought of as "raw" interfaces to hardware devices. Several common and important device
files are:
An optional directory that contains each user's individual data
Most removable storage devices, such as USB sticks and SD cards, are mounted in here in a
The equivalent of a /home/root directory for the administrative user
Process that contains information that has accumulated since system boot. Generally not
A Linux virtual filesystem which exports kernel object information to userspace. This usually
consists of hardware, module, and driver information. It is usually fairly difficult to decipher, ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 22 | P a g e

though fun to look around; to make sense of it, you'll have to scrounge up the appropriate


Directory for programs that require temporary files. The contents of this are generally not of
concern to the user.


Contains data that varies over time. This usually includes things such as kernel boot logs,
useful if the system crashed but is now working again. Internal system mail is also often
stored within this directory. This directory is sometimes worth checking if the file system has
run out of space; copious amounts of kernel debugging via a poorly-written rogue driver can
sometimes fill up smaller file systems.

Q# 54- What is the attribute associated with a process?

CurrentDate, HomeDirectory, ParentProcessID, ProcessID, ProcessInitiator, ProcessName,

ProcessTemplet, Session, TaskID, TaskName.

An A-Z Index of the Bash command line for Linux.
alias Create an alias •
apropos Search Help manual pages (man -k)
apt-get Search for and install software packages (Debian/Ubuntu)
aptitude Search for and install software packages (Debian/Ubuntu)
aspell Spell Checker
awk Find and Replace text, database sort/validate/index
basename Strip directory and suffix from filenames
bash GNU Bourne-Again SHell
bc Arbitrary precision calculator language
bg Send to background
break Exit from a loop •
builtin Run a shell builtin
bzip2 Compress or decompress named file(s)
cal Display a calendar
case Conditionally perform a command
cat Concatenate and print (display) the content of files
cd Change Directory
cfdisk Partition table manipulator for Linux
chgrp Change group ownership
chmod Change access permissions
chown Change file owner and group
chroot Run a command with a different root directory
chkconfig System services (runlevel) ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 23 | P a g e

cksum Print CRC checksum and byte counts

clear Clear terminal screen
cmp Compare two files
comm Compare two sorted files line by line
command Run a command - ignoring shell functions •
continue Resume the next iteration of a loop •
cp Copy one or more files to another location
cron Daemon to execute scheduled commands
crontab Schedule a command to run at a later time
csplit Split a file into context-determined pieces
cut Divide a file into several parts

date Display or change the date & time
dc Desk Calculator
dd Convert and copy a file, write disk headers, boot records
ddrescue Data recovery tool
declare Declare variables and give them attributes •
df Display free disk space
diff Display the differences between two files
diff3 Show differences among three files
dig DNS lookup
dir Briefly list directory contents
dircolors Colour setup for `ls'
dirname Convert a full pathname to just a path
dirs Display list of remembered directories
dmesg Print kernel & driver messages
du Estimate file space usage
echo Display message on screen •
egrep Search file(s) for lines that match an extended
eject Eject removable media
enable Enable and disable builtin shell commands •
env Environment variables
ethtool Ethernet card settings
eval Evaluate several commands/arguments
exec Execute a command
exit Exit the shell
expect Automate arbitrary applications accessed over a terminal
expand Convert tabs to spaces
export Set an environment variable
expr Evaluate expressions
false Do nothing, unsuccessfully
fdformat Low-level format a floppy disk
fdisk Partition table manipulator for Linux
fg Send job to foreground
fgrep Search file(s) for lines that match a fixed string
file Determine file type
find Search for files that meet a desired criteria
fmt Reformat paragraph text
fold Wrap text to fit a specified width.
for Expand words, and execute commands
format Format disks or tapes
free Display memory usage ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 24 | P a g e

fsck File system consistency check and repair

ftp File Transfer Protocol
function Define Function Macros
fuser Identify/kill the process that is accessing a file
gawk Find and Replace text within file(s)
getopts Parse positional parameters
grep Search file(s) for lines that match a given pattern
groupadd Add a user security group
groupdel Delete a group
groupmod Modify a group
groups Print group names a user is in
gzip Compress or decompress named file(s)
hash Remember the full pathname of a name argument
head Output the first part of file(s)
help Display help for a built-in command •
history Command History
hostname Print or set system name
iconv Convert the character set of a file
id Print user and group id's
if Conditionally perform a command
ifconfig Configure a network interface
ifdown Stop a network interface
ifup Start a network interface up
import Capture an X server screen and save the image to file
install Copy files and set attributes
jobs List active jobs •
join Join lines on a common field
kill Stop a process from running
killall Kill processes by name
less Display output one screen at a time
let Perform arithmetic on shell variables •
link Create a link to a file
ln Create a symbolic link to a file
local Create variables •
locate Find files
logname Print current login name
logout Exit a login shell •
look Display lines beginning with a given string
lpc Line printer control program
lpr Off line print
lprint Print a file
lprintd Abort a print job
lprintq List the print queue
lprm Remove jobs from the print queue
ls List information about file(s)
lsof List open files
make Recompile a group of programs
man Help manual
mkdir Create new folder(s) ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 25 | P a g e

mkfifo Make FIFOs (named pipes)

mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem
mknod Make block or character special files
more Display output one screen at a time
most Browse or page through a text file
mount Mount a file system
mtools Manipulate MS-DOS files
mtr Network diagnostics (traceroute/ping)
mv Move or rename files or directories
mmv Mass Move and rename (files)
netstat Networking information
nice Set the priority of a command or job
nl Number lines and write files
nohup Run a command immune to hangups
notify-send Send desktop notifications
nslookup Query Internet name servers interactively
open Open a file in its default application
op Operator access
passwd Modify a user password
paste Merge lines of files
pathchk Check file name portability
ping Test a network connection
pkill Stop processes from running
popd Restore the previous value of the current directory
pr Prepare files for printing
printcap Printer capability database
printenv Print environment variables
printf Format and print data •
ps Process status
pushd Save and then change the current directory
pv Monitor the progress of data through a pipe
pwd Print Working Directory
quota Display disk usage and limits
quotacheck Scan a file system for disk usage
quotactl Set disk quotas
ram ram disk device
rcp Copy files between two machines
read Read a line from standard input •
readarray Read from stdin into an array variable •
readonly Mark variables/functions as readonly
reboot Reboot the system
rename Rename files
renice Alter priority of running processes
remsync Synchronize remote files via email
return Exit a shell function
rev Reverse lines of a file
rm Remove files
rmdir Remove folder(s)
rsync Remote file copy (Synchronize file trees)
screen Multiplex terminal, run remote shells via ssh ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 26 | P a g e

scp Secure copy (remote file copy)

sdiff Merge two files interactively
sed Stream Editor
select Accept keyboard input
seq Print numeric sequences
set Manipulate shell variables and functions
sftp Secure File Transfer Program
shift Shift positional parameters
shopt Shell Options
shutdown Shutdown or restart linux
sleep Delay for a specified time
slocate Find files
sort Sort text files
source Run commands from a file '.'
split Split a file into fixed-size pieces
ssh Secure Shell client (remote login program)
stat Display file or file system status
strace Trace system calls and signals
su Substitute user identity
sudo Execute a command as another user
sum Print a checksum for a file
suspend Suspend execution of this shell •
sync Synchronize data on disk with memory
tail Output the last part of file
tar Store, list or extract files in an archive
tee Redirect output to multiple files
test Evaluate a conditional expression
time Measure Program running time
timeout Run a command with a time limit
times User and system times
touch Change file timestamps
top List processes running on the system
traceroute Trace Route to Host
trap Run a command when a signal is set(bourne)
tr Translate, squeeze, and/or delete characters
true Do nothing, successfully
tsort Topological sort
tty Print filename of terminal on stdin
type Describe a command •
ulimit Limit user resources •
umask Users file creation mask
umount Unmount a device
unalias Remove an alias •
uname Print system information
unexpand Convert spaces to tabs
uniq Uniquify files
units Convert units from one scale to another
unset Remove variable or function names
unshar Unpack shell archive scripts
until Execute commands (until error)
uptime Show uptime
useradd Create new user account
userdel Delete a user account
usermod Modify user account ABBAS COLLEGE OF TECHNOLOGY 03404088566

CIT-323, CIT-333 M SHUMRAIZ SHARIF 27 | P a g e

users List users currently logged in

uuencode Encode a binary file
uudecode Decode a file created by uuencode
v Verbosely list directory contents (`ls -l -b')
vdir Verbosely list directory contents (`ls -l -b')
vi Text Editor
vmstat Report virtual memory statistics
wait Wait for a process to complete •
watch Execute/display a program periodically
wc Print byte, word, and line counts
whereis Search the user's $path, man pages and source files for a
which Search the user's $path for a program file
while Execute commands
who Print all usernames currently logged in
whoami Print the current user id and name (`id -un')
wget Retrieve web pages or files via HTTP, HTTPS or FTP
write Send a message to another user
xargs Execute utility, passing constructed argument list(s)
xdg-open Open a file or URL in the user's preferred application.
yes Print a string until interrupted
zip Package and compress (archive) files.
. Run a command script in the current shell
!! Run the last command again
### Comment / Remark


Installation of Ubuntu and Red Hat ….

Visit on WIKIHOW and search that, how to install Ubuntu, Linux/Unix.

13-B Lake Road Lahore. ABBAS COLLEGE OF TECHNOLOGY 03404088566