SlideShare a Scribd company logo
1 of 96
PRACTICAL
:-1
Aim:-Write a
Program to Study
Windows
Operating System:
Windows 8
Windows 8 is a
completely redesigned
operating system
developed from the
ground up with
touchscreen use in
mind as well as near
instant-on capabilities
that enable a Windows
8 PC to load and start
up in a matter of
seconds rather than in
minutes.
Windows 8
Vocabulary
 Apps - "App"
is another word
for program. In
Windows 8 ,
some apps
come built-in
to Windows,
and there are
even more
available in the
Windows
Store.
 Live Tiles –
Interactive
apps that take
advantage of
Internet access
to provide real-time updates.
 Hot Corners - The corners on your screen are hot corners and
give you access to different Windows features.
 Charms Bar - Contains a set of buttons and commands that
control the application you are currently using, as well as provide
options for system settings. The Charms bar includes many of the
features previously available from the Start button.
 Metro-style - New layout of Windows 8 with tiles and apps
instead of the standard desktop with a Start button.
 Mobile - Windows 8 is designed for mobile devices, such as
tablets. You can also sign into your Windows 8 screen anywhere
using your Live ID, and your customized settings travel with
you.
 Touch-centric – Touch is a key element in Windows 8; however,
a traditional mouse and keyboard can be used as well.
 Speed Bump - The small gap between groups of tiles. Speed
bumps can be added to create new groups.
Where Do I Find:
 Shut down - Move your mouse to the upper right corner of the
screen, and move your mouse down until you see your charms
appear. Click Settings. Then click Power, and Shut Down.
 Desktop - When you log into Windows 8, you will be taken to
the Metro Start Screen. There you will see various apps. Click on
the app labeled Desktop.
 Run Command - You can get to Run a few ways. First, you can
right-click anywhere on the start screen that isn’t an app and
click All Apps on the bottom toolbar. Scroll over until you find
 Run. You can also move your mouse to the upper right corner of
the screen, move your mouse pointer down, and then click
Search. Enter ‘Run’ in the search box, click Apps, and then click
Run. The easiest way to get to Run is to press the Windows key
+ R.
 Control Panel - Move your mouse to the upper right corner of the
screen, move the mouse pointer down, and then click Search.
Enter Control Panel in the search box, click Apps, and then click
Control Panel.
Features:
Touch Screen
The Windows 8 interface is designed to be used with touchscreens, as
well as with a mouse and keyboard. This new interface is intuitive on a
tablet, but not so much
on a desktop computer.
When using Windows
8 on a touchscreen,
you can simply use
your finger or a stylus
to navigate through the
different features. You
will scroll to the
left/right, not up/down.
New Start Screen
Windows 8 comes
with a Start screen, not
a Start button. Your
apps appear on your
start screen when you
log in.
Apps (such as weather,
time, email, and news)
display real time info.
You can also rearrange
your apps and make
apps larger or smaller.
Right-click on an app. A toolbar will appear at the bottom for you to
make app smaller, larger, or delete it from Start screen.
If you want to add a new app to the Start screen, you first need to find it.
This can be done by using the Metro Search to look for the app or
program that you would like to add. To search, simply start typing the
name of the app or program that you would like to find.
To add the app to the Start screen, right-click on it with your mouse or
hold your finger on it till it becomes checked. You will then see a panel
open at the bottom of the Windows 8 Start screen where you can pin it.
Just click on the Pin button and the program will now appear on your
Windows 8 Start screen. To view all apps, right-click on the background
(not on an app). A toolbar will appear on the bottom. Click All Apps in
the bottom right corner.
All the apps will
appear on a grid. You
can scroll to the right
to view all of them.
Opening/Switching/C
losing Apps
To open an app, just
click on the app you
wish to use.
To switch between
open apps, move your
mouse to the upper left
corner and move
mouse pointer down
the left side. A bar will
appear showing the
apps you have open.
Click on the app you
wish to go to.
You can also move your mouse to the bottom left corner to go back to
your previous app.
To close apps, click the top of the app and drag it to the bottom of the
screen. You can also go to the upper left corner and make all open apps
appear, right click on the app you want to close.
Click Close.
Apps designed for Windows 8 do not have a File menu, Close,
Minimize, or Resize buttons.
Instead app commands are available at the bottom of the window when
you swipe up or down from either edge or by right-clicking.
Live Apps
Windows 8 offers Live Apps, providing you with real time weather,
news, mail, sports etc.
Just right-click on the live tile and you will get the option to turn on or
off the live tile update
Feature.
Swipe at the top/bottom of screen or right-click to make the App bar
appear with additional options. You can pin an app to the left or right
side of the screen by pressing the Windows key +. (period) or by
dragging the top of the tile to the left or right.
Personalize
In Windows 8, you can easily organize apps.
To put apps into a group, select an app and drag it into an empty space
where you want to create a group. Once the vertical bar is displayed in
the middle, release the app and it will automatically create a new group.
To name your group,
click the Zoom out
icon in the lower right
corner next to the
scroll bar.
Once you are in the
zoomed out view, you
will be able to drag
around your groups
and also name them.
While zoomed out,
right-click on the
group and select Name
Group to set a name.
Click the Zoom button
again to return to
normal view.
Desktop
In Windows 8, you
also still have a
desktop. The desktop
is available for file
management and
legacy programs.
Your Desktop will
appear when you run
desktop-based
applications (from the
Start screen).
You can also choose
Desktop from the apps
on the Start screen.
Navigation
In Windows 8, you can scroll across the screen by simply placing your
mouse on the edge of the screen.
Windows 8 also boasts hot corners, which activate different features.
 The top and bottom right side of the page brings up the Charm
bar.
 The upper left corner previews open apps; dragging from the
left-side does as well.
 The bottom left corner takes you to previous apps in use or the
Start screen.
 By clicking on the left side of the screen, you can switch across
apps.
 The hot corners apply on the Desktop, as well.
To get back to the Start screen from anywhere on your computer, you
can simply press the
Windows button on
your keyboard.
Restart/Shut
Down/Sleep
In Windows 8, there's
really no need to shut
down your PC
completely. Instead,
you can put it to sleep.
This uses very little
power, your PC starts
up faster, and you are
instantly back to where
you left off. You don’t
have to worry that
your battery will be
drained because
Windows
automatically saves all
your work and turns
off the PC if the
battery is too low. To
restart, shut down, or
hibernate in Windows
8, put your mouse
cursor into the upper
right corner to bring up
your Charms bar.
Click on the Settings
charm and a sidebar
will appear on the right
side of screen. There
you can click on the
Power button to select
the desired option.
Charms Bar
The Charms bar provides quick access to a variety of features and
utilities. A clock with battery charge status will appear when you
activate the Charms bar. Along the right screen, you will see: Search,
Share, Start, Devices, and Settings
2
 Search - With the Search charm, you can search for anything.
You can search just the app you are in (finding a specific
message in Mail), search another app (looking something up on
the Internet), or search your entire PC (for an app, setting, or
file).
 Share - When you are in a specific app, you can use the Share
charm to share files, photos, or webpages with people you know.
Select the item you want to share, open the charms, and then tap
or click Share.
 Start - You can always get back to the Start screen by using the
Start charm. Open the charms and then tap or click Start. If you
are already on Start, you can use this charm to get back to the last
app you used.
 Devices - You
will mainly use
the Devices
charm to set up
printers and
print
documents, but
you can also
use it to sync
info with your
phone and
stream video to
your wireless
TV. Open the
charms and
then tap or
click Devices
to see all the
devices
connected to
your PC at any
time.
 Settings - You
can use the
Settings charm
to personalize
your PC by
changing
things like your
account picture
and the
background
and color of
your Start
screen. If you
are in an app,
you can use the
Settings charm to get to the settings for that specific app. There
are also some common settings, like volume and brightness, that
you can get to quickly. For more settings and ways to personalize
your PC, open the Settings charm and then tap or click Change
PC settings.
No Search
You won’t find a search button in Windows 8. Instead, start typing
anywhere and a search box will appear and give you results.
You can search within an app by choosing the app in the search pane.
File Explorer
File Explorer is where
you can access all the
content you have
stored on your
computer, and
manipulate it. You can
copy it, move it,
rename it, delete it,
and so on.
You can open File
Explorer a few
different ways:
 Entering File
Explorer in the
search box
 Clicking Apps,
and then
Clicking File
Explorer
 Opening the
Desktop app,
and opening
File Explorer
on the bottom
toolbar
File Explorer has a
new feature called the
Ribbon. Use the
Ribbon for common
tasks, such as copying
and moving, creating
new folders, emailing
and zipping items, and
changing the view. If
you don’t like the
ribbon, you have the
option to hide it. Click
the arrow on the far
right side of the menu
bar to hide the ribbon.
Access your Windows from Anywhere
Log in on any Windows 8 PC with your Live ID, and get your own
personalized settings. When you buy a Windows 8 PC and set up your
user account for the first time, you can optionally choose to create an
account that is associated to a Windows Live ID. You can either use an
existing ID or create a new one. If you choose to create a new one, you
can use any email address you want as your new ID, and then create
your unique password. For example, you can use example@live.com or
you can use someone@example.com. You just need to identify an email
address that you want to have associated with the Windows Live ID
service, and provide a unique password. Of course, you can also
continue to use local Windows accounts as you always have and
obviously, domain-administered accounts work as they always have as
well.
Remote Desktop
With Remote Desktop Connection, you can sit at a PC and connect to
another PC in a different location (the remote PC). For example, you can
connect to your work PC from your home PC and use all of your apps,
files, and network resources as if you were sitting right in front of your
work PC. You can leave apps open at work and then see those same apps
on your home PC. To connect to a remote computer, that computer must
be turned on, it must have a network connection, Remote Desktop must
be enabled, you must have network access to the remote computer (this
could be through the Internet), and you must have permission to connect.
Click on the Desktop app on your Start screen.
Open Remote Desktop
Connection by clicking
the Search charm. In
the search box, type
Remote Desktop
Connection, and then,
in the list of results,
click Remote Desktop
Connection. In the
Computer box, type
the name of the
computer that you
want to connect to, and
then click Connect.
(You can also type the
IP address instead of
the computer name.)
Internet Explorer 10
With Internet Explorer
10 you might notice
something different
about the web—it’s
bigger, bolder, and
optimized for touch.
Tabs, buttons, and
toolbars are now easily
accessible when you
need them, but quietly
get out of the way
when you don't. By
learning a few simple
actions, you'll be able
to comfortably use your new browser.
 Adobe Flash Integration - Internet Explorer 10 includes a built-
in Adobe Flash Player. In the App version of IE10, only some of
the features of Adobe Flash will be included due to battery life,
performance, and security purposes.
 Flip Ahead - Allows you to quickly advance to the next page in
a website with a swipe gesture on touchscreen devices or a
forward button using a mouse.
 User Interface - The desktop version of Internet Explorer 10
(available for Windows 7 and Windows 8) retains the user
interface of Internet Explorer 9 with minor refinements, such as
removing gradients. The Metro version of Internet Explorer 10
(available on Windows 8) includes a new UI, most of which is
hidden so that the webpage being viewed takes up the entire
screen.
Cloud Sync
Now you can configure your Windows Live account and us to login to
the device. Windows also allows you to keep your settings synced to
cloud through your live account. If you are on the move and use multiple
PCs or you have multiple devices running Windows 8, cloud sync will
be really helpful. Google chrome allowed to sync only the browser
settings such as bookmarks, themes etc. to cloud; now Windows 8
enables syncing all the OS settings such as test bar settings, app settings
themes etc. This feature is termed as Roaming Profile, and it makes use
of your Windows live account.
Ribbon Interface
Ribbon interface which was introduced with MS Office 2007 was used
on applications such as Paintbrush on Windows 7. Now even Windows
Explorer gets the ribbon interface. They are planning to make the ribbon
interface a standard across all the applications that ship with the OS.
Windows 8 Ribbon
What is New in
Windows 8.1
1. Support for new
device types
Windows 8.1 has the
same device
requirements as
Windows 8 and will
run on most PC
hardware that was
originally designed for
windows vista or
windows 7. That
makes it possible to
evaluate Windows 8.1
on a device that is not
currently in
production. Thus, to
see Windows 8.1 at its
best, you really need to
see it in action on a
variety of devices,
including modern
hardware with
touchscreen and
processors and power management subsystems engineering specially to
work with Windows 8.1. However, the core design principles of
windows 8.1 allows movement to pervasive computing. Users are no
longer tied to a desktop but instead can use multiple devices, choosing
each device for its suitability to the task at hand. With proper
management controls, these devices can switch easily between personal
files, digital media and enterprise resources and however combined with
robust online services.
2. User Experience
This new generation of hardware benefits greatly from the Windows 8
user experience. Touchscreen functions as the primary form of input on
a mobile devices; on more traditional PC from factors, touch becomes an
equal partner to the keyboard and mouse. Here is a partial list of
important changes in the windows 8.1 user experience:
a. Two new tile sizes on the start screen are available
in addition to the two sizes used in windows 8.
b. Customizing the start screen is much easier and new
Apps view let you quickly sort and arrange the list
installed Apps.
c. Enhancements to the Touch Keyboard make it
possible to type fasters and more accurately.
3. User Account and Synchronization
One of the most significant changes in Windows 8 is support for a third
user account type in addition to the familiar local and domain accounts.
Signing in with a Microsoft account instead of a local account provides
tightly integrated support for cloud-based files storage (worth 7GBs of
free SkyDrive storage).
Windows 8.1 expands the list of settings that can be synchronized,
including the layout of the start screen, and it can automatically
download and install windows store apps when you sign in with a
Microsoft account on a new devices. It also adds the ability to
automatically back up settings that cannot be synced. This feature makes
it possible to roam easily between devices, with personal settings, apps,
and browser tabs, history and favorites from each derives.
4. Support for Apps
Windows 8 includes support for virtually all desktop programs that are
compatible with Windows 7. It also supports a new programming model
design for immersive touch enable apps that are secure, reliable and
optimized for mobility. For Windows 8.1, the windows store has been
completely redesigned,
with the goal of
making it easier to
discover useful apps.
Windows 8.1 also
includes a handful of
new first party
(Microsoft authored)
apps as well as a
complete refresh of the
apps included with a
default installation of
windows 8.
5. Security
enhancements.
Microsoft’s
commitment to
securing Windows is
substantial, and it
includes some ground
breaking advanced
features. As part of the
ongoing effort to make
computing safer,
windows introduced
major new security
features and windows
8.1 adds still more
improvement. Perhaps,
aside from the major
security features
introduced by
Windows 8 such as
Trusted boot (the
feature that protects
the integrity of the
remainder of the boot
process, including
kernel, system files,
boot-critical drivers
etc.), Windows
Defender (a full
feature antispyware),
for the first time in
Windows 8.1.
Defender includes network behavior monitor; Windows Smart Screen
(is a safety feature that uses application reputation based tech to help
protect windows users from malicious software that require users’
names, password and billing data ).
Notwithstanding, Windows 8.1 adds significant new security capabilities
to that already robust features of Window 8, let us take a look:
a. Improved Biometric feature: All windows 8.1.
Editions end to end biometric feature enable
authenticating with your biometric identity anywhere in
Windows including Windows sign-in, remote access, user
account control and so on. Windows 8.1 is optimized for
fingerprint based biometrics and includes a common
fingerprint enrollment experience that works with various
touch-based readers.
b. Remote Business data Removal (RBDR): Here,
administrator can mark and encrypt corporate content to
distinguish it from ordinary user data. When the
relationship between the organization and the user ends,
the encrypted corporate data can be wiped on command
using exchange ActiveSync.
c. Pervasive Device Encryption: Device encryption is
now available in all editions of windows 8.1 it is enabled
out of the box and can be configured with additional
BitLocker protection and management capability on the
Pro and Enterprises edition.
6. Deployment and migration:
Windows 8.1 in an organization is faster and easier than in windows 7.
Enhanced tools help you make the right decisions with minimal
downtime for users. A new version of the application compatibility
toolkit helps you understand potential application compatibility issues
by identifying which apps are or not compatible with windows 8. In
those days, migrating user data from windows installations can be
automated with the user state migration tool.
7. AppLocker:
Now available in Windows 8.1, this tool is a simple and flexible
mechanism that allows you to specify exactly which apps are allowed to
run on user’s PC. Here, an administrator creates security policies
through group policy that prevent apps from running unless they are on
an approval list.
8. Virtualization
Window 8 is the first
desktop version of
windows to include a
robust built in
virtualization platform
known as Hyper-V.
Client Hyper-V uses
the same hypervisor
found in Windows
server allowing user to
create virtual machines
capable of running 32
bit and 64 bit version
of windows. With the
advent of Windows
8.1, VMs can be
migrated easily
between a desktop PC
running Windows 8 or
8.1 and a Hyper-V
environment on
windows server.
Finally, numerous
features are integrated
in the Windows 81.
Which I have not
mentioned, not
because they are less
important but because
the features mentioned
above are the major
features and most
obvious. However, we
can say in a nutshell
that other features such
as Workplace join,
work folders, open
MDM, Mobile device
management, Web
application proxy,
RDS enhancements,
NFC Tap-to-pair
printing, Wi-Fi direct
printing, Native
Miracast wireless
display, Auto triggered
VPN, broadband tethering and many others exist in the windows 8.1.
9. Fast Booting
Windows boasts of its fast booting ability. Here is a demo shared by
Microsoft recently which proves it.
10. Performance Boost
Performance of the OS was considered as primary criteria while
developing the OS. In fact, Windows 8 has better performance than
Windows 7. The OS makes optimum use of multi-core processors and
virtualization to provide best performance. You might have noticed that
earlier OSes were not optimized for multi-core processors, if a resource
hungry application starts, it used to run on only one core instead of
utilizing all the available cores. Applications start faster and take less
time to be ready for you to use. The test manager has been redesigned to
enable easy access to basic functions and advanced functions. You can
even do start-up settings through task manager instead of going to
msconfig.
Hardware Requirements
Microsoft has been raising the hardware requirements bar since its first
version of windows OS. This is the first version of windows which runs
on the same hardware requirements as that of Windows 7 and to some
extent lesser. For example Microsoft quoted that Windows 8 can run on
an Intel Atom based device with 1GB RAM and will run better than
Windows 7. That is really nice because one need not dump an old netpad
just to upgrade the OS. As of now there is no official citation of the
minimum hardware requirements; we will have to wait and see.
TECHNICAL
SPECIFICATIONS
FOR WINDOWS 8.1
As far as technical
specifications for
windows 8.1 are
concern, we have to
really understand them
because they matter a
lot. Previous windows
operating systems
came with a more
complicated
requirements if
compared with
Windows 8.1,
especially when it
comes to deployment.
Previously, it takes at
least 30-40 mins
deploy a windows OS,
but with the coming of
Windows 8.1
deployment takes less
than 20 mins
depending on the
hardware. To
understand the
requirements, let us
carefully take a look at the below table.
Component Recommendation
Processor 1 GHz or more
Memory 32-bit PCs: 1 GB
64-bit PCs: 2 GBs
Hard Disk space 32-bit PCs: 16 GB
64-bit PCs: 20 GBs
Graphics Card Microsoft DirectX 9 graphics devic
WDDM driver
In order to use a suitable deployment strategy, Windows 8.1 comes with
numerous strategies that would be suitable for any organization as well
as the hardware used in that organization. However, Microsoft
recommends a few targeted strategies for deploying windows 8.1.
Hence, for client PCs that are already running Windows 8, an in-place
upgrade is the fastest, simple and most reliable alternative, accomplished
either by installing the windows 8.1 update package or by refreshing the
operating system. As for enterprise that wish to deploy Windows on
new or existing hardware that is not already running windows, the
following list described the four recommended deployment strategies:
a. High Touch with retail media: This is simply the
deployment where you install windows on each client by
using retail installation media and then manual configure it.
b. High touch with standard image: Here, similar to high
touch with retail media, but it uses an operating system image
that includes your customizations and application
configurations.
c. Life Touch, High-Volume deployment: This method
requires limited interaction during deployment. Interaction
occurs at the beginning of the installation, but the remainder
of the process is automated.
d. Zero Touch, High Volume deployment: This strategy
requires no interaction during deployment. The process is
fully automated by using system center configuration
manager.
WINDOWS 8.1 PLATFORM ARCHITECTURE.
It is obvious that Windows 8.1 has one of the most amazing platform
especially from the application point of view. Though, not much will be
discuss on this due to
lack of sufficient
evidence to support
any claim to be made.
However, the
following figure/image
will give the reader an
over view of the
platform architecture.
Platforms Supported
Windows 8 runs on a
variety of platforms
starting from tables
made by different
vendors to netbooks,
laptops PCs and
servers. OS detects the
hardware capabilities
and then decides the
functionality that are
supported by such
hardware on the fly.
This avoids all the
confusion about
different OSs for
different platforms and
the cascading
compatibility issues. Since one OS fits all, upgrading and maintaining
will become very simple.
Here is a nice video from Computex 2011 which highlights the different
devices supported by Windows
Removed features
Several notable features have been removed in Windows 8; support for
playing DVD-Video was removed from Windows Media Player due to
the cost of licensing the necessary decoders (especially for devices
which do not include optical disc drives at all) and the prevalence of
online streaming services. For the same reasons, Windows Media Center
is not included by default on Windows 8, but Windows Media Center
and DVD playback support can be purchased in the "Pro Pack" (which
upgrades the system to Windows 8 Pro) or "Media Center Pack" add-on
for Windows 8 Pro. As with prior versions, third-party DVD player
software can still be used to enable DVD playback.
Backup and Restore, the backup component of Windows, is deprecated.
It still ships with Windows 8 and continues to work on preset schedules,
but is pushed to the background and can only be accessed through a
Control Panel applet called "Windows 7 File Recovery".Shadow Copy, a
component of Windows Explorer that once saved previous versions of
changed files, no longer protects local files and folders. It can only
access previous versions of shared files stored on a Windows Server
computer. The subsystem on which these components worked, however,
is still available for other software to use.
PRACTICAL
NO-2
Aim:-Write a
Program to Study
of Linux:
Linux
Linux (also known as
GNU/Linux) is one of
the most prominent
examples of free
software and open
source development
which means that
typically all underlying
source code can be
freely modified, used,
and redistributed by
anyone. The name
“Linux” comes from
the Linux kernel,
started in 1991 by
Linus Torvalds.
The system’s utilities
and libraries usually
come from the GNU
operating system
(which is why it is also
known as
GNU/Linux).
Linux is
predominantly known
for its use in servers. It
is also used as an
operating system for a
wide variety of
computer hardware,
including desktop
computers,
supercomputers, video
game systems, and
embedded devices such as mobile phones and routers.
Design
Linux is a modular Unix-like OS. It derives much of its basic design
from principles established in Unix during the 1970s and 1980s. Linux
uses a monolithic kernel which handles process control, networking, and
peripheral and file system access. The device drivers are integrated
directly with the kernel. Much of Linux’s higher - level functionality is
provided by seperate projects which interface with the kernel. The GNU
userland is an important part of most Linux systems, providing the shell
and Unix tools which carry out many basic OS tasks. On top of the
kernel, these tools form a Linux system with a GUI that can be used,
usually running in the X Windows System (X).Linux can be controlled
by one or more of a text-based command line interface (CLI), GUI, or
through controls on the device itself (like on embedded machines).
Desktop machines have 3 popular user interfaces (UIs): KDE, GNOME,
and Xfce. These UIs run on top of X, which provides network
transparency, enabling a graphical application running on one machine
to be displayed and controlled from another (that’s like running a game
on your computer but your friend’s computer can control and see the
game from his computer). The window manager provides a means to
control the placement and appearanceof individual application windows,
and interacts with the X window system.
A Linux system usually provides a CLI of some sort through a shell.
Linux distros for a server might only use a CLI and nothing else. Most
low-level Linux components use the CLI exclusively. The CLI is
particularly suited for automation of repetitive or delayed tasks, and
provides very simple inter-process communication. A graphical terminal
is often used to access the CLI from a Linux Desktop.
Development
The primary difference
between Linux and
many other OSs is that
the Linux kernel and
other components are
free and open source
software. Free
software projects,
although developed in
a collaborative
fashion, are often
produced
independently of each
other. A Linux
distribution,
commonly called a
“distro”, is a project that manages a remote collection of Linux-based
software, and facilitates installation of a Linux OS. Distros include
system software and application software in the form of packages. A
distribution is responsible for the default configuration of installed Linux
systems, system security, and more generally integration of the different
software packages into a coherent whole.
Linux is largely driven by its developer and user communities. Some
vendors develop and fund their distros on a volunteer basis. Others
maintain a community version of their commercial distros. In many
cities and regions, local associations known as Linux Users Groups
(LUGs) promote Linux and free software. There are also many online
communities that seek to provide support to Linux users and developers.
Most distros also have IRC chatrooms or newsgroups for
communication. Online forums are another means for support. Linux
distros host mailing lists also.
Most Linux distros support dozens of programming languages. The
most common collection of utilities for building both Linux applications
and OS programs is found within the GNU toolchain, which includes the
GNU Compiler Collection (GCC) and the GNU build system. GCC
provides compilers for Ada, C, C++, Java, and Fortran. Most distros also
include support for Perl, Ruby, Python and other dynamic languages.
The two main frameworks for developing graphical applications are
those of GNOME and KDE.
As well as those designed for general purpose use on desktops and
servers, distros may be specialized for different purposes including:
computer architecture support, embedded systems, stability, security,
localization to a specific region or language, targeting of specific user
groups, support for real-time applications, or commitment to a given
desktop environment. Linux runs on a more diverse range of computer
architecture than any other OS.
Although there is a lack of Linux ports for some Mac OS X and
Microsoft Windows programs in domains such as desktop publishing
and professional audio, applications roughly equivalent to those
available for OS X and Windows are available for Linux. Most Linux
distros have some sort of program for browsing through a list of free
software applications that have already been tested and configured for
the specific distro. There are many free software titles popular on
Windows that are available for Linux the same way there are a growing
amount of proprietary software that is being supported for Linux.
Background:
Linux is based on Unix
♦ Unix Philosophy
♦ Unix
commands
♦ Unix standards
and
conventions
Architecture:
♦ The shell and
the window
environment
are programs
♦ Programs’ only
access to
hardware is via
the kernel
What is Linux?
♦ Linux kernel
Developed
by Linus Torvalds
Strictly
speaking, ‘Linux’
is just the kernel
♦ Associated
utilities
Standard
tools found
on (nearly)
all Linux systems
Many important parts come from the GNU project
i. Free Software Foundation’s project to make a free
Unix
ii. Some claim the OS as a whole should be
‘GNU/Linux’
♦ Linux distributions
Kernel plus utilities plus other tools, packaged up for end
users
Generally with installation program
Distributors include: Red Hat, Debian, SuSE, Mandrake
Getting Started with Linux
Using a Linux System
♦ Login prompt displayed
o When Linux first loads after booting the computer
o After another user has logged out
♦ Need to enter a username and password
♦ The login prompt may be graphical or simple text
♦ If text, logging in will present a shell
♦ If graphical, logging in will present a desktop
o Some combination of mouse movements and keystrokes
will make a terminal window appear
o A shell runs in the terminal window
Linux Command Line
The shell is where commands are invoked
♦ A command is typed at a shell prompt
o Prompt usually ends in a dollar sign ($)
♦ After typing a command press Enter to invoke it
o The shell will try to obey the command
o Another prompt will appear
♦ Example:
$ date
Sat March 01 11:59:05 BST 2008
$
♦ The dollar represents the prompt in this course, do not type it
2.2.3 Logging Out
♦ To exit from
the shell, use
the exit
command
♦ Pressin
g
Ctrl+D
at the
shell
prompt
will
also
quit the
shell 
Quittin
g all
progra
ms
should
log you
out If in
a text-
only
single-
shell
environ
ment,
exiting
the
shell
should
be
sufficie
nt
♦ In a window
environment,
the window
manager
should have a
log out
command for
this purpose
♦ After logging
out, a new
login prompt
should be displayed
Command Syntax
♦ Most commands take parameters
♦ Some commands require them
♦ Parameters are also known as arguments
o For example, echo simply displays its arguments: $ echo
$ echo Hello there Hello there
♦ Commands are case-sensitive
o Usually lower-case $ echo whisper whisper
$ ECHO SHOUT
bash: ECHO: command not found
Files
♦ Data can be stored in a file
♦ Each file has a filename
A label referring to a particular file
Permitted characters include letters, digits, hyphens (-),
underscores (_), and dots (.)
o Case-sensitive — NewsCrew.mov is a different file from
NewScrew.mov
♦ The ls command lists the names of files
Creating Files with cat
♦ There are many ways of creating a file
♦ One of the simplest is with the cat command:
$ cat > shopping_list
Cucumber
Bread
Yoghurts
fish fingers
♦ Note the greater-than sign (>) — this is necessary to create the
file
♦ The text typed is written to a file with the specified name
♦ Press Ctrl+D
after a line-
break to denote
the end of the
file. The next
shell prompt is
displayed
♦ ls demonstrates
the existence of
the new file
Displaying Files’
Contents with cat
♦ There are many
ways of
viewing the
contents of a
file
♦ One of the
simplest is with
the cat
command:
$ cat
shopping_list
Cucumber
bread
yoghurts
fish fingers
♦ Note that no
greater-than
sign is used
♦ The text in the
file is displayed
immediately:
o Starting
on the line after the
command
o Before the next shell prompt
Deleting Files with rm
♦ To delete a file, use the rm (‘remove’) command
♦ Simply pass the name of the file to be deleted as an argument:
$ rm shopping_list
The file and its contents are removed
There is no recycle bin
o There is no ‘unrm’ command
♦ The ls command can be used to confirm the deletion
Unix Command Feedback
♦ Typically, successful commands do not give any output
♦ Messages are displayed in the case of errors
♦ The rm command is typical
o If it manages to delete the specified file, it does so
silently
o There is no ‘File shopping list has been removed’
message
o But if the command fails for whatever reason, a message is
displayed
♦ The silence can be off-putting for beginners
♦ It is standard behavior, and doesn’t take long to get used to
Copying and Renaming Files with cp and mv
♦ To copy the contents of a file into another file, use the cp
command:
$ cp CV.pdf old-CV.pdf
♦ To rename a file use the mv (‘move’) command: $ mv
commitee_minutes.txt committee_minutes.txt. Similar
to using cp then rm
♦ For both
commands, the
existing name
is specified as
the first
argument and
the new name
as the second.
If a file with
the new name
already exists,
it is overwritten
Filename
Completion
♦ The shell can
making typing
filenames
easier
♦ Once an
unambiguous
prefix has been
typed, pressing
Tab will
automatically
‘type’ the rest
♦ For example,
after typing
this:
$ rm sho
pressing Tab
may turn it into
this:
$ rm
shopping_list
♦ This also works
with command
names
- For example,
da may be completed
to date if no other
commands start ‘da’
Command History
♦ Often it is desired to repeat a previously-executed command
♦ The shell keeps a command history for this purpose
Use the Up and Down cursor keys to scroll through the list of
previous commands
Press Enter to execute the displayed command
♦ Commands can also be edited before being run
a. Particularly useful for fixing a typo in the previous
command
b. The Left and Right cursor keys navigate across a
command
c. Extra characters can be typed at any point
d. Backspace deletes characters to the left of the cursor
o Del and Ctrl+D delete characters to the right
 Take care not to log out by holding down Ctrl+D
too long
PRACTICAL NO-3
Aim:-Write a Program to Study of Linux Operating System
using Linux Kernel:
Linux kernel
The central nervous system of Linux is the kernel, the operating system
code that runs the whole computer. The kernel is under constant
development and is always available in both the latest stable release and
the latest experimental release. Progress on development is very fast,
and the recent 2.2-series kernels are simply amazing on all counts. The
kernel design is modular, so that the actual OS code is very small, yet
able to load whatever functionality it needs when it needs it, and then
free the memory afterwards. Because of this, the kernel remains small
and fast yet highly extensible, in comparison to other operating systems
which slow down the computer and waste memory by loading
everything all the time, whether you need it or not.
The Linux kernel is the
heart of Linux
operating system and
was originally
developed for the Intel
80386 CPU’s.
Memory management
is especially strong
with the 80386
(compared to earlier
CPU’s). Linux kernel
has the ability to have
full access to the entire
hardware capabilities
of the machine.
Actually there is no
restriction on what a
kernel module is
allowed to do.
Typically a kernel
might implement a
device driver, a file
system or a
networking protocol.
To support large
memory requirements
when only small
amounts of physical
RAM are available, Linux supports swap space. Swap space (discussed
in detail in Book II) allows pages of memory to be written to a reserved
area of a disk and treated as an extension of physical memory. By
moving pages back and forth between the swap space and RAM, Linux
can effectively behave as if it had much more physical RAM than it
does. Besides this, Linux kernel support the following features:
• Has memory protection between processes, so that one prog can't bring
the whole system down.
• Demand loads executables : Linux only reads from disk those parts of
a program that are actually used.
Functionalities:
The Linux kernel is
monolithic, which
means that the entire
OS runs solely in
supervisor mode.
Though the kernel is
a single process, it
consists of various
subsystems and each
subsystem is
responsible for
performing certain
tasks. Broadly, any
kernel performs the
following main tasks.
1) Process
management:
This subsystem
handles the process
life-cycle. It
creates and
destroys processes,
allowing
communication
and data sharing
between processes
through inter-
process communication (IPC). Additionally, with the help of the
process scheduler, it schedules processes and enables resource
sharing.
2) Memory management:
This subsystem handles all memory related requests. Available
memory is divided into chunks of a fixed size called pages, which
are allocated or de-allocated to/from the process, on demand. With
the help of the memory management unit (MMU), it maps the
process virtual address space to a physical address space and creates
the illusion of a contiguous large address space.
3) File system:
The GNU/Linux system is heavily dependent on the file system. In
GNU/Linux, almost everything is a file. This subsystem handles all
storage related requirements like the creation and deletion of files,
compression and journaling of data, the organisation of data in a
hierarchical manner, and so on. The Linux kernel supports all major
file systems including MS Windows NTFS.
4) Device control:
Any computer system requires various devices. But to make the
devices usable, there should be a device driver and this layer
provides that functionality. There are various types of drivers
present, like graphics drivers, a Bluetooth driver, audio/video drivers
and so on.
5) Networking:
Networking is one of the important aspects of any OS. It allows
communication and data transfer between hosts. It collects, identifies
and transmits network packets. Additionally, it also enables routing
functionality.
6) Dynamically loadable kernel modules:
We often install kernel updates and security patches to make sure
our system is up-to-date. In case of MS Windows, a reboot is often
required, but this is not always acceptable; for instance, the machine
cannot be rebooted if is a production server. Wouldnt it be great if
we could add or remove functionality to/from the kernel on-the-fly
without a system reboot? The Linux kernel allows dynamic loading
and unloading of kernel modules. Any piece of code that can be
added to the kernel at runtime is called a kernel module. Modules
can be loaded or unloaded while the system is up and running
without any
interruption. A
kernel module is
an object code that
can be dynamically
linked to the
running kernel
using the insmod
command and can
be unlinked using
the rmmod
command
7) A few useful
utilities:
GNU/Linux
provides various
user-space utilities
that provide useful
information about
the kernel
modules. Let us
explore them.
♦ lsmod: This
command lists
the currently
loaded kernel
modules. This
is a very simple
program which
reads the
/proc/modules
file and
displays its
contents in a
formatted
manner.
♦ insmod: This
is also a trivial
program which
inserts a
module in the
kernel. This command doesnt handle module dependencies.
♦ rmmod: As the name suggests, this command is used to unload
modules from the kernel. Unloading is done only if the current
module is not in use. rmmod also supports the -f or –-force
option, which can unload modules forcibly. But this option is
extremely dangerous. There is a safer way to remove modules.
With the -w or –-wait option, rmmod will isolate the module and
wait until the module is no longer used.
♦ modinfo: This command displays information about the module
that was passed as a command-line argument. If the argument is
not a filename, then it searches the /lib/modules/<version>
directory for modules. modinfo shows each attribute of the
module in the field:value format.
♦ lsmod: This command lists the currently loaded kernel modules.
This is a very simple program which reads the /proc/modules file
and displays its contents in a formatted manner.
♦ insmod: This is also a trivial program which inserts a module in
the kernel. This command doesnt handle module dependencies.
♦ rmmod: As the name suggests, this command is used to unload
modules from the kernel. Unloading is done only if the current
module is not in use. rmmod also supports the -f or –-force
option, which can unload modules forcibly. But this option is
extremely dangerous. There is a safer way to remove modules.
With the -w or –-wait option, rmmod will isolate the module and
wait until the module is no longer used.
♦ modinfo: This command displays information about the module
that was passed as a command-line argument. If the argument is
not a filename, then it searches the /lib/modules/<version>
directory for modules. modinfo shows each attribute of the
module in the field:value format.
♦ dmesg: Any user-space program displays its output on the
standard output stream, i.e., /dev/stdout but the kernel uses a
different methodology. The kernel appends its output to the ring
buffer, and by using the dmesg command, we can manage the
contents of the ring buffer.
Typical components of a kernel are:
♦ Interrupt handlers to service interrupt requests.
♦ A scheduler to share processor time among multiple processes.
♦ A memory
management
system to
manage
process address
spaces.
♦ System
services such
as networking
and
interprocess
communication
.
Kernel-Space and
User-Space
♦ Kernel-space:
on modern
systems with
protected
memory
management
units, the
kernel typically
resides in an
elevated
system state,
which includes
a protected
memory space
and full access
to the
hardware. This
system state
and memory
space is
collectively
referred to as
kernel-space.
♦ User-space:
applications
execute in user-
space, where
they can access
a subset of the
machine’s
available resources and can perform certain system functions,
directly access hardware, access memory outside of that allotted
them by the kernel, or otherwise misbehave.
When executing kernel code, the system is in kernel-space executing in
kernel mode. When running a regular process, the system is in user-
space executing in user mode.
System Calls and Library Calls
Applications communicate with the kernel via system calls . An
application typically calls functions in a library (e.g. C library) which
rely on the system call interface to instruct the kernel to carry out tasks
on the application's behalf.
♦ Some library calls provide many features not found in the system
call. Therefore, calling into the kernel is just one step in an
otherwise large function. For example, the printf() function
provides formatting and buffering of the data; only one step in its
work is invoking write() to write the data to the console.
♦ Some library calls have a one-to-one relationship with the kernel.
For example, the open() library function does little except call
the open() system call.
♦ Other C library functions, such as strcpy(), make no direct use of
the kernel at all.
When an application executes a system call, the kernel is executing on
behalf of the application. Furthermore, the application is said to be
executing a system call in kernel-space, and the kernel is running in
process context. This relationship (that applications call into the kernel
via the system call interface) is the fundamental manner in which
applications get work done.
Interrupts
The kernel manages the system’s hardware through interrupts. When
hardware wants to communicate with the system, it issues an interrupt
that interrupts the processor, which in turn interrupts the kernel. A
number identifies interrupts and the kernel uses this number to execute a
specific interrupt handler to process and respond to the interrupt. To
provide synchronization, the kernel can disable interrupts (either all
interrupts or just one specific interrupt number). In Linux, the interrupt
handlers do not run in a process context. Instead, they run in a special
interrupt context that is not associated with any process. This special
context exists solely to let an interrupt handler quickly respond to an
interrupt, and then exit.
Linux Kernel Versions
Linux kernels come in two flavors: stable and development.
The Linux Kernel
Development
Community
The main forum for
this community is the
Linux Kernel Mailing
List (oft-shortened to
lkml). Subscription
information is
available at
http://vger.kernel.org.
PRACTICAL
NO-4
Aim:-Write a
Program to Study
of Linux using
Shell:
Shell
A Shell provides you
with an interface to the
Unix system. It gathers
input from you and
executes programs
based on that input.
When a program
finishes executing, it
displays that program's
output.
Shell is an
environment in which
we can run our
commands, programs,
and shell scripts. There
are different flavors of
a shell, just as there are
different flavors of
operating systems.
Each flavor of shell
has its own set of
recognized commands
and functions.
What is Shell
A shell is special user
program which
provide an interface to
user to use operating
system services. Shell
accept human readable
commands from user
and convert them into something which kernel can understand. It is a
command language interpreter that execute commands read from input
devices such as keyboards or from files. The shell gets started when the
user logs in or start the terminal.
Shell is broadly classified into two categories –
 Command Line Shell
 Graphical shell
Command Line Shell
Shell can be accessed by user using a command line interface. A special
program called Terminal in linux/macOS or Command Prompt in
Windows OS is provided to type in the human readable commands such
as “cat”, “ls” etc. and then it is being execute. The result is then
displayed on the terminal to the user. A terminal in Ubuntu 16.4 system
looks like this –
linux command line
In above screenshot
“ls” command with “-
l” option is executed.
It will list all the files
in current working
directory in long
listing format.
Working with
command line shell is
bit difficult for the
beginners because it’s
hard to memorize so
many commands. It is
very powerful, it
allows user to store
commands in a file and
execute them together.
This way any
repetitive task can be
easily automated.
These files are usually
called batch files in
Windows and Shell Scripts in Linux/macOS systems.
Graphical Shells
Graphical shells provide means for manipulating programs based on
graphical user interface (GUI), by allowing for operations such as
opening, closing, moving and resizing windows, as well as switching
focus between windows. Window OS or Ubuntu OS can be considered
as good example which provide GUI to user for interacting with
program. User do not need to type in command for every actions.A
typical GUI in Ubuntu system –
GUI shell
There are several shells are available for Linux systems like –
 BASH (Bourne Again SHell) – It is most widely used shell in
Linux systems. It is used as default login shell in Linux systems
and in macOS. It can also be installed on Windows OS.
 CSH (C SHell) – The C shell’s syntax and usage are very similar
to the C programming language.
 KSH (Korn SHell) – The Korn Shell also was the base for the
POSIX Shell standard specifications etc.
Each shell does the same job but understand different commands and
provide different built in functions.
Shell Prompt
The prompt, $, which
is called the command
prompt, is issued by
the shell. While the
prompt is displayed,
you can type a
command.
Shell reads your input
after you press Enter.
It determines the
command you want
executed by looking at
the first word of your
input. A word is an
unbroken set of
characters. Spaces and
tabs separate words.
Following is a simple
example of the date
command, which
displays the current
date and time −
$dateThu Jun 25
08:30:19 MST 2009
You can customize
your command prompt
using the environment
variable PS1.
Shell Types
In Unix, there are two
major types of shells −
 Bourne shell −
If you are using
a Bourne-type
shell, the $
character is the
default prompt.
 C shell − If
you are using a
C-type shell,
the % character is the default prompt.
The Bourne Shell has the following subcategories −
 Bourne shell (sh)
 Korn shell (ksh)
 Bourne Again shell (bash)
 POSIX shell (sh)
The different C-type shells follow −
 C shell (csh)
 TENEX/TOPS C shell (tcsh)
The original Unix shell was written in the mid-1970s by Stephen R.
Bourne while he was at the AT&T Bell Labs in New Jersey.
Bourne shell was the first shell to appear on Unix systems, thus it is
referred to as "the shell".
Bourne shell is usually installed as /bin/sh on most versions of Unix.
For this reason, it is the shell of choice for writing scripts that can be
used on different versions of Unix.
In this chapter, we are going to cover most of the Shell concepts that are
based on the Borne Shell.
Shell Scripts
Usually shells are interactive that mean, they accept command as input
from users and execute them. However some time we want to execute a
bunch of commands routinely, so we have type in all commands each
time in terminal.
As shell can also take commands as input from file we can write these
commands in a file and can execute them in shell to avoid this repetitive
work. These files are called Shell Scripts or Shell Programs. Shell
scripts are similar to the batch file in MS-DOS. Each shell script is
saved with .sh file extension eg. myscript.sh
A shell script have syntax just like any other programming language. If
you have any prior experience with any programming language like
Python, C/C++ etc. it would be very easy to get started with it.
A shell script comprises following elements –
 Shell Keywords – if, else, break etc.
 Shell commands – cd, ls, echo, pwd, touch etc.
 Functions
 Control flow – if..then..else, case and shell loops etc.
Why do we need shell
scripts
There are many
reasons to write shell
scripts –
 To avoid
repetitive work
and automation
 System admins
use shell
scripting for
routine
backups
 System
monitoring
 Adding new
functionality to
the shell etc.
Advantages of shell
scripts
 The command
and syntax are
exactly the
same as those
directly entered
in command
line, so
programmer do
not need to
switch to
entirely
different syntax
 Writing shell
scripts are
much quicker
 Quick start
 Interactive
debugging etc.
Disadvantages of shell scripts
 Prone to costly errors, a single mistake can change the command
which might be harmful
 Slow execution speed
 Design flaws within the language syntax or implementation
 Not well suited for large and complex task
 Provide minimal data structure unlike other scripting languages.
Etc
The basic concept of a shell script is a list of commands, which are listed
in the order of execution. A good shell script will have comments,
preceded by # sign, describing the steps.
There are conditional tests, such as value A is greater than value B,
loops allowing us to go through massive amounts of data, files to read
and store data, and variables to read and store data, and the script may
include functions.
We are going to write many scripts in the next sections. It would be a
simple text file in which we would put all our commands and several
other required constructs that tell the shell environment what to do and
when to do it.
Shell scripts and functions are both interpreted. This means they are not
compiled.
Example Script
Assume we create a test.sh script. Note all the scripts would have the .sh
extension. Before you add anything else to your script, you need to alert
the system that a shell script is being started. This is done using the
shebang construct. For example −
#!/bin/sh
This tells the system that the commands that follow are to be executed
by the Bourne shell. It's called a shebang because the # symbol is called
a hash, and the ! symbol is called a bang.
To create a script containing these commands, you put the shebang line
first and then add the commands −
#!/bin/bash
pwd
ls
Shell Comments
You can put your
comments in your
script as follows −
#!/bin/bash
# Author : Zara Ali
# Copyright (c)
Tutorialspoint.com#
Script follows here:
pwd
ls
Save the above content
and make the script
executable −
$chmod +x test.sh
The shell script is now
ready to be executed −
$./test.sh
Upon execution, you
will receive the
following result −
/home/amrood
Index.htm
unix-
basic_utilities.htm
unix-directories.htm
test.sh
unix-
communication.htm
unix-environment.htm
Note − To execute a
program available in
the current directory, use ./program_name
Extended Shell Scripts
Shell scripts have several required constructs that tell the shell
environment what to do and when to do it. Of course, most scripts are
more complex than the above one.
The shell is, after all, a real programming language, complete with
variables, control structures, and so forth. No matter how complicated a
script gets, it is still just a list of commands executed sequentially.
The following script uses the read command which takes the input from
the keyboard and assigns it as the value of the variable PERSON and
finally prints it on STDOUT.
#!/bin/sh
# Author : Zara Ali
# Copyright (c) Tutorialspoint.com
# Script follows here:
echo "What is your name?"
read PERSON
echo "Hello, $PERSON"
Here is a sample run of the script −
$./test.sh
What is your name?
Zara AliHello, Zara Ali
$
PRACTICAL
NO-5
AIM :- Write a
Program to Study
Linux using basic
Commands Pipe
and Filter
Commands
Basic Linux
commands
1. The date
command
Linux maintains a
system clock. As for
now you can simply
display the current
date with the date
command, which
shows the date and
time for the nearest
second as shown:
$ date
Thur Nov 4 11:23:52
IST 1999
The other format
specifiers are as
follows:
D Specifies the day
of the month
Y Indicates the last
two digits of the year
H Indicates the hour
M Indicates the
minute
S Indicates the
second
T Indicates the time in hh::mm:ss format
2. The who command
Linux maintains an account of all the current users of the system. A list
of all the users is displayed by the who command. The who command
produces a three column output .This indicates the number of users of
the system with their login names in the first column. The second
column shows the device names of their respective terminals. The third
column indicates the date and time of logging in.
The –H option prints the column headers:
$ who –H
3. The tty command
Linux treats even terminals as files. It is therefore reasonable to expect a
command which tells you the device name of the terminal you are using
with the help of the tty command.
$ tty
/dev/ttyp1
$
4. The cal command
This command is used for printing the calendar of any particular month
or the entire year.Any calendar from the year 1 to 9999 can be displayed
with this command:
$ cal 2000
5. The man command
Linux systems maintain an online documentation about each command
so that you can get to know the complete description about a particular
command. The command:
$ man
will give a description of the man command in general.
The man command is used to view the description of other commands.
For this purpose the
man command is
followed by the
commandname. It has
the following format:
$ man commandname
6. The finger
utility
This utility is used to
display the status of all
the users currently
logged on to the Linux
system.
The finger utility
without any parameter,
displays a single line
output for each user
currently logged on . It
displays the
information like the
user’s login name, full
name, terminal name,
write status, idle time,
login time, the
machine’s address
where the user is
currently logged in and
the office number. The
write permission is
displayed along with
the terminal name as
an asterisk(*). If the
asterisk appears after
the terminal name, it
means that the write
permission is denied.
The syntax of the
finger command is as
follows:
finger [options] [user
name]
7. The chfn utility
The chfn (change your finger information) utility is used to change the
user’s finger
information. The chfn utility checks for the user’s information from the
/etc/passwd file and
allows the user to chane information. The syntax for this utility is as
follows:
chfn [options] [username]
The chfn asks for the password of the user to authenticate the user for
changing the
fingerinformation. If you do not want to change any particular
information, you can press Enter
at the corresponding prompt and proceed with the remaining parameters.
8. command The head
The head command is used to display the top few records of the file. The
syntax of the
command is as follows:
$ head [option] file
The option is as follows:
count Display the first count lines of file
The easiest way to use this command is to specify a filename without
specifying the
number of lines to be displayed. If this is the case, the first ten records of
the file are
displayed.
$ head tmp.lst
will display the first ten records of the file tmp.lst.
9. The tail command
The tail command displays the end few records of the file. If no line
count is given, the tail
command displays the last ten lines of the file. We also have an option to
specify a count and
select that many lines
from the end of file.
Consider an example:
$ tail –3 emp.lst
10. The mesg
command
The user has the option
to allow or disallow
other users to write on
his terminal. The two
options available with
the mesg command are
as follows:
mesg y
This option allows
other users to write to
your terminal
mesg n
This option disallows
other users to write to
your terminal
If you type the mesg
command without any
option, it displays the
status of your
terminal,say
for example,
$ mesg
is y
11. The wall
command
The wall command is
used to write to all the
users. The wall
command sends the message to all
the users who are currently logged on to the Linux system and have their
mesg permission set
to ‘y’. The syntax of the command is as follows:
wall Type in the above command at the command prompt. Press
<Enter>.
Now write the message you want to broadcast. Press Ctrl <d>. The
message would be
broadcasted to all the users currently logged on.
Pipe Commands
If you have a series of commands in which the output of one command
is the input of the next,
you can pipe the output without saving it in temporary files:
first_command | next_command
For example, if you wanted to print out a sorted version of a file that
contained a list of names
and phone numbers, you could use a pipe (as well as input redirection):
sort < my_phone_list | lpr
Similarly, in order to display the contents of the current directory, a
screen-full at a time,you
can give the following commands:
$ ls > myfile
$ more myfile
Here, the listing of the directory is stored in the file, myfile, by the first
command and this file
is then used as input by the more command.
The above two steps can be combined and executed as a single
command without
creating a temporary file,
$ ls | more
The vertical bar (|) is the pipe character which indicates to the shell that
the output of the
command before the
‘|’ is the input to the
command after the ‘|’.
Filters Command
A filter is a program
that takes its input
from the standard
input file, processes (
or filters)it and
sends its output to the
standard output file.
Linux has a rich set of
filters that can be used
to
work on data in an
efficient way. Some
examples of filters are:
• cat
• grep
• tr
• sort
• uniq
• sed
• awk
Some of the filters are
discussed as follows:
 The grep command
The grep command searches a file for a specified pattern and displays it
on the screen. The syntax of this command is as follows:
grep [options] regular expression filename[s]
 The tr command
The tr command transliterates characters i.e. it copies the standard input
to the standard output with substitution or deletion of specific characters.
The command has the following syntax:
tr [options] [string1] < file1
The following is the list of options:
c Complements the set of characters in string1 with respect to the
universe of characters whose
ASCII codes are 001 through 377 octal
d Deletes characters specified in string1
s Squeezes all repeated occurrences of a character to one character
 The sort command
The sort command sorts lines of all the specified files together and
writes the result on the
standard output.
The general syntax of the command is as follows:
sort [options][+pos1] [-pos2] filename[s]
Say for example the command
$sort myfile
will sort the file considering each record of a file as one single field.
 The uniq command
There is often a problem of duplicate entries due to faulty data entry.
The sort command
suppresses them with the –u option. In addition to this there is a special
tool to handle these
records called the uniq command. The command is most useful when
placed in pipelines.
 The sed
Command
The sed command
provides a stream
editor.
The syntax of the
command is as
follows:
sed [ -n ] Script [ File
... ]
sed [ -n ] [ -e Script ]
... [ -f ScriptFile ] ... [
File ... ]
The sed command
modifies lines from the
specified File
parameter according to
an edit script
and writes them to
standard output. The
sed command includes
many features for
selecting
lines to be modified
and making changes
only to the selected
lines.
Alphabetical LINUX
Command List:
1. addbib - create
or extend a
bibliographic
database
2. apropos -
locate
commands by
keyword
lookup
3. ar - create library archives, and add or extract files
4. at - execute a command or script at a specified time
5. awk - pattern scanning and processing language
6. banner - display a string in large letters
7. basename - display portions of path names and filenames
8. batch - runs jobs when the system load level permits
9. biff - give notice of incoming mail messages
10. cal - display a calendar
11. calendar - a simple reminder service
12. cancel - cancel requests to a printer
13. cat - concatenate and display
14. cb - a simple C program beautifier
15. cc - C compiler
16. cd - change working directory
17. checknr - check nroff and troff input files; report possible errors
18. checkeq - checks documents formatted with memoranda macros
19. chgrp - change the group ownership of a file
20. chmod - change the permissions mode of a file
21. clear - clear the terminal screen
22. cmp - perform a byte-by-byte comparison of two files
23. colcrt - filter nroff output for a terminal without overstrike
capability
24. comm - selects or rejects lines common to two sorted files
25. compress - compress files (see uncompress also)
26. cp - copy files
27. cpio - copy file archives in and out
28. cpp - the C language preprocessor
29. csh - a shell with a C-like syntax and advanced interactive
features
30. ctags - create a tags file for use with ex and vi
31. cut - Writes
selected bytes,
characters, or
fields from
each line of a
file.
PRACTICAL
NO-6
Aim:-Write a
Program to
Administrate Linux
Operating System:
System
Administration
Administration tasks:
• Starting and shutting
down the system
properly
• Managing the disk
partitions
• Making backups
• gzip, compress, and
tar
• Message of the day
• Emergency boot
floppies
Instead, we will look
at the basic
information and
utilities and leave you
to experiment. For
more details, check the
documentation files
with your Linux
operating system.
Better yet, consider
purchasing a good
UNIX system
administration Book.
Much of the
information in a UNIX
book will be
applicable to Linux.
The root Account
The root login, as you probably know, has no limitations at all. It can do
anything anywhere, access any files it wants, and control any processes.
This power has its price, though: Any mistake can be disastrous,
sometimes resulting in damage to the entire operating system.
A mystique has built up in the UNIX community about the root login,
because it holds unlimited power over the system. The tendency to want
to use this super user login is overwhelming for many. However, a
simple rm command in the wrong place can spell many hours of trouble.
For this reason, the root account should be employed only for limited
system use, and then only when its power is necessary (such as when
rebuilding a kernel, installing new software, or setting up new file
systems). As a general rule, you should not use the root account for
routine tasks.
Naturally, many people use root for their daily Linux sessions, ignoring
any advice because they think they won't make mistakes. In truth,
everyone makes a mistake occasionally. Check with any UNIX system
administrator and you'll find that accidents happen with the root account.
(I have managed to delete entire file systems more than once while
trying to do two things at the same time.) Although many people will
ignore the rule about using root only when necessary, most of them
eventually find out why this rule is important!
Starting and Stopping the System
There are several ways of booting the Linux operating system, as well as
a few ways to safely shut it down. Some were mentioned earlier in this
book. Because Linux can be installed in many different ways, there is no
single "right" method of booting the operating system, so we must look
at both hard-disk-based and floppy-disk-based boot procedures.
Booting from a Floppy
A boot floppy, as its name implies, is a floppy disk that boots the Linux
kernel. A boot floppy has the root partition installed on the floppy itself
instead of the hard drive (although both may co-exist). Without the root
partition, Linux would be unable to find the hard drives for the rest of
the operating system.
You can create Linux boot floppies with the setup routine included in
most distributions of the operating system. Check the documentation or
information files that came with your Linux distribution, if there are any.
Alternatively, most
Linux setup utilities
have a menu-driven
interface that prompts
you for a boot floppy
setup when you
rebuild or reconfigure
the kernel. You should
use this procedure to
make a boot floppy,
which is also useful for
emergencies.
In most cases, a boot
floppy is used only in
emergencies when
your system won't start
up normally. The boot
floppy enables you to
load Linux, and then
mount the hard drives
that are causing the
problem to check for
damage. Luckily, this
is not required very
often. If you haven't
used LILO to choose
the partition to boot or
set your boot sequence
to Linux by default,
you may need the boot
floppy to start up
Linux. In this case, the
boot floppy is much
like a DOS boot
floppy.
You can create a boot
floppy from scratch by
copying over the
kernel image from the
hard drive. The kernel
image is usually in the
file vmlinuz, vmlinux,
Image, or /etc/Image,
depending on the
distribution of Linux.
The Red Hat distribution uses vmlinuz, which is a compressed kernel
(hence the z in the name). Compressed kernels uncompress themselves
as they are loaded into memory at boot time. The vmlinuz image
expands to vmlinux. (Compressed kernels take up less disk space; that's
why they are used.)
After you have identified the kernel, you can set the root device in the
kernel image to point to the root partition on either the floppy or hard
drive. In this case, we want the floppy. The root partition is set with the
rdev command, whose format is as follows:
rdev kernel name device
where kernelname is the name of the kernel image, and device is the
name of the Linux root partition. To set a floppy boot device with the
file vmlinuz, the command would be rdev vmlinuz /dev/fd0
for the first floppy on the system. You can set other parameters with
rdev as well if you want to change system defaults during boot. Check
the rdev man page for the rdev help file for complete information.
As a final step in creating the boot floppy, copy the kernel image to the
floppy disk. You should use a preformatted diskette (format with DOS if
necessary) to allow the Linux routines to identify the type of diskette
and its density. To copy the vmlinuz kernel to the first floppy drive, use
this command:
cp vmlinuz /dev/fd0
The floppy should now be ready to boot the system. You might not be
able to boot the system without the floppy if you changed the location of
the root partition. You can change the root partition back to the hard
drive with the rdev command after completing the boot floppy, which
enables you to boot from either. This can be useful when you have
diskettes for several different boot configurations. You can also create
the boot floppy from the Linux setup program.
Using LILO To Boot
LILO is a program that resides in the boot sector of your hard drive and
allows Linux to be booted from the hard disk either after you tell it to or
after a default number of seconds has elapsed.
LILO can also be used with other operating systems such as OS/2 and
DOS. If you have LILO set to autoboot Linux, you must interrupt the
process by pressing the Ctrl, Alt, or Shift keys when the bootup is
started if you want to boot into another operating system. This displays a
boot prompt that enables you to specify another operating system.
If LILO is set to allow
a given time before it
boots into Linux, you
can use the CtrlAlt-
Shift sequence to
interrupt the boot
process before the
timer expires and
Linux starts loading.
Finally, if LILO is set
to not autoboot into
Linux, but to wait for
explicit instructions,
you must press Enter
to boot Linux or type
the name of the other
operating system.
Some Linux
distributions have a
configuration file in
the directory /etc/lilo
that can be edited to
provide boot
information, while
other versions of
Linux configure LILO
during the installation
process. If the latter is
the case, you can
change the settings
with the setup utility.
Some versions of
Linux use the
configuration file
/etc/lilo.conf instead of
/etc/lilo.
Shutting Down
Linux
You can't just turn off
the power switch! This
can cause damage to
the file system,
sometimes
irreversibly. Because
Linux keeps many files open at once, as well as several processes, they
must all be closed down properly before you cycle the power to the unit.
There are a few ways to shut the Linux system down, but the formal
method is to use the shutdown command. The syntax for shutdown is
shutdown [minutes] [warning]
where minutes is the number of minutes to wait before shutting the
system down and warning is an optional message displayed for all users
currently logged in. Some versions of shutdown allow the word now
instead of a time, while others require either no argument or the number
0 to shut the system down immediately without waiting. You can have
shutdown reboot the system after the shutdown by adding the argument -
r (for reboot).
Using shutdown is best if you have other users on your system, because
it gives them a warning that they should log out, and it prevents loss of
information. It can also be used to automate a shut-down much later
(such as at midnight), with messages just before that time warning any
users still logged in.
If you can't wait and want to shut the system down immediately, use the
halt command or the "three-finger salute" of Ctrl-Alt-Delete. This
immediately shuts down all the processes and halts the system as quickly
as possible. Then the power can be shut off.
Some Linux distributions don't support Ctrl-Alt-Delete, and a couple of
older distributions use it to halt the system immediately without
terminating processes properly. This can cause damage. Check the
documentation or man pages for information.
Creating a New File System
To create a file system on a floppy (so it can be mounted), you should
use the utility mke2fs or the command mkdev fs, depending on the
version of Linux. To use mke2fs, for example, issue the command
mke2fs /dev/fd0 1440
to create a floppy file system on a 1.44MB 3.5-inch diskette.
Unmounting File Systems
To detach a mounted file system from your Linux file system, use the
umount command with the name of the device. For example, to unmount
a floppy in /dev/fd0, issue the command
umount /dev/fd0
and the floppy will be
removed from the
mounted point. Be sure
to type umount instead
of unmount!
If you want to remove
the current floppy and
replace it with another,
you can't simply swap
them. The current
floppy must be
unmounted, and then
the new one must be
mounted. Failure to
follow this process can
result in corruption or
erroneous directory
listings.
Checking File
Systems
Every now and again
a file might get
corrupted or a file
system's inode table
might get out of sync
with the disk's
contents. For these
reasons, it is a good
idea to check the file
system at regular
intervals. Several
utilities can check file
systems, depending on
the version of Linux.
The utility fsck is
available for some
systems, while the
utility e2fsck is
designed for Linux's
ext2fs file system.
Many Linux versions
include other utilities
such as xfsck and efsfck for different file systems. In many cases, the
fsck command is linked to the individual file system versions.
To use e2fsck to check a file system, issue the command with the device
name and the options a (automatically correct errors) and v (verbose
output):
e2fsck -av /dev/hda1
This command checks and repairs any problems on the /dev/hda1 (or
whatever device driver you specify) partition. If any corrections have
been made to a partition, you should reboot the machine as soon as
possible to allow the system to resync its tables.
Whenever possible, it is a good idea to unmount the file system before
checking it, because this can prevent problems with open files. Of
course, you can't unmount the primary root partition while running from
it, so you can boot from a boot floppy that contains the check utilities,
and start them from the floppy.
Backups
The three rules of system administration are back up, back up, and back
up. This might sound silly and trite, but a backup can save you whenever
you do something silly to the file system, or when problems occur. With
UNIX, most backups are made to a tape device using tar, although many
Linux users don't have tape units available and have to resort to floppies.
Backups are made with the tar utility, as I mentioned earlier. The
procedure is exactly the same as I showed you earlier. To back up the
entire system on floppy, the command is
tar -cvfbk /dev/fd0 1440 4 /
To back up to a high-capacity tape device larger than the file system
(and hence not needing a capacity limit) called /dev/rct0, the command
is
tar -cvfk /dev/rct0 20 /
In many cases, you won't want to back up the entire system, because it's
easier to reinstall off a CD-ROM. However, you should back up your
user files by either backing up the entire /usr directory or specifically
backing up your own home directory.
To restore a backup, you use the tar command again:
tar -xvf /dev/rct0
This recovers all files
from the tape device
/dev/rct0. You can
explicitly restore
specific files if you
need to. Several
commercial products
offer automated
backups, although you
can do this quite easily
with the cron
command.
Setting Up Your
System
You can perform
several little tasks to
tweak or optimize your
Linux system,
although in many
cases they are
dependent on the
version you are
running and other
applications
coexisting. We can
look at a few of the
miscellaneous tasks
here.
Setting the System
Name
The system name is
contained in a file
called
/etc/HOSTNAME. It is
simply the name the
system calls itself for
identification, which is
especially useful if you
are networking your
Linux machine with
others. You can call
the system anything you want.
To set your system name (also called a host name), you can either edit
the system files (which should be followed by a reboot to make the
changes effective) or use the hostname command. The command
hostname hellfire
sets the machine's name to hellfire.
Using a Maintenance Disk
Every system should have a maintenance disk that enables you to check
the root file system, recover from certain disk problems, and solve
simple problems (such as forgetting your root password). The
emergency disks, also called the boot/root floppies, are created with the
setup program in most distributions of Linux when the configuration is
changed.
You can usually create an emergency boot disk from the CD-ROM that
the system came on, as well as obtain the necessary files from FTP sites.
After you have booted your machine with the emergency disk, you can
mount the disk partitions with the mount command.
Forgetting the root Password
This is an embarrassing and annoying problem, but luckily one easily
fixed with Linux. (If only other UNIX systems were so easy!) To
recover from a problem with the root password, use a boot floppy and
boot the system. Mount the root partition, and edit the /etc/passwd file to
remove any password for root; then, reboot from the hard disk.
After the system has booted, you can set a password again.
This points out one major security problem with Linux: Anyone with a
boot floppy
can get unrestricted access to your system!
Setting the Login Message
If you have more than one user on the system, you can display
information about the system, its maintenance, or changes in a file called
/etc/motd (message of
the day). The contents
of this file are
displayed whenever
someone logs in.
To change the
/etc/motd file, use any
text editor and save the
contents as ASCII.
You can make the
contents as long as you
want, but readers
usually appreciate
brevity. The /etc/motd
file is useful for
informing users of
downtime, backups, or
new additions. You
can also use it to give a
more personal feel to
your system.
Summary
System administration
is not a complicated
subject, unless you
want to get into the
nitty-gritty of your
operating system and
its configuration. For
most Linux users who
use the operating
system for their
personal
experimentation, the
administration steps
explained in this
chapter should be
sufficient for most
purposes. I
PRACTICAL
NO-7
Aim:-Write a
Program of Shell
Scritts:
How to write
shell script
Following steps are
required to write
shell script:
(1) Use any
editor like vi or
mcedit to write
shell script.
(2) After
writing shell
script set
execute
permission for
your script as
follows syntax:
chmod permission
your-script-name
Examples:
$ chmod +x your-
script-name
$ chmod 755 your-
script-name
Note: This
will set read
write execute
(7)
permission
for owner,
for group
and other
permission is
read and
execute only (5).
(3) Execute your script as syntax:
b
a
s
h
y
o
u
r
-
s
c
r
i
p
t
-
n
a
m
e
s
h
y
o
u
r
-
s
c
r
i
p
t
-
n
a
m
e
./your-script-name
Examples:
$ bash bar
$ sh bar
$ ./bar
NOTE In the last
syntax ./ means
current directory,
But only . (dot)
means execute
given command
file in current
shell without
starting the new
copy of shell, The
syntax for . (dot)
command is as
follows
Syntax:
. command-name
Example:
$ . foo
Variables in Shell
To process our
data/information,
data must be kept in
computers RAM
memory. RAM
memory is divided
into small locations,
and each location
had unique number
called memory
location/address,
which is used to
hold our data.
Programmer can
give a unique name
to this memory
location/address
called memory
variable or variable
(Its a named storage
location that may take different values, but only one at a time).
In Linux (Shell), there are two types of variable:
(1) System variables - Created and maintained by Linux
itself. This type of variable
defined in CAPITAL LETTERS.
(2) User defined variables (UDV) - Created and maintained
by user. This type of variable defined in lower letters. You can
see system variables by giving command like $ set, some of the
important System variables are:
System Variable Meaning
BASH=/bin/bash Our shell name
BASH_VERSION=1.14.7(1) Our shell version name
COLUMNS=80 No. of columns for our screen
HOME=/home/vivek Our home directory
LINES=25 No. of columns for our screen
LOGNAME=students students Our logging name
OSTYPE=Linux Our Os type
PATH=/usr/bin:/sbin:/bin:/usr/sbin Our path settings
PS1=[u@h W]$ Our prompt settings
PWD=/home/students/Common Our current working directory
SHELL=/bin/bash Our shell name
USERNAME=vivek
User name who is currently
login to this PC
NOTE that Some of the above settings can be different in
your PC/Linux environment. You can print any of the
above variables contains as follows:
$ echo $USERNAME
$ echo $HOME
Exercise:
1) If you
want to print
your home
directory
location then
you give
command:
a)$ echo $HOME
OR
(b)$ echo HOME
How to define
User defined
variables (UDV)
To define UDV
use following
syntax
Syntax:
variable
name=value
'value' is
assigned to
given
'variable
name' and
Value must
be on right
side = sign.
Example:
$ no=10# this is ok
$ 10=no# Error,
NOT Ok, Value
must be on right
side of = sign.
To define variable
called
'vech'
having value Bus
$ vech=Bus
to define variable called n having value 10
$ n=10
Rules for Naming variable name (Both UDV and
System Variable)
(1) Variable name must begin with Alphanumeric character
or underscore character (_), followed by one or more
Alphanumeric character. For e.g. valid shell variable are as
follows
HOME
S
Y
S
T
E
M
_
V
E
R
S
I
O
N
v
e
c
h
n
o
(2) Don't put spaces on either side of the equal sign when
assigning value to variable. For e.g. In following variable
declaration there will be no error
$ no=10
But there will be problem for any of the following variable
declaration:
$ no =10
$ no= 10
$ no = 10
(3) Variables are
case-sensitive, just
like filename in
Linux. For e.g.
$ no=10
$ No=11
$ NO=20
$ nO=2
Above all are
different
variable name,
so to print value
20 we have to
use $ echo $NO
and not any of
the following
# will print 10
but not 20
$ echo $No# will
print 11 but not 20
$ echo $nO# will
print 2 but not 20
You can define
NULL variable as
follows (NULL
variable is variable
which has no value
at the time of
definition) For e.g.
$
v
e
c
h
=
$
v
e
c
h
=
"
"
Try to print it's value by issuing following command
$ echo $vech
Nothing will be shown because variable has no value i.e. NULL
variable.
(4) Do not use ?,* etc, to name your variable names.
How to print or access value of UDV (User defined variables)
To print or access UDV use following syntax
Syntax:
$variablename
Define variable vech and n as follows:
$ vech=Bus
$ n=10
To print contains of variable 'vech' type
$ echo $vech
It will print 'Bus',To print contains of variable 'n' type command as
follows
$ echo $n
echo Command
Use echo command to display text or value of variable.
echo [options]
[string, variables...]
Displays text or
variables value on
screen.
Options
-n Do not output
the trailing new
line.
-e Enable
interpretati
on of the
following
backslash
escaped
characters
in the
strings:
a alert (bell)
b backspace
c suppress trailing
new line
n new line
r carriage return
t horizontal tab
 backslash
For e.g. $ echo -e
"An apple a day
keeps away
attdoctorn"
Shell Arithmetic
Use to perform
arithmetic
operations.
Syntax:
expr op1 math-operator op2
Examples:
$ expr 1 + 3
$ expr 2 - 1
$ expr 10 / 2
$ expr 20 % 3
$ expr 10 * 3
$ echo `expr 6 + 3`
Note:
expr 20 %3 - Remainder read as 20 mod 3 and remainder is 2.
expr 10 * 3 - Multiplication use * and not * since its wild card.
For the last statement not the following points
(1) First, before expr keyword we used ` (back quote) sign
not the (single quote i.e. ') sign. Back quote is generally found on
the key under tilde (~) on PC keyboard OR to the above of TAB
key.
(2) Second, expr is also end with ` i.e. back quote.
(3) Here expr 6 + 3 is evaluated to 9, then echo command
prints 9 as sum
(4) Here if you use double quote or single quote, it will NOT
work
For e.g.
$ echo "expr 6 + 3" # It
will print expr 6 + 3 $
echo 'expr 6 + 3' # It will
print expr 6 + 3
More about
Quotes
There are three
types of quotes
Quotes Name Meaning
“ Double
Quotes
“Double Quotes”- Anything enclose in Double Quote
removed meaning of that characters (except  & $)
‘ Single
Quote
‘Single Quote’-Enclosed in single quote remains
unchanged
` Back
Quote
`Back Quote`- To execute command
Example:
$ echo "Today is date"
Can't print message with today's date.
$ Echo "Today is `date`".
Exit Status
By default in Linux if particular command/shell script is executed, it return two type of
values which is used to see whether command or shell script executed is successful or
not.
(1) If return value is zero (0), command is successful.
(2) If return value is nonzero, command is not successful or some sort of error
executing command/shell script.
This value is know as Exit Status.
But how to find out exit status of command or shell script?
Simple, to determine this exit Status you can use $? Special variable of shell.
For e.g. (This example assumes that unknow1file doest not exist on your hard drive)
$ rm unknow1file
It will show error as follows
rm: cannot remove `unkowm1file': No such file or directory and
after that if you give command
$ echo $?
It will print nonzero value to indicate error. Now give command
$ ls
$ echo $?
It will print 0 to indicate command is successful.
The read Statement
Use to get input (data from user) from keyboard and store (data) to variable.
Syntax:
read variable1, variable2,...variableN
Following script first ask user, name and then waits to enter name from the user via
keyboard. Then user enters name from keyboard (after giving name you have to press
ENTER key) and entered name through keyboard is stored (assigned) to variable fname
Wild cards (Filename Shorthand or Meta Characters)
Wild card
Meaning Examples
/Shorthand
$ ls * will show all files
will show all files
$ ls a* whose first name is
starting with letter 'a'
Matches any string or group of
* $ ls *.c
will show all files
characters. having extension .c
will show all files
$ ls ut*.c
having extension .c
but file name must
begin with 'ut'.
will show all files
$ ls ? whose names are 1
character long
? Matches any single character. will show all files
$ ls fo?
whose names are 3
character long and file
name begin with fo
Matches any one of the
will show all files
[...] $ ls [abc]* beginning with letters
enclosed characters
a,b,c
Note:
[..-..] A pair of characters separated by a minus sign denotes a range.
Example:
$ ls /bin/[a-c]*
More command on one command line
Syntax:
command1;command2
To run two command with one command line.
Examples:
$ date;who
Will print today's date followed by users who are currently login. Note that You can't use
$ date who
for same purpose, you must put semicolon in between date and who command.
Command Line Processing
Try the following command (assumes that the file "grate_stories_of" is not exist on your
system)
$ ls grate_stories_of
It will print message something like - grate_stories_of: No such file or directory.
ls is the name of an actual command and shell executed this command when you type
command at shell prompt. Now it creates one more question What are commands? What
happened when you type $ ls grate_stories_of ?
The first word on command line is, ls - is name of the command to be executed.
Everything else on command line is taken as arguments to this command. For e.g.
$ tail +10 myf
Name of command is tail, and the arguments are +10 and myf.
Why Command Line arguments required
1. Telling the command/utility which option to use.
2. Informing the utility/command which file or group of files to process (reading/writing
of files).
Let's take rm command, which is used to remove file, but which file you want to remove
and how you will tail this to rm command (even rm command don't ask you name of file
that you would like to remove). So what we do is we write command as follows:
$ rm {file-name}
Here rm is command and filename is file which you would like to remove. This way you
tail rm command which file you would like to remove. So we are doing one way
communication with our command by specifying filename Also you can pass command
line arguments to your script to make it more users friendly. But how we access command
line argument in our script.
Lets take ls command
$ Ls -a /*
This command has 2 command line argument -a and /* is another. For shell script,
$ myshell foo bar
Shell Script name i.e. myshell
First command line argument passed to myshell i.e. foo
Second command line argument passed to myshell i.e. bar
In shell if we wish to refer this command line argument we refer above as follows
myshell it is $0
foo it is $1
bar it is $2
Here $# (built in shell variable ) will be 2 (Since foo and bar only two Arguments), Please
note at a time such 9 arguments can be used from $1..$9, You can also refer all of them by
using $* (which expand to `$1,$2...$9`). Note that $1..$9 i.e command line arguments to
shell script is know as "positional parameters".
Redirection of Standard output/input i.e. Input - Output redirection
Mostly all command gives output on screen or take input from keyboard, but in Linux
(and in other OSs also) it's possible to send output to file or to read input from file.
For e.g.
$ ls command gives output to screen; to send output to file of ls command give
command
$ ls > filename
It means put output of ls command to filename.
There are three main redirection symbols >,>>,<
(1) > Redirector Symbol Syntax:
Linux-command > filename
To output Linux-commands result (output of command or shell script) to file. Note that if file
already exist, it will be overwritten else new file is created. For e.g. To send output of ls
command give
$ ls > myfiles
Now if 'myfiles' file exist in your current directory it will be overwritten without any type of
warning.
(2) >> Redirector Symbol Syntax:
Linux-command >> filename
To output Linux-commands result (output of command or shell script) to END of file. Note
that if file exist , it will be opened and new information/data will be written to END of file,
without losing previous information/data, And if file is not exist, then new file is created.
For e.g. To send output of date command to already exist file give command
$ date >> myfiles
(3) < Redirector Symbol
Syntax:
Linux-command < filename
To take input to Linux-command from file instead of key-board. For e.g. To take input for
cat command give
$ cat < myfiles
Pipes
A pipe is a way to connect the output of one program to the input of another program
without any temporary file.
Pipe Defined as:
"A pipe is nothing but a temporary storage place where the output of one command is
stored and then passed as the input for second command. Pipes are used to run more than
two commands ( Multiple commands) from same command line."
Syntax:
command1 | command2
Examles
Command using Pipes Meaning or Use of Pipes
Output of ls command is given as input to
$ ls | more more command So that output is printed one
screen full page at a time.
Output of who command is given as input to
$ who | sort sort command So that it will print sorted list
of users
$ who | sort > user_list
Same as above except output of sort is send to
(redirected) user_list file
Output of who command is given as input to
$ who | wc –l wc command So that it will number of user
who logon to system
Output of ls command is given as input to wc
$ ls -l | wc –l command So that it will print number of files
in current directory.
Output of who command is given as input to
grep command So that it will print if
$ who | grep raju particular user name if he is logon or nothing
is printed (To see particular user is logon or
not)
What is Processes
Process is kind of program or task carried out by your PC. For e.g.
$ ls -lR
ls command or a request to list files in a directory and all subdirectory in your current
directory - It is a process.
Process defined as:
"A process is program (command given by user) to perform specific Job. In Linux when you
start process, it gives a number to process (called PID or process-id), PID starts from 0 to
65535."
Why Process required
As You know Linux is multi-user, multitasking Os. It means you can run more than two
process simultaneously if you wish. For e.g. To find how many files do you have on your
system you may give command like:
$ ls / -R | wc -l
This command will take lot of time to search all files on your system. So you can run such
command in Background or simultaneously by giving command like
$ ls / -R | wc -l &
The ampersand (&) at the end of command tells shells start process (ls / -R | wc - l) and
run it in background takes next command immediately.
Process & PID defined as:
"An instance of running command is called process and the number printed by shell is
called process-id (PID), this PID can be use to refer specific running process."
Linux Command Related with Process
Following tables most commonly used command(s) with process:
For this
purpose
Use this
Command
Examples
*
To see currently running process
To stop any process by PID i.e.
to kill process
To stop processes by name i.e.
to kill process
To get information about
all running process
To stop all process except your
shell
For background processing (With
&, use to put particular command
and program in background)
To display the
owner of the
processes
along with the
processes
ps
kill {PID}
killall {Process-name}
ps -ag
kill 0
linux-command &
ps aux
$ ps
$ kill 1012
$ killall httpd
$ ps -ag
$ kill 0
$ ls / -R | wc -l
&
$ ps aux
To see if a particular process is
running or not. For this purpose
you have to use ps command in
combination with the grep
command
To see currently running
processes and other information top
like memory and CPU usage with See the output of top
command.
real time updates.
To display a tree of
processes pstree
For e.g. you
want to see
whether
Apache web
ps ax |
grep
process-U-
want-to
server process
is running
see
or not then
give comm and
$ ps ax | grep
httpd
$ top
Note that to exit from top command press q.
$ pstree
* To run some of this command you need to be root or equivalnt user.
Making decision is important part in ONCE life as well as in computers logical driven
program. In fact logic is not LOGIC until you use decision making. This chapter
introduces to the bashs structured language constricts such as:
 Decision making
 Loops
Is there any difference making decision in Real life and with Computers? Well real life
decision are quit complicated to all of us and computers even don't have that much power
to understand our real life decisions. What computer know is 0 (zero) and 1 that is Yes or
No. To make this idea clear, lets play some game (WOW!) with bc - Linux calculator
program.
$ bc
After this command bc is started and waiting for your commands, i.e. give it some
calculation as follows type 5 + 2 as:
5 + 2
7 is response of bc i.e. addition of 5 + 2 you can even try
5 - 2
5 / 2
See what happened if you type 5 > 2 as follows
5 > 2
1 (One?) is response of bc, How? bc compare 5 with 2 as, Is 5 is greater then 2, (If I ask
same question to you, your answer will be YES), bc gives this 'YES' answer by showing 1
value. Now try
5 < 2
0
0 (Zero) indicates the false i.e. Is 5 is less than 2?, Your answer will be no which is
indicated by bc by showing 0 (Zero). Remember in BC, relational expression always
returns true (1) or false (0 - zero).
Try following in bc to clear your Idea and not down bc's response 5 > 12
5 == 10
5!= 2
5 == 5
12 < 2
Expression Meaning to us Your Answer BC's Response
5 > 12 Is 5 greater than 12 NO 0
5 == 10 Is 5 is equal to 10 NO 0
5 != 2 Is 5 is NOT equal to 2 YES 1
5 == 5 Is 5 is equal to 5 YES 1
1 < 2 Is 1 is less than 2 Yes 1
if condition
if condition
which is used for decision making in shell script, If given condition is true then command1
is executed.
Syntax:
if condition
then
command1 if condition is true or if exit status
of condition is 0 (zero)
...
...
fi
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1
Os 1

More Related Content

What's hot

TSTC Windows 8 Guide - Complete Edition
TSTC Windows 8 Guide - Complete EditionTSTC Windows 8 Guide - Complete Edition
TSTC Windows 8 Guide - Complete Edition
RickTaSTiC
 
OverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
OverDrive for Windows 8.1 and RT Handout with Hands-On ExercisesOverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
OverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
Nebraska Library Commission
 
Microsoft Windows 8.1 Power User Guide for Business - Presented by Atidan
Microsoft Windows 8.1 Power User Guide for Business - Presented by AtidanMicrosoft Windows 8.1 Power User Guide for Business - Presented by Atidan
Microsoft Windows 8.1 Power User Guide for Business - Presented by Atidan
David J Rosenthal
 
Windows 8 Release Preview -Product guide
Windows 8 Release Preview -Product guideWindows 8 Release Preview -Product guide
Windows 8 Release Preview -Product guide
Gautham Rajesh
 
Vista Users Guide
Vista Users GuideVista Users Guide
Vista Users Guide
noverm1
 

What's hot (20)

TSTC Windows 8 Guide - Complete Edition
TSTC Windows 8 Guide - Complete EditionTSTC Windows 8 Guide - Complete Edition
TSTC Windows 8 Guide - Complete Edition
 
Windows 8.1 is a worthy upgrade, with a few glitches
Windows 8.1 is a worthy upgrade, with a few glitchesWindows 8.1 is a worthy upgrade, with a few glitches
Windows 8.1 is a worthy upgrade, with a few glitches
 
Computer Basics
Computer BasicsComputer Basics
Computer Basics
 
Computer basicsclassnpl
Computer basicsclassnplComputer basicsclassnpl
Computer basicsclassnpl
 
Green hectares rural tech factsheet computer basics
Green hectares rural tech factsheet   computer basicsGreen hectares rural tech factsheet   computer basics
Green hectares rural tech factsheet computer basics
 
740688 001
740688 001740688 001
740688 001
 
OverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
OverDrive for Windows 8.1 and RT Handout with Hands-On ExercisesOverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
OverDrive for Windows 8.1 and RT Handout with Hands-On Exercises
 
Step-by-Step - Windows 7
Step-by-Step - Windows 7Step-by-Step - Windows 7
Step-by-Step - Windows 7
 
Microsoft Windows 8.1 Power User Guide for Business - Presented by Atidan
Microsoft Windows 8.1 Power User Guide for Business - Presented by AtidanMicrosoft Windows 8.1 Power User Guide for Business - Presented by Atidan
Microsoft Windows 8.1 Power User Guide for Business - Presented by Atidan
 
Windows 8 1 Power User Guide
Windows 8 1 Power User GuideWindows 8 1 Power User Guide
Windows 8 1 Power User Guide
 
89 identify the parts of a window desktop and common desktop icons
89 identify the parts of a window desktop and common desktop icons89 identify the parts of a window desktop and common desktop icons
89 identify the parts of a window desktop and common desktop icons
 
Basic computer-skills1
Basic computer-skills1Basic computer-skills1
Basic computer-skills1
 
Windows10TipsandTricksBooklet
Windows10TipsandTricksBookletWindows10TipsandTricksBooklet
Windows10TipsandTricksBooklet
 
Windows 8 Release Preview -Product guide
Windows 8 Release Preview -Product guideWindows 8 Release Preview -Product guide
Windows 8 Release Preview -Product guide
 
Windows7tipstrickspptversion 12599513345858-phpapp01
Windows7tipstrickspptversion 12599513345858-phpapp01Windows7tipstrickspptversion 12599513345858-phpapp01
Windows7tipstrickspptversion 12599513345858-phpapp01
 
Windows 8 1_power user guide
Windows 8 1_power user guideWindows 8 1_power user guide
Windows 8 1_power user guide
 
03 Windows Basics
03  Windows Basics03  Windows Basics
03 Windows Basics
 
Vista Users Guide
Vista Users GuideVista Users Guide
Vista Users Guide
 
Computer basics
Computer basicsComputer basics
Computer basics
 
Introduction of computer basic skills on windows 7
Introduction of computer basic skills on windows 7Introduction of computer basic skills on windows 7
Introduction of computer basic skills on windows 7
 

Similar to Os 1

Windows 8 brochure
Windows 8 brochureWindows 8 brochure
Windows 8 brochure
mart99
 
Windows Operating System1
Windows Operating System1Windows Operating System1
Windows Operating System1
bill balina
 
window_10_user_guide.pdf
window_10_user_guide.pdfwindow_10_user_guide.pdf
window_10_user_guide.pdf
Mertin2
 

Similar to Os 1 (20)

Windows 8 brochure
Windows 8 brochureWindows 8 brochure
Windows 8 brochure
 
W8 brochure download
W8 brochure downloadW8 brochure download
W8 brochure download
 
W8 brochure download
W8 brochure downloadW8 brochure download
W8 brochure download
 
Living in the IT Era L3.pptx
Living in the IT Era L3.pptxLiving in the IT Era L3.pptx
Living in the IT Era L3.pptx
 
Task bar and start menu in window 10 - Class IV
Task bar and start menu in window 10 - Class IVTask bar and start menu in window 10 - Class IV
Task bar and start menu in window 10 - Class IV
 
Lunch And Learn July 2009
Lunch And Learn July 2009Lunch And Learn July 2009
Lunch And Learn July 2009
 
Basic computer class
Basic computer classBasic computer class
Basic computer class
 
Tips and tricks for navigating the new windows 8 user interface
Tips and tricks for navigating the new windows 8 user interfaceTips and tricks for navigating the new windows 8 user interface
Tips and tricks for navigating the new windows 8 user interface
 
manual de Windows8
manual de Windows8manual de Windows8
manual de Windows8
 
Reviewer-CCS-L3.pptx
Reviewer-CCS-L3.pptxReviewer-CCS-L3.pptx
Reviewer-CCS-L3.pptx
 
Windows 8-cheat-sheet
Windows 8-cheat-sheetWindows 8-cheat-sheet
Windows 8-cheat-sheet
 
Windows 8-cheat-sheet
Windows 8-cheat-sheetWindows 8-cheat-sheet
Windows 8-cheat-sheet
 
Introduction to windows xp
Introduction to windows xpIntroduction to windows xp
Introduction to windows xp
 
Windows Operating System
Windows Operating SystemWindows Operating System
Windows Operating System
 
Windows Operating System1
Windows Operating System1Windows Operating System1
Windows Operating System1
 
Windows 8 Preview
Windows 8 PreviewWindows 8 Preview
Windows 8 Preview
 
window_10_user_guide.pdf
window_10_user_guide.pdfwindow_10_user_guide.pdf
window_10_user_guide.pdf
 
Windowstechnicalpreviewqg
WindowstechnicalpreviewqgWindowstechnicalpreviewqg
Windowstechnicalpreviewqg
 
Windows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.comWindows 10 Technical Preview - http://f2suporte.blogspot.com
Windows 10 Technical Preview - http://f2suporte.blogspot.com
 
Understanding the Windows 8 Start Screen - by Denver Network Support Company
Understanding the Windows 8 Start Screen - by Denver Network Support CompanyUnderstanding the Windows 8 Start Screen - by Denver Network Support Company
Understanding the Windows 8 Start Screen - by Denver Network Support Company
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 

Recently uploaded (20)

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 

Os 1

  • 1. PRACTICAL :-1 Aim:-Write a Program to Study Windows Operating System: Windows 8 Windows 8 is a completely redesigned operating system developed from the ground up with touchscreen use in mind as well as near instant-on capabilities that enable a Windows 8 PC to load and start up in a matter of seconds rather than in minutes. Windows 8 Vocabulary  Apps - "App" is another word for program. In Windows 8 , some apps come built-in to Windows, and there are even more available in the Windows Store.  Live Tiles – Interactive apps that take advantage of Internet access to provide real-time updates.  Hot Corners - The corners on your screen are hot corners and give you access to different Windows features.  Charms Bar - Contains a set of buttons and commands that control the application you are currently using, as well as provide options for system settings. The Charms bar includes many of the features previously available from the Start button.  Metro-style - New layout of Windows 8 with tiles and apps instead of the standard desktop with a Start button.  Mobile - Windows 8 is designed for mobile devices, such as tablets. You can also sign into your Windows 8 screen anywhere using your Live ID, and your customized settings travel with you.  Touch-centric – Touch is a key element in Windows 8; however, a traditional mouse and keyboard can be used as well.  Speed Bump - The small gap between groups of tiles. Speed bumps can be added to create new groups. Where Do I Find:  Shut down - Move your mouse to the upper right corner of the screen, and move your mouse down until you see your charms appear. Click Settings. Then click Power, and Shut Down.  Desktop - When you log into Windows 8, you will be taken to the Metro Start Screen. There you will see various apps. Click on the app labeled Desktop.  Run Command - You can get to Run a few ways. First, you can right-click anywhere on the start screen that isn’t an app and click All Apps on the bottom toolbar. Scroll over until you find  Run. You can also move your mouse to the upper right corner of the screen, move your mouse pointer down, and then click Search. Enter ‘Run’ in the search box, click Apps, and then click Run. The easiest way to get to Run is to press the Windows key + R.  Control Panel - Move your mouse to the upper right corner of the screen, move the mouse pointer down, and then click Search. Enter Control Panel in the search box, click Apps, and then click Control Panel. Features: Touch Screen The Windows 8 interface is designed to be used with touchscreens, as well as with a mouse and keyboard. This new interface is intuitive on a
  • 2. tablet, but not so much on a desktop computer. When using Windows 8 on a touchscreen, you can simply use your finger or a stylus to navigate through the different features. You will scroll to the left/right, not up/down. New Start Screen Windows 8 comes with a Start screen, not a Start button. Your apps appear on your start screen when you log in. Apps (such as weather, time, email, and news) display real time info. You can also rearrange your apps and make apps larger or smaller. Right-click on an app. A toolbar will appear at the bottom for you to make app smaller, larger, or delete it from Start screen. If you want to add a new app to the Start screen, you first need to find it. This can be done by using the Metro Search to look for the app or program that you would like to add. To search, simply start typing the name of the app or program that you would like to find. To add the app to the Start screen, right-click on it with your mouse or hold your finger on it till it becomes checked. You will then see a panel open at the bottom of the Windows 8 Start screen where you can pin it. Just click on the Pin button and the program will now appear on your Windows 8 Start screen. To view all apps, right-click on the background (not on an app). A toolbar will appear on the bottom. Click All Apps in the bottom right corner.
  • 3. All the apps will appear on a grid. You can scroll to the right to view all of them. Opening/Switching/C losing Apps To open an app, just click on the app you wish to use. To switch between open apps, move your mouse to the upper left corner and move mouse pointer down the left side. A bar will appear showing the apps you have open. Click on the app you wish to go to. You can also move your mouse to the bottom left corner to go back to your previous app. To close apps, click the top of the app and drag it to the bottom of the screen. You can also go to the upper left corner and make all open apps appear, right click on the app you want to close. Click Close. Apps designed for Windows 8 do not have a File menu, Close, Minimize, or Resize buttons. Instead app commands are available at the bottom of the window when you swipe up or down from either edge or by right-clicking. Live Apps Windows 8 offers Live Apps, providing you with real time weather, news, mail, sports etc. Just right-click on the live tile and you will get the option to turn on or off the live tile update Feature. Swipe at the top/bottom of screen or right-click to make the App bar appear with additional options. You can pin an app to the left or right side of the screen by pressing the Windows key +. (period) or by dragging the top of the tile to the left or right. Personalize In Windows 8, you can easily organize apps. To put apps into a group, select an app and drag it into an empty space where you want to create a group. Once the vertical bar is displayed in the middle, release the app and it will automatically create a new group.
  • 4. To name your group, click the Zoom out icon in the lower right corner next to the scroll bar. Once you are in the zoomed out view, you will be able to drag around your groups and also name them. While zoomed out, right-click on the group and select Name Group to set a name. Click the Zoom button again to return to normal view. Desktop In Windows 8, you also still have a desktop. The desktop is available for file management and legacy programs. Your Desktop will appear when you run desktop-based applications (from the Start screen). You can also choose Desktop from the apps on the Start screen. Navigation In Windows 8, you can scroll across the screen by simply placing your mouse on the edge of the screen. Windows 8 also boasts hot corners, which activate different features.  The top and bottom right side of the page brings up the Charm bar.  The upper left corner previews open apps; dragging from the left-side does as well.  The bottom left corner takes you to previous apps in use or the Start screen.  By clicking on the left side of the screen, you can switch across apps.  The hot corners apply on the Desktop, as well. To get back to the Start screen from anywhere on your computer, you can simply press the
  • 5. Windows button on your keyboard. Restart/Shut Down/Sleep In Windows 8, there's really no need to shut down your PC completely. Instead, you can put it to sleep. This uses very little power, your PC starts up faster, and you are instantly back to where you left off. You don’t have to worry that your battery will be drained because Windows automatically saves all your work and turns off the PC if the battery is too low. To restart, shut down, or hibernate in Windows 8, put your mouse cursor into the upper right corner to bring up your Charms bar. Click on the Settings charm and a sidebar will appear on the right side of screen. There you can click on the Power button to select the desired option. Charms Bar The Charms bar provides quick access to a variety of features and utilities. A clock with battery charge status will appear when you activate the Charms bar. Along the right screen, you will see: Search, Share, Start, Devices, and Settings 2  Search - With the Search charm, you can search for anything. You can search just the app you are in (finding a specific message in Mail), search another app (looking something up on the Internet), or search your entire PC (for an app, setting, or file).  Share - When you are in a specific app, you can use the Share charm to share files, photos, or webpages with people you know. Select the item you want to share, open the charms, and then tap or click Share.  Start - You can always get back to the Start screen by using the Start charm. Open the charms and then tap or click Start. If you are already on Start, you can use this charm to get back to the last app you used.
  • 6.  Devices - You will mainly use the Devices charm to set up printers and print documents, but you can also use it to sync info with your phone and stream video to your wireless TV. Open the charms and then tap or click Devices to see all the devices connected to your PC at any time.  Settings - You can use the Settings charm to personalize your PC by changing things like your account picture and the background and color of your Start screen. If you are in an app, you can use the Settings charm to get to the settings for that specific app. There are also some common settings, like volume and brightness, that you can get to quickly. For more settings and ways to personalize your PC, open the Settings charm and then tap or click Change PC settings. No Search You won’t find a search button in Windows 8. Instead, start typing anywhere and a search box will appear and give you results. You can search within an app by choosing the app in the search pane. File Explorer
  • 7. File Explorer is where you can access all the content you have stored on your computer, and manipulate it. You can copy it, move it, rename it, delete it, and so on. You can open File Explorer a few different ways:  Entering File Explorer in the search box  Clicking Apps, and then Clicking File Explorer  Opening the Desktop app, and opening File Explorer on the bottom toolbar File Explorer has a new feature called the Ribbon. Use the Ribbon for common tasks, such as copying and moving, creating new folders, emailing and zipping items, and changing the view. If you don’t like the ribbon, you have the option to hide it. Click the arrow on the far right side of the menu bar to hide the ribbon. Access your Windows from Anywhere Log in on any Windows 8 PC with your Live ID, and get your own personalized settings. When you buy a Windows 8 PC and set up your user account for the first time, you can optionally choose to create an account that is associated to a Windows Live ID. You can either use an existing ID or create a new one. If you choose to create a new one, you can use any email address you want as your new ID, and then create your unique password. For example, you can use example@live.com or you can use someone@example.com. You just need to identify an email address that you want to have associated with the Windows Live ID service, and provide a unique password. Of course, you can also continue to use local Windows accounts as you always have and obviously, domain-administered accounts work as they always have as well. Remote Desktop With Remote Desktop Connection, you can sit at a PC and connect to another PC in a different location (the remote PC). For example, you can connect to your work PC from your home PC and use all of your apps, files, and network resources as if you were sitting right in front of your work PC. You can leave apps open at work and then see those same apps on your home PC. To connect to a remote computer, that computer must be turned on, it must have a network connection, Remote Desktop must be enabled, you must have network access to the remote computer (this could be through the Internet), and you must have permission to connect. Click on the Desktop app on your Start screen.
  • 8. Open Remote Desktop Connection by clicking the Search charm. In the search box, type Remote Desktop Connection, and then, in the list of results, click Remote Desktop Connection. In the Computer box, type the name of the computer that you want to connect to, and then click Connect. (You can also type the IP address instead of the computer name.) Internet Explorer 10 With Internet Explorer 10 you might notice something different about the web—it’s bigger, bolder, and optimized for touch. Tabs, buttons, and toolbars are now easily accessible when you need them, but quietly get out of the way when you don't. By learning a few simple actions, you'll be able to comfortably use your new browser.  Adobe Flash Integration - Internet Explorer 10 includes a built- in Adobe Flash Player. In the App version of IE10, only some of the features of Adobe Flash will be included due to battery life, performance, and security purposes.  Flip Ahead - Allows you to quickly advance to the next page in a website with a swipe gesture on touchscreen devices or a forward button using a mouse.  User Interface - The desktop version of Internet Explorer 10 (available for Windows 7 and Windows 8) retains the user interface of Internet Explorer 9 with minor refinements, such as removing gradients. The Metro version of Internet Explorer 10 (available on Windows 8) includes a new UI, most of which is hidden so that the webpage being viewed takes up the entire screen. Cloud Sync Now you can configure your Windows Live account and us to login to the device. Windows also allows you to keep your settings synced to cloud through your live account. If you are on the move and use multiple PCs or you have multiple devices running Windows 8, cloud sync will be really helpful. Google chrome allowed to sync only the browser settings such as bookmarks, themes etc. to cloud; now Windows 8 enables syncing all the OS settings such as test bar settings, app settings themes etc. This feature is termed as Roaming Profile, and it makes use of your Windows live account. Ribbon Interface Ribbon interface which was introduced with MS Office 2007 was used on applications such as Paintbrush on Windows 7. Now even Windows Explorer gets the ribbon interface. They are planning to make the ribbon interface a standard across all the applications that ship with the OS.
  • 9. Windows 8 Ribbon What is New in Windows 8.1 1. Support for new device types Windows 8.1 has the same device requirements as Windows 8 and will run on most PC hardware that was originally designed for windows vista or windows 7. That makes it possible to evaluate Windows 8.1 on a device that is not currently in production. Thus, to see Windows 8.1 at its best, you really need to see it in action on a variety of devices, including modern hardware with touchscreen and processors and power management subsystems engineering specially to work with Windows 8.1. However, the core design principles of windows 8.1 allows movement to pervasive computing. Users are no longer tied to a desktop but instead can use multiple devices, choosing each device for its suitability to the task at hand. With proper management controls, these devices can switch easily between personal files, digital media and enterprise resources and however combined with robust online services. 2. User Experience This new generation of hardware benefits greatly from the Windows 8 user experience. Touchscreen functions as the primary form of input on a mobile devices; on more traditional PC from factors, touch becomes an equal partner to the keyboard and mouse. Here is a partial list of important changes in the windows 8.1 user experience: a. Two new tile sizes on the start screen are available in addition to the two sizes used in windows 8. b. Customizing the start screen is much easier and new Apps view let you quickly sort and arrange the list installed Apps. c. Enhancements to the Touch Keyboard make it possible to type fasters and more accurately. 3. User Account and Synchronization One of the most significant changes in Windows 8 is support for a third user account type in addition to the familiar local and domain accounts. Signing in with a Microsoft account instead of a local account provides tightly integrated support for cloud-based files storage (worth 7GBs of free SkyDrive storage). Windows 8.1 expands the list of settings that can be synchronized, including the layout of the start screen, and it can automatically download and install windows store apps when you sign in with a Microsoft account on a new devices. It also adds the ability to automatically back up settings that cannot be synced. This feature makes it possible to roam easily between devices, with personal settings, apps, and browser tabs, history and favorites from each derives. 4. Support for Apps Windows 8 includes support for virtually all desktop programs that are compatible with Windows 7. It also supports a new programming model design for immersive touch enable apps that are secure, reliable and optimized for mobility. For Windows 8.1, the windows store has been
  • 10. completely redesigned, with the goal of making it easier to discover useful apps. Windows 8.1 also includes a handful of new first party (Microsoft authored) apps as well as a complete refresh of the apps included with a default installation of windows 8. 5. Security enhancements. Microsoft’s commitment to securing Windows is substantial, and it includes some ground breaking advanced features. As part of the ongoing effort to make computing safer, windows introduced major new security features and windows 8.1 adds still more improvement. Perhaps, aside from the major security features introduced by Windows 8 such as Trusted boot (the feature that protects the integrity of the remainder of the boot process, including kernel, system files, boot-critical drivers etc.), Windows Defender (a full feature antispyware), for the first time in Windows 8.1. Defender includes network behavior monitor; Windows Smart Screen (is a safety feature that uses application reputation based tech to help protect windows users from malicious software that require users’ names, password and billing data ). Notwithstanding, Windows 8.1 adds significant new security capabilities to that already robust features of Window 8, let us take a look: a. Improved Biometric feature: All windows 8.1. Editions end to end biometric feature enable authenticating with your biometric identity anywhere in Windows including Windows sign-in, remote access, user account control and so on. Windows 8.1 is optimized for fingerprint based biometrics and includes a common fingerprint enrollment experience that works with various touch-based readers. b. Remote Business data Removal (RBDR): Here, administrator can mark and encrypt corporate content to distinguish it from ordinary user data. When the relationship between the organization and the user ends, the encrypted corporate data can be wiped on command using exchange ActiveSync. c. Pervasive Device Encryption: Device encryption is now available in all editions of windows 8.1 it is enabled out of the box and can be configured with additional BitLocker protection and management capability on the Pro and Enterprises edition. 6. Deployment and migration: Windows 8.1 in an organization is faster and easier than in windows 7. Enhanced tools help you make the right decisions with minimal downtime for users. A new version of the application compatibility toolkit helps you understand potential application compatibility issues by identifying which apps are or not compatible with windows 8. In those days, migrating user data from windows installations can be automated with the user state migration tool. 7. AppLocker: Now available in Windows 8.1, this tool is a simple and flexible mechanism that allows you to specify exactly which apps are allowed to run on user’s PC. Here, an administrator creates security policies through group policy that prevent apps from running unless they are on an approval list. 8. Virtualization
  • 11. Window 8 is the first desktop version of windows to include a robust built in virtualization platform known as Hyper-V. Client Hyper-V uses the same hypervisor found in Windows server allowing user to create virtual machines capable of running 32 bit and 64 bit version of windows. With the advent of Windows 8.1, VMs can be migrated easily between a desktop PC running Windows 8 or 8.1 and a Hyper-V environment on windows server. Finally, numerous features are integrated in the Windows 81. Which I have not mentioned, not because they are less important but because the features mentioned above are the major features and most obvious. However, we can say in a nutshell that other features such as Workplace join, work folders, open MDM, Mobile device management, Web application proxy, RDS enhancements, NFC Tap-to-pair printing, Wi-Fi direct printing, Native Miracast wireless display, Auto triggered VPN, broadband tethering and many others exist in the windows 8.1. 9. Fast Booting Windows boasts of its fast booting ability. Here is a demo shared by Microsoft recently which proves it. 10. Performance Boost Performance of the OS was considered as primary criteria while developing the OS. In fact, Windows 8 has better performance than Windows 7. The OS makes optimum use of multi-core processors and virtualization to provide best performance. You might have noticed that earlier OSes were not optimized for multi-core processors, if a resource hungry application starts, it used to run on only one core instead of utilizing all the available cores. Applications start faster and take less time to be ready for you to use. The test manager has been redesigned to enable easy access to basic functions and advanced functions. You can even do start-up settings through task manager instead of going to msconfig. Hardware Requirements Microsoft has been raising the hardware requirements bar since its first version of windows OS. This is the first version of windows which runs on the same hardware requirements as that of Windows 7 and to some extent lesser. For example Microsoft quoted that Windows 8 can run on an Intel Atom based device with 1GB RAM and will run better than Windows 7. That is really nice because one need not dump an old netpad just to upgrade the OS. As of now there is no official citation of the minimum hardware requirements; we will have to wait and see.
  • 12. TECHNICAL SPECIFICATIONS FOR WINDOWS 8.1 As far as technical specifications for windows 8.1 are concern, we have to really understand them because they matter a lot. Previous windows operating systems came with a more complicated requirements if compared with Windows 8.1, especially when it comes to deployment. Previously, it takes at least 30-40 mins deploy a windows OS, but with the coming of Windows 8.1 deployment takes less than 20 mins depending on the hardware. To understand the requirements, let us carefully take a look at the below table. Component Recommendation Processor 1 GHz or more Memory 32-bit PCs: 1 GB 64-bit PCs: 2 GBs Hard Disk space 32-bit PCs: 16 GB 64-bit PCs: 20 GBs Graphics Card Microsoft DirectX 9 graphics devic WDDM driver In order to use a suitable deployment strategy, Windows 8.1 comes with numerous strategies that would be suitable for any organization as well as the hardware used in that organization. However, Microsoft recommends a few targeted strategies for deploying windows 8.1. Hence, for client PCs that are already running Windows 8, an in-place upgrade is the fastest, simple and most reliable alternative, accomplished either by installing the windows 8.1 update package or by refreshing the operating system. As for enterprise that wish to deploy Windows on new or existing hardware that is not already running windows, the following list described the four recommended deployment strategies: a. High Touch with retail media: This is simply the deployment where you install windows on each client by using retail installation media and then manual configure it. b. High touch with standard image: Here, similar to high touch with retail media, but it uses an operating system image that includes your customizations and application configurations. c. Life Touch, High-Volume deployment: This method requires limited interaction during deployment. Interaction occurs at the beginning of the installation, but the remainder of the process is automated. d. Zero Touch, High Volume deployment: This strategy requires no interaction during deployment. The process is fully automated by using system center configuration manager. WINDOWS 8.1 PLATFORM ARCHITECTURE. It is obvious that Windows 8.1 has one of the most amazing platform especially from the application point of view. Though, not much will be
  • 13. discuss on this due to lack of sufficient evidence to support any claim to be made. However, the following figure/image will give the reader an over view of the platform architecture. Platforms Supported Windows 8 runs on a variety of platforms starting from tables made by different vendors to netbooks, laptops PCs and servers. OS detects the hardware capabilities and then decides the functionality that are supported by such hardware on the fly. This avoids all the confusion about different OSs for different platforms and the cascading compatibility issues. Since one OS fits all, upgrading and maintaining will become very simple. Here is a nice video from Computex 2011 which highlights the different devices supported by Windows Removed features Several notable features have been removed in Windows 8; support for playing DVD-Video was removed from Windows Media Player due to the cost of licensing the necessary decoders (especially for devices which do not include optical disc drives at all) and the prevalence of online streaming services. For the same reasons, Windows Media Center is not included by default on Windows 8, but Windows Media Center and DVD playback support can be purchased in the "Pro Pack" (which upgrades the system to Windows 8 Pro) or "Media Center Pack" add-on for Windows 8 Pro. As with prior versions, third-party DVD player software can still be used to enable DVD playback. Backup and Restore, the backup component of Windows, is deprecated. It still ships with Windows 8 and continues to work on preset schedules, but is pushed to the background and can only be accessed through a Control Panel applet called "Windows 7 File Recovery".Shadow Copy, a component of Windows Explorer that once saved previous versions of changed files, no longer protects local files and folders. It can only access previous versions of shared files stored on a Windows Server computer. The subsystem on which these components worked, however, is still available for other software to use.
  • 14.
  • 15. PRACTICAL NO-2 Aim:-Write a Program to Study of Linux: Linux Linux (also known as GNU/Linux) is one of the most prominent examples of free software and open source development which means that typically all underlying source code can be freely modified, used, and redistributed by anyone. The name “Linux” comes from the Linux kernel, started in 1991 by Linus Torvalds. The system’s utilities and libraries usually come from the GNU operating system (which is why it is also known as GNU/Linux). Linux is predominantly known for its use in servers. It is also used as an operating system for a wide variety of computer hardware, including desktop computers, supercomputers, video game systems, and embedded devices such as mobile phones and routers. Design Linux is a modular Unix-like OS. It derives much of its basic design from principles established in Unix during the 1970s and 1980s. Linux uses a monolithic kernel which handles process control, networking, and peripheral and file system access. The device drivers are integrated directly with the kernel. Much of Linux’s higher - level functionality is provided by seperate projects which interface with the kernel. The GNU userland is an important part of most Linux systems, providing the shell and Unix tools which carry out many basic OS tasks. On top of the kernel, these tools form a Linux system with a GUI that can be used, usually running in the X Windows System (X).Linux can be controlled by one or more of a text-based command line interface (CLI), GUI, or through controls on the device itself (like on embedded machines). Desktop machines have 3 popular user interfaces (UIs): KDE, GNOME, and Xfce. These UIs run on top of X, which provides network transparency, enabling a graphical application running on one machine to be displayed and controlled from another (that’s like running a game on your computer but your friend’s computer can control and see the game from his computer). The window manager provides a means to control the placement and appearanceof individual application windows, and interacts with the X window system. A Linux system usually provides a CLI of some sort through a shell. Linux distros for a server might only use a CLI and nothing else. Most low-level Linux components use the CLI exclusively. The CLI is particularly suited for automation of repetitive or delayed tasks, and provides very simple inter-process communication. A graphical terminal is often used to access the CLI from a Linux Desktop.
  • 16. Development The primary difference between Linux and many other OSs is that the Linux kernel and other components are free and open source software. Free software projects, although developed in a collaborative fashion, are often produced independently of each other. A Linux distribution, commonly called a “distro”, is a project that manages a remote collection of Linux-based software, and facilitates installation of a Linux OS. Distros include system software and application software in the form of packages. A distribution is responsible for the default configuration of installed Linux systems, system security, and more generally integration of the different software packages into a coherent whole. Linux is largely driven by its developer and user communities. Some vendors develop and fund their distros on a volunteer basis. Others maintain a community version of their commercial distros. In many cities and regions, local associations known as Linux Users Groups (LUGs) promote Linux and free software. There are also many online communities that seek to provide support to Linux users and developers. Most distros also have IRC chatrooms or newsgroups for communication. Online forums are another means for support. Linux distros host mailing lists also. Most Linux distros support dozens of programming languages. The most common collection of utilities for building both Linux applications and OS programs is found within the GNU toolchain, which includes the GNU Compiler Collection (GCC) and the GNU build system. GCC provides compilers for Ada, C, C++, Java, and Fortran. Most distros also include support for Perl, Ruby, Python and other dynamic languages. The two main frameworks for developing graphical applications are those of GNOME and KDE. As well as those designed for general purpose use on desktops and servers, distros may be specialized for different purposes including: computer architecture support, embedded systems, stability, security, localization to a specific region or language, targeting of specific user groups, support for real-time applications, or commitment to a given desktop environment. Linux runs on a more diverse range of computer architecture than any other OS. Although there is a lack of Linux ports for some Mac OS X and Microsoft Windows programs in domains such as desktop publishing and professional audio, applications roughly equivalent to those available for OS X and Windows are available for Linux. Most Linux distros have some sort of program for browsing through a list of free software applications that have already been tested and configured for the specific distro. There are many free software titles popular on Windows that are available for Linux the same way there are a growing amount of proprietary software that is being supported for Linux. Background: Linux is based on Unix ♦ Unix Philosophy
  • 17. ♦ Unix commands ♦ Unix standards and conventions Architecture: ♦ The shell and the window environment are programs ♦ Programs’ only access to hardware is via the kernel What is Linux? ♦ Linux kernel Developed by Linus Torvalds Strictly speaking, ‘Linux’ is just the kernel ♦ Associated utilities Standard tools found on (nearly) all Linux systems Many important parts come from the GNU project i. Free Software Foundation’s project to make a free Unix ii. Some claim the OS as a whole should be ‘GNU/Linux’ ♦ Linux distributions Kernel plus utilities plus other tools, packaged up for end users Generally with installation program Distributors include: Red Hat, Debian, SuSE, Mandrake Getting Started with Linux Using a Linux System ♦ Login prompt displayed o When Linux first loads after booting the computer o After another user has logged out ♦ Need to enter a username and password ♦ The login prompt may be graphical or simple text ♦ If text, logging in will present a shell ♦ If graphical, logging in will present a desktop o Some combination of mouse movements and keystrokes will make a terminal window appear o A shell runs in the terminal window Linux Command Line The shell is where commands are invoked ♦ A command is typed at a shell prompt o Prompt usually ends in a dollar sign ($) ♦ After typing a command press Enter to invoke it o The shell will try to obey the command o Another prompt will appear ♦ Example: $ date Sat March 01 11:59:05 BST 2008 $ ♦ The dollar represents the prompt in this course, do not type it
  • 18. 2.2.3 Logging Out ♦ To exit from the shell, use the exit command ♦ Pressin g Ctrl+D at the shell prompt will also quit the shell Quittin g all progra ms should log you out If in a text- only single- shell environ ment, exiting the shell should be sufficie nt ♦ In a window environment, the window manager should have a log out command for this purpose ♦ After logging out, a new login prompt should be displayed Command Syntax ♦ Most commands take parameters ♦ Some commands require them ♦ Parameters are also known as arguments o For example, echo simply displays its arguments: $ echo $ echo Hello there Hello there ♦ Commands are case-sensitive o Usually lower-case $ echo whisper whisper $ ECHO SHOUT bash: ECHO: command not found Files ♦ Data can be stored in a file ♦ Each file has a filename A label referring to a particular file Permitted characters include letters, digits, hyphens (-), underscores (_), and dots (.) o Case-sensitive — NewsCrew.mov is a different file from NewScrew.mov ♦ The ls command lists the names of files Creating Files with cat ♦ There are many ways of creating a file ♦ One of the simplest is with the cat command: $ cat > shopping_list Cucumber Bread Yoghurts fish fingers ♦ Note the greater-than sign (>) — this is necessary to create the file ♦ The text typed is written to a file with the specified name
  • 19. ♦ Press Ctrl+D after a line- break to denote the end of the file. The next shell prompt is displayed ♦ ls demonstrates the existence of the new file Displaying Files’ Contents with cat ♦ There are many ways of viewing the contents of a file ♦ One of the simplest is with the cat command: $ cat shopping_list Cucumber bread yoghurts fish fingers ♦ Note that no greater-than sign is used ♦ The text in the file is displayed immediately: o Starting on the line after the command o Before the next shell prompt Deleting Files with rm ♦ To delete a file, use the rm (‘remove’) command ♦ Simply pass the name of the file to be deleted as an argument: $ rm shopping_list The file and its contents are removed There is no recycle bin o There is no ‘unrm’ command ♦ The ls command can be used to confirm the deletion Unix Command Feedback ♦ Typically, successful commands do not give any output ♦ Messages are displayed in the case of errors ♦ The rm command is typical o If it manages to delete the specified file, it does so silently o There is no ‘File shopping list has been removed’ message o But if the command fails for whatever reason, a message is displayed ♦ The silence can be off-putting for beginners ♦ It is standard behavior, and doesn’t take long to get used to Copying and Renaming Files with cp and mv ♦ To copy the contents of a file into another file, use the cp command: $ cp CV.pdf old-CV.pdf ♦ To rename a file use the mv (‘move’) command: $ mv commitee_minutes.txt committee_minutes.txt. Similar to using cp then rm
  • 20. ♦ For both commands, the existing name is specified as the first argument and the new name as the second. If a file with the new name already exists, it is overwritten Filename Completion ♦ The shell can making typing filenames easier ♦ Once an unambiguous prefix has been typed, pressing Tab will automatically ‘type’ the rest ♦ For example, after typing this: $ rm sho pressing Tab may turn it into this: $ rm shopping_list ♦ This also works with command names - For example, da may be completed to date if no other commands start ‘da’ Command History ♦ Often it is desired to repeat a previously-executed command ♦ The shell keeps a command history for this purpose Use the Up and Down cursor keys to scroll through the list of previous commands Press Enter to execute the displayed command ♦ Commands can also be edited before being run a. Particularly useful for fixing a typo in the previous command b. The Left and Right cursor keys navigate across a command c. Extra characters can be typed at any point d. Backspace deletes characters to the left of the cursor o Del and Ctrl+D delete characters to the right  Take care not to log out by holding down Ctrl+D too long PRACTICAL NO-3 Aim:-Write a Program to Study of Linux Operating System using Linux Kernel: Linux kernel The central nervous system of Linux is the kernel, the operating system code that runs the whole computer. The kernel is under constant development and is always available in both the latest stable release and the latest experimental release. Progress on development is very fast, and the recent 2.2-series kernels are simply amazing on all counts. The kernel design is modular, so that the actual OS code is very small, yet able to load whatever functionality it needs when it needs it, and then free the memory afterwards. Because of this, the kernel remains small and fast yet highly extensible, in comparison to other operating systems which slow down the computer and waste memory by loading everything all the time, whether you need it or not.
  • 21. The Linux kernel is the heart of Linux operating system and was originally developed for the Intel 80386 CPU’s. Memory management is especially strong with the 80386 (compared to earlier CPU’s). Linux kernel has the ability to have full access to the entire hardware capabilities of the machine. Actually there is no restriction on what a kernel module is allowed to do. Typically a kernel might implement a device driver, a file system or a networking protocol. To support large memory requirements when only small amounts of physical RAM are available, Linux supports swap space. Swap space (discussed in detail in Book II) allows pages of memory to be written to a reserved area of a disk and treated as an extension of physical memory. By moving pages back and forth between the swap space and RAM, Linux can effectively behave as if it had much more physical RAM than it does. Besides this, Linux kernel support the following features: • Has memory protection between processes, so that one prog can't bring the whole system down. • Demand loads executables : Linux only reads from disk those parts of a program that are actually used. Functionalities:
  • 22. The Linux kernel is monolithic, which means that the entire OS runs solely in supervisor mode. Though the kernel is a single process, it consists of various subsystems and each subsystem is responsible for performing certain tasks. Broadly, any kernel performs the following main tasks. 1) Process management: This subsystem handles the process life-cycle. It creates and destroys processes, allowing communication and data sharing between processes through inter- process communication (IPC). Additionally, with the help of the process scheduler, it schedules processes and enables resource sharing. 2) Memory management: This subsystem handles all memory related requests. Available memory is divided into chunks of a fixed size called pages, which are allocated or de-allocated to/from the process, on demand. With the help of the memory management unit (MMU), it maps the process virtual address space to a physical address space and creates the illusion of a contiguous large address space. 3) File system: The GNU/Linux system is heavily dependent on the file system. In GNU/Linux, almost everything is a file. This subsystem handles all storage related requirements like the creation and deletion of files, compression and journaling of data, the organisation of data in a hierarchical manner, and so on. The Linux kernel supports all major file systems including MS Windows NTFS. 4) Device control: Any computer system requires various devices. But to make the devices usable, there should be a device driver and this layer provides that functionality. There are various types of drivers present, like graphics drivers, a Bluetooth driver, audio/video drivers and so on. 5) Networking: Networking is one of the important aspects of any OS. It allows communication and data transfer between hosts. It collects, identifies and transmits network packets. Additionally, it also enables routing functionality. 6) Dynamically loadable kernel modules: We often install kernel updates and security patches to make sure our system is up-to-date. In case of MS Windows, a reboot is often required, but this is not always acceptable; for instance, the machine cannot be rebooted if is a production server. Wouldnt it be great if we could add or remove functionality to/from the kernel on-the-fly without a system reboot? The Linux kernel allows dynamic loading and unloading of kernel modules. Any piece of code that can be added to the kernel at runtime is called a kernel module. Modules can be loaded or unloaded while the system is up and running
  • 23. without any interruption. A kernel module is an object code that can be dynamically linked to the running kernel using the insmod command and can be unlinked using the rmmod command 7) A few useful utilities: GNU/Linux provides various user-space utilities that provide useful information about the kernel modules. Let us explore them. ♦ lsmod: This command lists the currently loaded kernel modules. This is a very simple program which reads the /proc/modules file and displays its contents in a formatted manner. ♦ insmod: This is also a trivial program which inserts a module in the kernel. This command doesnt handle module dependencies. ♦ rmmod: As the name suggests, this command is used to unload modules from the kernel. Unloading is done only if the current module is not in use. rmmod also supports the -f or –-force option, which can unload modules forcibly. But this option is extremely dangerous. There is a safer way to remove modules. With the -w or –-wait option, rmmod will isolate the module and wait until the module is no longer used. ♦ modinfo: This command displays information about the module that was passed as a command-line argument. If the argument is not a filename, then it searches the /lib/modules/<version> directory for modules. modinfo shows each attribute of the module in the field:value format. ♦ lsmod: This command lists the currently loaded kernel modules. This is a very simple program which reads the /proc/modules file and displays its contents in a formatted manner. ♦ insmod: This is also a trivial program which inserts a module in the kernel. This command doesnt handle module dependencies. ♦ rmmod: As the name suggests, this command is used to unload modules from the kernel. Unloading is done only if the current module is not in use. rmmod also supports the -f or –-force option, which can unload modules forcibly. But this option is extremely dangerous. There is a safer way to remove modules. With the -w or –-wait option, rmmod will isolate the module and wait until the module is no longer used. ♦ modinfo: This command displays information about the module that was passed as a command-line argument. If the argument is not a filename, then it searches the /lib/modules/<version> directory for modules. modinfo shows each attribute of the module in the field:value format. ♦ dmesg: Any user-space program displays its output on the standard output stream, i.e., /dev/stdout but the kernel uses a different methodology. The kernel appends its output to the ring buffer, and by using the dmesg command, we can manage the contents of the ring buffer. Typical components of a kernel are: ♦ Interrupt handlers to service interrupt requests. ♦ A scheduler to share processor time among multiple processes.
  • 24. ♦ A memory management system to manage process address spaces. ♦ System services such as networking and interprocess communication . Kernel-Space and User-Space ♦ Kernel-space: on modern systems with protected memory management units, the kernel typically resides in an elevated system state, which includes a protected memory space and full access to the hardware. This system state and memory space is collectively referred to as kernel-space. ♦ User-space: applications execute in user- space, where they can access a subset of the machine’s available resources and can perform certain system functions, directly access hardware, access memory outside of that allotted them by the kernel, or otherwise misbehave. When executing kernel code, the system is in kernel-space executing in kernel mode. When running a regular process, the system is in user- space executing in user mode. System Calls and Library Calls Applications communicate with the kernel via system calls . An application typically calls functions in a library (e.g. C library) which rely on the system call interface to instruct the kernel to carry out tasks on the application's behalf. ♦ Some library calls provide many features not found in the system call. Therefore, calling into the kernel is just one step in an otherwise large function. For example, the printf() function provides formatting and buffering of the data; only one step in its work is invoking write() to write the data to the console. ♦ Some library calls have a one-to-one relationship with the kernel. For example, the open() library function does little except call the open() system call. ♦ Other C library functions, such as strcpy(), make no direct use of the kernel at all. When an application executes a system call, the kernel is executing on behalf of the application. Furthermore, the application is said to be executing a system call in kernel-space, and the kernel is running in process context. This relationship (that applications call into the kernel via the system call interface) is the fundamental manner in which applications get work done. Interrupts The kernel manages the system’s hardware through interrupts. When hardware wants to communicate with the system, it issues an interrupt that interrupts the processor, which in turn interrupts the kernel. A number identifies interrupts and the kernel uses this number to execute a specific interrupt handler to process and respond to the interrupt. To provide synchronization, the kernel can disable interrupts (either all interrupts or just one specific interrupt number). In Linux, the interrupt handlers do not run in a process context. Instead, they run in a special interrupt context that is not associated with any process. This special context exists solely to let an interrupt handler quickly respond to an interrupt, and then exit. Linux Kernel Versions Linux kernels come in two flavors: stable and development.
  • 25. The Linux Kernel Development Community The main forum for this community is the Linux Kernel Mailing List (oft-shortened to lkml). Subscription information is available at http://vger.kernel.org.
  • 26. PRACTICAL NO-4 Aim:-Write a Program to Study of Linux using Shell: Shell A Shell provides you with an interface to the Unix system. It gathers input from you and executes programs based on that input. When a program finishes executing, it displays that program's output. Shell is an environment in which we can run our commands, programs, and shell scripts. There are different flavors of a shell, just as there are different flavors of operating systems. Each flavor of shell has its own set of recognized commands and functions. What is Shell A shell is special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal. Shell is broadly classified into two categories –  Command Line Shell  Graphical shell Command Line Shell Shell can be accessed by user using a command line interface. A special program called Terminal in linux/macOS or Command Prompt in Windows OS is provided to type in the human readable commands such as “cat”, “ls” etc. and then it is being execute. The result is then displayed on the terminal to the user. A terminal in Ubuntu 16.4 system looks like this –
  • 27. linux command line In above screenshot “ls” command with “- l” option is executed. It will list all the files in current working directory in long listing format. Working with command line shell is bit difficult for the beginners because it’s hard to memorize so many commands. It is very powerful, it allows user to store commands in a file and execute them together. This way any repetitive task can be easily automated. These files are usually called batch files in Windows and Shell Scripts in Linux/macOS systems. Graphical Shells Graphical shells provide means for manipulating programs based on graphical user interface (GUI), by allowing for operations such as opening, closing, moving and resizing windows, as well as switching focus between windows. Window OS or Ubuntu OS can be considered as good example which provide GUI to user for interacting with program. User do not need to type in command for every actions.A typical GUI in Ubuntu system – GUI shell There are several shells are available for Linux systems like –  BASH (Bourne Again SHell) – It is most widely used shell in Linux systems. It is used as default login shell in Linux systems and in macOS. It can also be installed on Windows OS.  CSH (C SHell) – The C shell’s syntax and usage are very similar to the C programming language.  KSH (Korn SHell) – The Korn Shell also was the base for the POSIX Shell standard specifications etc. Each shell does the same job but understand different commands and provide different built in functions.
  • 28. Shell Prompt The prompt, $, which is called the command prompt, is issued by the shell. While the prompt is displayed, you can type a command. Shell reads your input after you press Enter. It determines the command you want executed by looking at the first word of your input. A word is an unbroken set of characters. Spaces and tabs separate words. Following is a simple example of the date command, which displays the current date and time − $dateThu Jun 25 08:30:19 MST 2009 You can customize your command prompt using the environment variable PS1. Shell Types In Unix, there are two major types of shells −  Bourne shell − If you are using a Bourne-type shell, the $ character is the default prompt.  C shell − If you are using a C-type shell, the % character is the default prompt. The Bourne Shell has the following subcategories −  Bourne shell (sh)  Korn shell (ksh)  Bourne Again shell (bash)  POSIX shell (sh) The different C-type shells follow −  C shell (csh)  TENEX/TOPS C shell (tcsh) The original Unix shell was written in the mid-1970s by Stephen R. Bourne while he was at the AT&T Bell Labs in New Jersey. Bourne shell was the first shell to appear on Unix systems, thus it is referred to as "the shell". Bourne shell is usually installed as /bin/sh on most versions of Unix. For this reason, it is the shell of choice for writing scripts that can be used on different versions of Unix. In this chapter, we are going to cover most of the Shell concepts that are based on the Borne Shell. Shell Scripts Usually shells are interactive that mean, they accept command as input from users and execute them. However some time we want to execute a bunch of commands routinely, so we have type in all commands each time in terminal. As shell can also take commands as input from file we can write these commands in a file and can execute them in shell to avoid this repetitive work. These files are called Shell Scripts or Shell Programs. Shell scripts are similar to the batch file in MS-DOS. Each shell script is saved with .sh file extension eg. myscript.sh A shell script have syntax just like any other programming language. If you have any prior experience with any programming language like Python, C/C++ etc. it would be very easy to get started with it. A shell script comprises following elements –  Shell Keywords – if, else, break etc.  Shell commands – cd, ls, echo, pwd, touch etc.  Functions  Control flow – if..then..else, case and shell loops etc.
  • 29. Why do we need shell scripts There are many reasons to write shell scripts –  To avoid repetitive work and automation  System admins use shell scripting for routine backups  System monitoring  Adding new functionality to the shell etc. Advantages of shell scripts  The command and syntax are exactly the same as those directly entered in command line, so programmer do not need to switch to entirely different syntax  Writing shell scripts are much quicker  Quick start  Interactive debugging etc. Disadvantages of shell scripts  Prone to costly errors, a single mistake can change the command which might be harmful  Slow execution speed  Design flaws within the language syntax or implementation  Not well suited for large and complex task  Provide minimal data structure unlike other scripting languages. Etc The basic concept of a shell script is a list of commands, which are listed in the order of execution. A good shell script will have comments, preceded by # sign, describing the steps. There are conditional tests, such as value A is greater than value B, loops allowing us to go through massive amounts of data, files to read and store data, and variables to read and store data, and the script may include functions. We are going to write many scripts in the next sections. It would be a simple text file in which we would put all our commands and several other required constructs that tell the shell environment what to do and when to do it. Shell scripts and functions are both interpreted. This means they are not compiled. Example Script Assume we create a test.sh script. Note all the scripts would have the .sh extension. Before you add anything else to your script, you need to alert the system that a shell script is being started. This is done using the shebang construct. For example − #!/bin/sh This tells the system that the commands that follow are to be executed by the Bourne shell. It's called a shebang because the # symbol is called a hash, and the ! symbol is called a bang. To create a script containing these commands, you put the shebang line first and then add the commands − #!/bin/bash pwd ls
  • 30. Shell Comments You can put your comments in your script as follows − #!/bin/bash # Author : Zara Ali # Copyright (c) Tutorialspoint.com# Script follows here: pwd ls Save the above content and make the script executable − $chmod +x test.sh The shell script is now ready to be executed − $./test.sh Upon execution, you will receive the following result − /home/amrood Index.htm unix- basic_utilities.htm unix-directories.htm test.sh unix- communication.htm unix-environment.htm Note − To execute a program available in the current directory, use ./program_name Extended Shell Scripts Shell scripts have several required constructs that tell the shell environment what to do and when to do it. Of course, most scripts are more complex than the above one. The shell is, after all, a real programming language, complete with variables, control structures, and so forth. No matter how complicated a script gets, it is still just a list of commands executed sequentially. The following script uses the read command which takes the input from the keyboard and assigns it as the value of the variable PERSON and finally prints it on STDOUT. #!/bin/sh # Author : Zara Ali # Copyright (c) Tutorialspoint.com # Script follows here: echo "What is your name?" read PERSON echo "Hello, $PERSON" Here is a sample run of the script − $./test.sh What is your name? Zara AliHello, Zara Ali $
  • 31. PRACTICAL NO-5 AIM :- Write a Program to Study Linux using basic Commands Pipe and Filter Commands Basic Linux commands 1. The date command Linux maintains a system clock. As for now you can simply display the current date with the date command, which shows the date and time for the nearest second as shown: $ date Thur Nov 4 11:23:52 IST 1999 The other format specifiers are as follows: D Specifies the day of the month Y Indicates the last two digits of the year H Indicates the hour M Indicates the minute S Indicates the second T Indicates the time in hh::mm:ss format 2. The who command Linux maintains an account of all the current users of the system. A list of all the users is displayed by the who command. The who command produces a three column output .This indicates the number of users of the system with their login names in the first column. The second column shows the device names of their respective terminals. The third column indicates the date and time of logging in. The –H option prints the column headers: $ who –H 3. The tty command Linux treats even terminals as files. It is therefore reasonable to expect a command which tells you the device name of the terminal you are using with the help of the tty command. $ tty /dev/ttyp1 $ 4. The cal command This command is used for printing the calendar of any particular month or the entire year.Any calendar from the year 1 to 9999 can be displayed with this command: $ cal 2000 5. The man command Linux systems maintain an online documentation about each command so that you can get to know the complete description about a particular command. The command: $ man will give a description of the man command in general. The man command is used to view the description of other commands. For this purpose the
  • 32. man command is followed by the commandname. It has the following format: $ man commandname 6. The finger utility This utility is used to display the status of all the users currently logged on to the Linux system. The finger utility without any parameter, displays a single line output for each user currently logged on . It displays the information like the user’s login name, full name, terminal name, write status, idle time, login time, the machine’s address where the user is currently logged in and the office number. The write permission is displayed along with the terminal name as an asterisk(*). If the asterisk appears after the terminal name, it means that the write permission is denied. The syntax of the finger command is as follows: finger [options] [user name] 7. The chfn utility The chfn (change your finger information) utility is used to change the user’s finger information. The chfn utility checks for the user’s information from the /etc/passwd file and allows the user to chane information. The syntax for this utility is as follows: chfn [options] [username] The chfn asks for the password of the user to authenticate the user for changing the fingerinformation. If you do not want to change any particular information, you can press Enter at the corresponding prompt and proceed with the remaining parameters. 8. command The head The head command is used to display the top few records of the file. The syntax of the command is as follows: $ head [option] file The option is as follows: count Display the first count lines of file The easiest way to use this command is to specify a filename without specifying the number of lines to be displayed. If this is the case, the first ten records of the file are displayed. $ head tmp.lst will display the first ten records of the file tmp.lst. 9. The tail command The tail command displays the end few records of the file. If no line count is given, the tail command displays the last ten lines of the file. We also have an option to specify a count and
  • 33. select that many lines from the end of file. Consider an example: $ tail –3 emp.lst 10. The mesg command The user has the option to allow or disallow other users to write on his terminal. The two options available with the mesg command are as follows: mesg y This option allows other users to write to your terminal mesg n This option disallows other users to write to your terminal If you type the mesg command without any option, it displays the status of your terminal,say for example, $ mesg is y 11. The wall command The wall command is used to write to all the users. The wall command sends the message to all the users who are currently logged on to the Linux system and have their mesg permission set to ‘y’. The syntax of the command is as follows: wall Type in the above command at the command prompt. Press <Enter>. Now write the message you want to broadcast. Press Ctrl <d>. The message would be broadcasted to all the users currently logged on. Pipe Commands If you have a series of commands in which the output of one command is the input of the next, you can pipe the output without saving it in temporary files: first_command | next_command For example, if you wanted to print out a sorted version of a file that contained a list of names and phone numbers, you could use a pipe (as well as input redirection): sort < my_phone_list | lpr Similarly, in order to display the contents of the current directory, a screen-full at a time,you can give the following commands: $ ls > myfile $ more myfile Here, the listing of the directory is stored in the file, myfile, by the first command and this file is then used as input by the more command. The above two steps can be combined and executed as a single command without creating a temporary file, $ ls | more The vertical bar (|) is the pipe character which indicates to the shell that the output of the
  • 34. command before the ‘|’ is the input to the command after the ‘|’. Filters Command A filter is a program that takes its input from the standard input file, processes ( or filters)it and sends its output to the standard output file. Linux has a rich set of filters that can be used to work on data in an efficient way. Some examples of filters are: • cat • grep • tr • sort • uniq • sed • awk Some of the filters are discussed as follows:  The grep command The grep command searches a file for a specified pattern and displays it on the screen. The syntax of this command is as follows: grep [options] regular expression filename[s]  The tr command The tr command transliterates characters i.e. it copies the standard input to the standard output with substitution or deletion of specific characters. The command has the following syntax: tr [options] [string1] < file1 The following is the list of options: c Complements the set of characters in string1 with respect to the universe of characters whose ASCII codes are 001 through 377 octal d Deletes characters specified in string1 s Squeezes all repeated occurrences of a character to one character  The sort command The sort command sorts lines of all the specified files together and writes the result on the standard output. The general syntax of the command is as follows: sort [options][+pos1] [-pos2] filename[s] Say for example the command $sort myfile will sort the file considering each record of a file as one single field.  The uniq command There is often a problem of duplicate entries due to faulty data entry. The sort command suppresses them with the –u option. In addition to this there is a special tool to handle these records called the uniq command. The command is most useful when placed in pipelines.
  • 35.  The sed Command The sed command provides a stream editor. The syntax of the command is as follows: sed [ -n ] Script [ File ... ] sed [ -n ] [ -e Script ] ... [ -f ScriptFile ] ... [ File ... ] The sed command modifies lines from the specified File parameter according to an edit script and writes them to standard output. The sed command includes many features for selecting lines to be modified and making changes only to the selected lines. Alphabetical LINUX Command List: 1. addbib - create or extend a bibliographic database 2. apropos - locate commands by keyword lookup 3. ar - create library archives, and add or extract files 4. at - execute a command or script at a specified time 5. awk - pattern scanning and processing language 6. banner - display a string in large letters 7. basename - display portions of path names and filenames 8. batch - runs jobs when the system load level permits 9. biff - give notice of incoming mail messages 10. cal - display a calendar 11. calendar - a simple reminder service 12. cancel - cancel requests to a printer 13. cat - concatenate and display 14. cb - a simple C program beautifier 15. cc - C compiler 16. cd - change working directory 17. checknr - check nroff and troff input files; report possible errors 18. checkeq - checks documents formatted with memoranda macros 19. chgrp - change the group ownership of a file 20. chmod - change the permissions mode of a file 21. clear - clear the terminal screen 22. cmp - perform a byte-by-byte comparison of two files 23. colcrt - filter nroff output for a terminal without overstrike capability 24. comm - selects or rejects lines common to two sorted files 25. compress - compress files (see uncompress also) 26. cp - copy files 27. cpio - copy file archives in and out 28. cpp - the C language preprocessor 29. csh - a shell with a C-like syntax and advanced interactive features 30. ctags - create a tags file for use with ex and vi
  • 36. 31. cut - Writes selected bytes, characters, or fields from each line of a file.
  • 37. PRACTICAL NO-6 Aim:-Write a Program to Administrate Linux Operating System: System Administration Administration tasks: • Starting and shutting down the system properly • Managing the disk partitions • Making backups • gzip, compress, and tar • Message of the day • Emergency boot floppies Instead, we will look at the basic information and utilities and leave you to experiment. For more details, check the documentation files with your Linux operating system. Better yet, consider purchasing a good UNIX system administration Book. Much of the information in a UNIX book will be applicable to Linux. The root Account The root login, as you probably know, has no limitations at all. It can do anything anywhere, access any files it wants, and control any processes. This power has its price, though: Any mistake can be disastrous, sometimes resulting in damage to the entire operating system. A mystique has built up in the UNIX community about the root login, because it holds unlimited power over the system. The tendency to want to use this super user login is overwhelming for many. However, a simple rm command in the wrong place can spell many hours of trouble. For this reason, the root account should be employed only for limited system use, and then only when its power is necessary (such as when rebuilding a kernel, installing new software, or setting up new file systems). As a general rule, you should not use the root account for routine tasks. Naturally, many people use root for their daily Linux sessions, ignoring any advice because they think they won't make mistakes. In truth, everyone makes a mistake occasionally. Check with any UNIX system administrator and you'll find that accidents happen with the root account. (I have managed to delete entire file systems more than once while trying to do two things at the same time.) Although many people will ignore the rule about using root only when necessary, most of them eventually find out why this rule is important! Starting and Stopping the System There are several ways of booting the Linux operating system, as well as a few ways to safely shut it down. Some were mentioned earlier in this book. Because Linux can be installed in many different ways, there is no single "right" method of booting the operating system, so we must look at both hard-disk-based and floppy-disk-based boot procedures. Booting from a Floppy A boot floppy, as its name implies, is a floppy disk that boots the Linux kernel. A boot floppy has the root partition installed on the floppy itself instead of the hard drive (although both may co-exist). Without the root partition, Linux would be unable to find the hard drives for the rest of the operating system. You can create Linux boot floppies with the setup routine included in most distributions of the operating system. Check the documentation or information files that came with your Linux distribution, if there are any.
  • 38. Alternatively, most Linux setup utilities have a menu-driven interface that prompts you for a boot floppy setup when you rebuild or reconfigure the kernel. You should use this procedure to make a boot floppy, which is also useful for emergencies. In most cases, a boot floppy is used only in emergencies when your system won't start up normally. The boot floppy enables you to load Linux, and then mount the hard drives that are causing the problem to check for damage. Luckily, this is not required very often. If you haven't used LILO to choose the partition to boot or set your boot sequence to Linux by default, you may need the boot floppy to start up Linux. In this case, the boot floppy is much like a DOS boot floppy. You can create a boot floppy from scratch by copying over the kernel image from the hard drive. The kernel image is usually in the file vmlinuz, vmlinux, Image, or /etc/Image, depending on the distribution of Linux. The Red Hat distribution uses vmlinuz, which is a compressed kernel (hence the z in the name). Compressed kernels uncompress themselves as they are loaded into memory at boot time. The vmlinuz image expands to vmlinux. (Compressed kernels take up less disk space; that's why they are used.) After you have identified the kernel, you can set the root device in the kernel image to point to the root partition on either the floppy or hard drive. In this case, we want the floppy. The root partition is set with the rdev command, whose format is as follows: rdev kernel name device where kernelname is the name of the kernel image, and device is the name of the Linux root partition. To set a floppy boot device with the file vmlinuz, the command would be rdev vmlinuz /dev/fd0 for the first floppy on the system. You can set other parameters with rdev as well if you want to change system defaults during boot. Check the rdev man page for the rdev help file for complete information. As a final step in creating the boot floppy, copy the kernel image to the floppy disk. You should use a preformatted diskette (format with DOS if necessary) to allow the Linux routines to identify the type of diskette and its density. To copy the vmlinuz kernel to the first floppy drive, use this command: cp vmlinuz /dev/fd0 The floppy should now be ready to boot the system. You might not be able to boot the system without the floppy if you changed the location of the root partition. You can change the root partition back to the hard drive with the rdev command after completing the boot floppy, which enables you to boot from either. This can be useful when you have diskettes for several different boot configurations. You can also create the boot floppy from the Linux setup program. Using LILO To Boot LILO is a program that resides in the boot sector of your hard drive and allows Linux to be booted from the hard disk either after you tell it to or after a default number of seconds has elapsed. LILO can also be used with other operating systems such as OS/2 and DOS. If you have LILO set to autoboot Linux, you must interrupt the process by pressing the Ctrl, Alt, or Shift keys when the bootup is started if you want to boot into another operating system. This displays a boot prompt that enables you to specify another operating system.
  • 39. If LILO is set to allow a given time before it boots into Linux, you can use the CtrlAlt- Shift sequence to interrupt the boot process before the timer expires and Linux starts loading. Finally, if LILO is set to not autoboot into Linux, but to wait for explicit instructions, you must press Enter to boot Linux or type the name of the other operating system. Some Linux distributions have a configuration file in the directory /etc/lilo that can be edited to provide boot information, while other versions of Linux configure LILO during the installation process. If the latter is the case, you can change the settings with the setup utility. Some versions of Linux use the configuration file /etc/lilo.conf instead of /etc/lilo. Shutting Down Linux You can't just turn off the power switch! This can cause damage to the file system, sometimes irreversibly. Because Linux keeps many files open at once, as well as several processes, they must all be closed down properly before you cycle the power to the unit. There are a few ways to shut the Linux system down, but the formal method is to use the shutdown command. The syntax for shutdown is shutdown [minutes] [warning] where minutes is the number of minutes to wait before shutting the system down and warning is an optional message displayed for all users currently logged in. Some versions of shutdown allow the word now instead of a time, while others require either no argument or the number 0 to shut the system down immediately without waiting. You can have shutdown reboot the system after the shutdown by adding the argument - r (for reboot). Using shutdown is best if you have other users on your system, because it gives them a warning that they should log out, and it prevents loss of information. It can also be used to automate a shut-down much later (such as at midnight), with messages just before that time warning any users still logged in. If you can't wait and want to shut the system down immediately, use the halt command or the "three-finger salute" of Ctrl-Alt-Delete. This immediately shuts down all the processes and halts the system as quickly as possible. Then the power can be shut off. Some Linux distributions don't support Ctrl-Alt-Delete, and a couple of older distributions use it to halt the system immediately without terminating processes properly. This can cause damage. Check the documentation or man pages for information. Creating a New File System To create a file system on a floppy (so it can be mounted), you should use the utility mke2fs or the command mkdev fs, depending on the version of Linux. To use mke2fs, for example, issue the command mke2fs /dev/fd0 1440 to create a floppy file system on a 1.44MB 3.5-inch diskette. Unmounting File Systems To detach a mounted file system from your Linux file system, use the umount command with the name of the device. For example, to unmount a floppy in /dev/fd0, issue the command
  • 40. umount /dev/fd0 and the floppy will be removed from the mounted point. Be sure to type umount instead of unmount! If you want to remove the current floppy and replace it with another, you can't simply swap them. The current floppy must be unmounted, and then the new one must be mounted. Failure to follow this process can result in corruption or erroneous directory listings. Checking File Systems Every now and again a file might get corrupted or a file system's inode table might get out of sync with the disk's contents. For these reasons, it is a good idea to check the file system at regular intervals. Several utilities can check file systems, depending on the version of Linux. The utility fsck is available for some systems, while the utility e2fsck is designed for Linux's ext2fs file system. Many Linux versions include other utilities such as xfsck and efsfck for different file systems. In many cases, the fsck command is linked to the individual file system versions. To use e2fsck to check a file system, issue the command with the device name and the options a (automatically correct errors) and v (verbose output): e2fsck -av /dev/hda1 This command checks and repairs any problems on the /dev/hda1 (or whatever device driver you specify) partition. If any corrections have been made to a partition, you should reboot the machine as soon as possible to allow the system to resync its tables. Whenever possible, it is a good idea to unmount the file system before checking it, because this can prevent problems with open files. Of course, you can't unmount the primary root partition while running from it, so you can boot from a boot floppy that contains the check utilities, and start them from the floppy. Backups The three rules of system administration are back up, back up, and back up. This might sound silly and trite, but a backup can save you whenever you do something silly to the file system, or when problems occur. With UNIX, most backups are made to a tape device using tar, although many Linux users don't have tape units available and have to resort to floppies. Backups are made with the tar utility, as I mentioned earlier. The procedure is exactly the same as I showed you earlier. To back up the entire system on floppy, the command is tar -cvfbk /dev/fd0 1440 4 / To back up to a high-capacity tape device larger than the file system (and hence not needing a capacity limit) called /dev/rct0, the command is tar -cvfk /dev/rct0 20 / In many cases, you won't want to back up the entire system, because it's easier to reinstall off a CD-ROM. However, you should back up your user files by either backing up the entire /usr directory or specifically backing up your own home directory. To restore a backup, you use the tar command again: tar -xvf /dev/rct0
  • 41. This recovers all files from the tape device /dev/rct0. You can explicitly restore specific files if you need to. Several commercial products offer automated backups, although you can do this quite easily with the cron command. Setting Up Your System You can perform several little tasks to tweak or optimize your Linux system, although in many cases they are dependent on the version you are running and other applications coexisting. We can look at a few of the miscellaneous tasks here. Setting the System Name The system name is contained in a file called /etc/HOSTNAME. It is simply the name the system calls itself for identification, which is especially useful if you are networking your Linux machine with others. You can call the system anything you want. To set your system name (also called a host name), you can either edit the system files (which should be followed by a reboot to make the changes effective) or use the hostname command. The command hostname hellfire sets the machine's name to hellfire. Using a Maintenance Disk Every system should have a maintenance disk that enables you to check the root file system, recover from certain disk problems, and solve simple problems (such as forgetting your root password). The emergency disks, also called the boot/root floppies, are created with the setup program in most distributions of Linux when the configuration is changed. You can usually create an emergency boot disk from the CD-ROM that the system came on, as well as obtain the necessary files from FTP sites. After you have booted your machine with the emergency disk, you can mount the disk partitions with the mount command. Forgetting the root Password This is an embarrassing and annoying problem, but luckily one easily fixed with Linux. (If only other UNIX systems were so easy!) To recover from a problem with the root password, use a boot floppy and boot the system. Mount the root partition, and edit the /etc/passwd file to remove any password for root; then, reboot from the hard disk. After the system has booted, you can set a password again. This points out one major security problem with Linux: Anyone with a boot floppy can get unrestricted access to your system! Setting the Login Message If you have more than one user on the system, you can display information about the system, its maintenance, or changes in a file called
  • 42. /etc/motd (message of the day). The contents of this file are displayed whenever someone logs in. To change the /etc/motd file, use any text editor and save the contents as ASCII. You can make the contents as long as you want, but readers usually appreciate brevity. The /etc/motd file is useful for informing users of downtime, backups, or new additions. You can also use it to give a more personal feel to your system. Summary System administration is not a complicated subject, unless you want to get into the nitty-gritty of your operating system and its configuration. For most Linux users who use the operating system for their personal experimentation, the administration steps explained in this chapter should be sufficient for most purposes. I
  • 43. PRACTICAL NO-7 Aim:-Write a Program of Shell Scritts: How to write shell script Following steps are required to write shell script: (1) Use any editor like vi or mcedit to write shell script. (2) After writing shell script set execute permission for your script as follows syntax: chmod permission your-script-name Examples: $ chmod +x your- script-name $ chmod 755 your- script-name Note: This will set read write execute (7) permission for owner, for group and other permission is read and execute only (5). (3) Execute your script as syntax: b a s h y o u r - s c r i p t - n a m e s h y o u r - s c r i p t - n a m e ./your-script-name Examples:
  • 44. $ bash bar $ sh bar $ ./bar NOTE In the last syntax ./ means current directory, But only . (dot) means execute given command file in current shell without starting the new copy of shell, The syntax for . (dot) command is as follows Syntax: . command-name Example: $ . foo Variables in Shell To process our data/information, data must be kept in computers RAM memory. RAM memory is divided into small locations, and each location had unique number called memory location/address, which is used to hold our data. Programmer can give a unique name to this memory location/address called memory variable or variable (Its a named storage location that may take different values, but only one at a time). In Linux (Shell), there are two types of variable: (1) System variables - Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS. (2) User defined variables (UDV) - Created and maintained by user. This type of variable defined in lower letters. You can see system variables by giving command like $ set, some of the important System variables are: System Variable Meaning BASH=/bin/bash Our shell name BASH_VERSION=1.14.7(1) Our shell version name COLUMNS=80 No. of columns for our screen HOME=/home/vivek Our home directory LINES=25 No. of columns for our screen LOGNAME=students students Our logging name OSTYPE=Linux Our Os type PATH=/usr/bin:/sbin:/bin:/usr/sbin Our path settings PS1=[u@h W]$ Our prompt settings PWD=/home/students/Common Our current working directory SHELL=/bin/bash Our shell name USERNAME=vivek User name who is currently login to this PC NOTE that Some of the above settings can be different in your PC/Linux environment. You can print any of the above variables contains as follows: $ echo $USERNAME $ echo $HOME
  • 45. Exercise: 1) If you want to print your home directory location then you give command: a)$ echo $HOME OR (b)$ echo HOME How to define User defined variables (UDV) To define UDV use following syntax Syntax: variable name=value 'value' is assigned to given 'variable name' and Value must be on right side = sign. Example: $ no=10# this is ok $ 10=no# Error, NOT Ok, Value must be on right side of = sign. To define variable called 'vech' having value Bus $ vech=Bus to define variable called n having value 10 $ n=10 Rules for Naming variable name (Both UDV and System Variable) (1) Variable name must begin with Alphanumeric character or underscore character (_), followed by one or more Alphanumeric character. For e.g. valid shell variable are as follows HOME S Y S T E M _ V E R S I O N v e c h n o (2) Don't put spaces on either side of the equal sign when assigning value to variable. For e.g. In following variable declaration there will be no error $ no=10 But there will be problem for any of the following variable declaration: $ no =10 $ no= 10 $ no = 10
  • 46. (3) Variables are case-sensitive, just like filename in Linux. For e.g. $ no=10 $ No=11 $ NO=20 $ nO=2 Above all are different variable name, so to print value 20 we have to use $ echo $NO and not any of the following # will print 10 but not 20 $ echo $No# will print 11 but not 20 $ echo $nO# will print 2 but not 20 You can define NULL variable as follows (NULL variable is variable which has no value at the time of definition) For e.g. $ v e c h = $ v e c h = " " Try to print it's value by issuing following command $ echo $vech Nothing will be shown because variable has no value i.e. NULL variable. (4) Do not use ?,* etc, to name your variable names. How to print or access value of UDV (User defined variables) To print or access UDV use following syntax Syntax: $variablename Define variable vech and n as follows: $ vech=Bus $ n=10 To print contains of variable 'vech' type $ echo $vech It will print 'Bus',To print contains of variable 'n' type command as follows $ echo $n echo Command Use echo command to display text or value of variable.
  • 47. echo [options] [string, variables...] Displays text or variables value on screen. Options -n Do not output the trailing new line. -e Enable interpretati on of the following backslash escaped characters in the strings: a alert (bell) b backspace c suppress trailing new line n new line r carriage return t horizontal tab backslash For e.g. $ echo -e "An apple a day keeps away attdoctorn" Shell Arithmetic Use to perform arithmetic operations. Syntax: expr op1 math-operator op2 Examples: $ expr 1 + 3 $ expr 2 - 1 $ expr 10 / 2 $ expr 20 % 3 $ expr 10 * 3 $ echo `expr 6 + 3` Note: expr 20 %3 - Remainder read as 20 mod 3 and remainder is 2. expr 10 * 3 - Multiplication use * and not * since its wild card. For the last statement not the following points (1) First, before expr keyword we used ` (back quote) sign not the (single quote i.e. ') sign. Back quote is generally found on the key under tilde (~) on PC keyboard OR to the above of TAB key. (2) Second, expr is also end with ` i.e. back quote. (3) Here expr 6 + 3 is evaluated to 9, then echo command prints 9 as sum (4) Here if you use double quote or single quote, it will NOT work For e.g. $ echo "expr 6 + 3" # It will print expr 6 + 3 $ echo 'expr 6 + 3' # It will print expr 6 + 3
  • 48. More about Quotes There are three types of quotes Quotes Name Meaning “ Double Quotes “Double Quotes”- Anything enclose in Double Quote removed meaning of that characters (except & $) ‘ Single Quote ‘Single Quote’-Enclosed in single quote remains unchanged ` Back Quote `Back Quote`- To execute command
  • 49. Example: $ echo "Today is date" Can't print message with today's date. $ Echo "Today is `date`". Exit Status By default in Linux if particular command/shell script is executed, it return two type of values which is used to see whether command or shell script executed is successful or not. (1) If return value is zero (0), command is successful. (2) If return value is nonzero, command is not successful or some sort of error executing command/shell script. This value is know as Exit Status. But how to find out exit status of command or shell script? Simple, to determine this exit Status you can use $? Special variable of shell. For e.g. (This example assumes that unknow1file doest not exist on your hard drive) $ rm unknow1file It will show error as follows rm: cannot remove `unkowm1file': No such file or directory and after that if you give command $ echo $? It will print nonzero value to indicate error. Now give command $ ls $ echo $? It will print 0 to indicate command is successful. The read Statement
  • 50. Use to get input (data from user) from keyboard and store (data) to variable. Syntax: read variable1, variable2,...variableN Following script first ask user, name and then waits to enter name from the user via keyboard. Then user enters name from keyboard (after giving name you have to press ENTER key) and entered name through keyboard is stored (assigned) to variable fname Wild cards (Filename Shorthand or Meta Characters) Wild card Meaning Examples /Shorthand $ ls * will show all files will show all files $ ls a* whose first name is starting with letter 'a' Matches any string or group of * $ ls *.c will show all files characters. having extension .c will show all files $ ls ut*.c having extension .c but file name must begin with 'ut'.
  • 51. will show all files $ ls ? whose names are 1 character long ? Matches any single character. will show all files $ ls fo? whose names are 3 character long and file name begin with fo Matches any one of the will show all files [...] $ ls [abc]* beginning with letters enclosed characters a,b,c Note: [..-..] A pair of characters separated by a minus sign denotes a range. Example: $ ls /bin/[a-c]* More command on one command line Syntax: command1;command2 To run two command with one command line.
  • 52. Examples: $ date;who Will print today's date followed by users who are currently login. Note that You can't use $ date who for same purpose, you must put semicolon in between date and who command.
  • 53. Command Line Processing Try the following command (assumes that the file "grate_stories_of" is not exist on your system) $ ls grate_stories_of It will print message something like - grate_stories_of: No such file or directory. ls is the name of an actual command and shell executed this command when you type command at shell prompt. Now it creates one more question What are commands? What happened when you type $ ls grate_stories_of ? The first word on command line is, ls - is name of the command to be executed. Everything else on command line is taken as arguments to this command. For e.g. $ tail +10 myf Name of command is tail, and the arguments are +10 and myf. Why Command Line arguments required 1. Telling the command/utility which option to use. 2. Informing the utility/command which file or group of files to process (reading/writing of files). Let's take rm command, which is used to remove file, but which file you want to remove and how you will tail this to rm command (even rm command don't ask you name of file that you would like to remove). So what we do is we write command as follows: $ rm {file-name} Here rm is command and filename is file which you would like to remove. This way you tail rm command which file you would like to remove. So we are doing one way communication with our command by specifying filename Also you can pass command line arguments to your script to make it more users friendly. But how we access command line argument in our script.
  • 54. Lets take ls command $ Ls -a /* This command has 2 command line argument -a and /* is another. For shell script, $ myshell foo bar
  • 55. Shell Script name i.e. myshell First command line argument passed to myshell i.e. foo Second command line argument passed to myshell i.e. bar In shell if we wish to refer this command line argument we refer above as follows myshell it is $0 foo it is $1 bar it is $2 Here $# (built in shell variable ) will be 2 (Since foo and bar only two Arguments), Please note at a time such 9 arguments can be used from $1..$9, You can also refer all of them by using $* (which expand to `$1,$2...$9`). Note that $1..$9 i.e command line arguments to shell script is know as "positional parameters". Redirection of Standard output/input i.e. Input - Output redirection Mostly all command gives output on screen or take input from keyboard, but in Linux (and in other OSs also) it's possible to send output to file or to read input from file. For e.g. $ ls command gives output to screen; to send output to file of ls command give command $ ls > filename It means put output of ls command to filename. There are three main redirection symbols >,>>,< (1) > Redirector Symbol Syntax:
  • 56. Linux-command > filename To output Linux-commands result (output of command or shell script) to file. Note that if file already exist, it will be overwritten else new file is created. For e.g. To send output of ls command give $ ls > myfiles Now if 'myfiles' file exist in your current directory it will be overwritten without any type of warning. (2) >> Redirector Symbol Syntax: Linux-command >> filename To output Linux-commands result (output of command or shell script) to END of file. Note that if file exist , it will be opened and new information/data will be written to END of file, without losing previous information/data, And if file is not exist, then new file is created. For e.g. To send output of date command to already exist file give command $ date >> myfiles (3) < Redirector Symbol Syntax: Linux-command < filename To take input to Linux-command from file instead of key-board. For e.g. To take input for cat command give $ cat < myfiles Pipes A pipe is a way to connect the output of one program to the input of another program without any temporary file. Pipe Defined as:
  • 57. "A pipe is nothing but a temporary storage place where the output of one command is stored and then passed as the input for second command. Pipes are used to run more than two commands ( Multiple commands) from same command line." Syntax: command1 | command2 Examles Command using Pipes Meaning or Use of Pipes Output of ls command is given as input to $ ls | more more command So that output is printed one screen full page at a time. Output of who command is given as input to $ who | sort sort command So that it will print sorted list of users $ who | sort > user_list Same as above except output of sort is send to (redirected) user_list file Output of who command is given as input to $ who | wc –l wc command So that it will number of user who logon to system Output of ls command is given as input to wc $ ls -l | wc –l command So that it will print number of files in current directory.
  • 58. Output of who command is given as input to grep command So that it will print if $ who | grep raju particular user name if he is logon or nothing is printed (To see particular user is logon or not) What is Processes Process is kind of program or task carried out by your PC. For e.g. $ ls -lR ls command or a request to list files in a directory and all subdirectory in your current directory - It is a process. Process defined as: "A process is program (command given by user) to perform specific Job. In Linux when you start process, it gives a number to process (called PID or process-id), PID starts from 0 to 65535." Why Process required As You know Linux is multi-user, multitasking Os. It means you can run more than two process simultaneously if you wish. For e.g. To find how many files do you have on your system you may give command like: $ ls / -R | wc -l This command will take lot of time to search all files on your system. So you can run such command in Background or simultaneously by giving command like
  • 59. $ ls / -R | wc -l & The ampersand (&) at the end of command tells shells start process (ls / -R | wc - l) and run it in background takes next command immediately. Process & PID defined as: "An instance of running command is called process and the number printed by shell is called process-id (PID), this PID can be use to refer specific running process." Linux Command Related with Process Following tables most commonly used command(s) with process: For this purpose Use this Command Examples * To see currently running process To stop any process by PID i.e. to kill process To stop processes by name i.e. to kill process To get information about all running process To stop all process except your shell For background processing (With &, use to put particular command and program in background) To display the owner of the processes along with the processes ps kill {PID} killall {Process-name} ps -ag kill 0 linux-command &
  • 60. ps aux $ ps $ kill 1012 $ killall httpd $ ps -ag $ kill 0 $ ls / -R | wc -l & $ ps aux To see if a particular process is running or not. For this purpose you have to use ps command in combination with the grep command To see currently running processes and other information top like memory and CPU usage with See the output of top command. real time updates. To display a tree of processes pstree For e.g. you want to see whether Apache web ps ax | grep process-U- want-to server process is running see or not then give comm and $ ps ax | grep httpd
  • 61. $ top Note that to exit from top command press q. $ pstree * To run some of this command you need to be root or equivalnt user.
  • 62. Making decision is important part in ONCE life as well as in computers logical driven program. In fact logic is not LOGIC until you use decision making. This chapter introduces to the bashs structured language constricts such as:  Decision making  Loops Is there any difference making decision in Real life and with Computers? Well real life decision are quit complicated to all of us and computers even don't have that much power to understand our real life decisions. What computer know is 0 (zero) and 1 that is Yes or No. To make this idea clear, lets play some game (WOW!) with bc - Linux calculator program. $ bc After this command bc is started and waiting for your commands, i.e. give it some calculation as follows type 5 + 2 as: 5 + 2 7 is response of bc i.e. addition of 5 + 2 you can even try 5 - 2 5 / 2 See what happened if you type 5 > 2 as follows 5 > 2 1 (One?) is response of bc, How? bc compare 5 with 2 as, Is 5 is greater then 2, (If I ask same question to you, your answer will be YES), bc gives this 'YES' answer by showing 1 value. Now try 5 < 2 0 0 (Zero) indicates the false i.e. Is 5 is less than 2?, Your answer will be no which is indicated by bc by showing 0 (Zero). Remember in BC, relational expression always returns true (1) or false (0 - zero). Try following in bc to clear your Idea and not down bc's response 5 > 12
  • 63. 5 == 10 5!= 2 5 == 5 12 < 2 Expression Meaning to us Your Answer BC's Response 5 > 12 Is 5 greater than 12 NO 0 5 == 10 Is 5 is equal to 10 NO 0 5 != 2 Is 5 is NOT equal to 2 YES 1 5 == 5 Is 5 is equal to 5 YES 1 1 < 2 Is 1 is less than 2 Yes 1 if condition if condition which is used for decision making in shell script, If given condition is true then command1 is executed. Syntax: if condition then command1 if condition is true or if exit status of condition is 0 (zero) ... ... fi