Linus
Linus
Engineering
UNIT-1
Introduction : Unix and Linux, A brief history of UNIX, Architecture of the Linux operating system,
programming on Linux, advantages Linux System administrator- overview, role, duties of system
administrator, Linux vs. windows, system startup and shutdown ,Logging into (and out of) Linux
systems, Changing your password, General format of Linux commands, summary.
Cosc300Dp 1
UNIT-1
Introduction to Linux
Linux is a Unix-like computer operating system assembled under the
model of free and open source software development and distribution.
The defining component of Linux is the Linux kernel, an operating system
kernel first released 5 October 1991 by Linus Thorvaldsen.
History of Unix
Cosc300Dp 2
Today, Linux systems are used in every domain, from embedded systems to supercomputers,
and have secured a place in server installations often using the popular LAMP application stack. Use
of Linux distributions in home and enterprise desktops has been growing. They have also gained
popularity with various local and national governments.
A Linux-based system is a modular Unix-like operating system. It derives much of its basic
design from principles established in Unix during the 1970s and 1980s. Such a system uses a
monolithic kernel, the Linux kernel, which handles process control, networking, and peripheral and
file system access. Device drivers are either integrated directly with the kernel or added as modules
loaded while the system is running.
Separate projects that interface with the kernel provide much of the system's higher-level
functionality.
The GNU user land is an important part of most Linux-based systems, providing the
most common implementation of the C library, a popular shell, and many of the common
Unix tools which carry out many basic operating system tasks.
The graphical user interface (or GUI) used by most Linux systems is built on top of an implementation
of the X Window System.
What is X Windows?
X Windows is a public domain windowing system that is mainly used on UNIX systems. The
system includes a standard library of routines that can be used to develop GUI applications. Allows
applications to be displayed in windows and shared among different workstations and terminals
Cosc300Dp 3
It is designed to be:
o Portable
o Multitasking
o Multiuser
UNIX Operating System Names: A few popular names
1. HP-UX
2. IBM AIX
3. Sun Solairs
4. Mac OS X
5. IRIX
Linux Distribution Operating System) Names :A few popular names such as Redhat Enterprise
Linux, Fedora Linux,Debian Linux,Suse Enterprise Linux,Ubuntu Linux.
Common Things Between Linux & UNIX: Both share many common applications such as:
Cosc300Dp 4
Examples are Debian, Ubuntu, Fedora, SuSE and Mandriva, which are by far the
most popular Linux systems and generally considered easy to handle for the
beginning user, while not blocking professionals from getting the most out of
their Linux machines.
Linux also runs decently on laptops and middle-range servers.
Drivers for new hardware are included only after extensive testing, which adds
to the stability of a system.
Hardware
• This is the physical equipment of which your computer is composed; this includes things
like your keyboard and mouse, your video card and monitor, as well as your network
card, if you have one.
Kernel
• Operating system “kernel” is the core software used to “talk” to
computer hardware
• Is a core and modular system of drivers used to create a standardized
environment for interfacing with hardware
• Kernel operates in its own memory or “kernel-space”
• Responsible for allocating memory and time to system and user
processes as well as interacting with files.
• The Linux kernel acts as the interface between the hardware mentioned
above, and the rest of the operating system.
• The Linux kernel also contains device drivers, usually ones, which are
specific to the hardware peripherals that you are using.
Cosc300Dp 5
• The kernel is also responsible for handling things such as the allocation of resources (memory
and CPU time), as well as keeping track of which applications are busy with which files, as
well as security; and what each user is allowed to do on the operating system.
Shell
• On log-in, the system runs a shell
• A shell is the environment within which you will interface with the
kernel via
• commands
• It determines the syntax for complex command-line operations and
shell
• scripting
• The shell you’re using is called “bash,” the successor to the venerable
“Bourne Shell”
• called “sh”
• BASH: “Bourne Again SHell”
Various Shells
sh – the original UNIX shell
bash – written as a replacement/extension of sh
csh – C shell based on the C programming language developed in the late
1970s
tcsh – enhanced version of C shell
ksh – Korn shell developed in the early 1980’s, backward compatible with
sh, but with some
features of csh
zsh – extended version of sh, developed in 1990
dash – developed as replacement for ash in Debian
Cosc300Dp 6
• more than one user can be working on the same system at the same time - via different
consoles, pseudo and dumb terminals,
• The kernel divides up the time allotted to tasks; these are called "time slices".
• The kernel is responsible for running the tasks on the CPU, saving their state and
removing them, and then replacing them with the next task for its allocated "slice of
time".
• On machines with more than one CPU, a technique called Symmetric Multiprocessing
(SMP) is used to do the time slicing over multiple CPU's.
• Process Flow:
• When a user runs a standard utility or application, that software makes a call to the
kernel, via the standard library of procedures, requesting system resources, such as the
contents of files or the input being feed in via the keyboard.
• The kernel in turn then queries the actual hardware for this information, and then
returns it, again via the standard library of procedures layer.
• This layering is what provides the system with a level of stability. If your application
crashes for some reason, it is separated enough from the kernel to prevent it taking
down the whole system.
Programming on Linux
Linux Advantages
1. Low cost: You don’t need to spend time and money to obtain licenses since Linux and much of its
software come with the GNU General Public License. You can start to work immediately
Cosc300Dp 7
without worrying that your software may stop working anytime because the free trial version
expires. Additionally, there are large repositories from which you can freely download high quality
software for almost any task you can think of.
2. Stability: Linux doesn’t need to be rebooted periodically to maintain performance levels. It doesn’t
freeze up or slow down over time due to memory leaks and such. Continuous up-times of hundreds of
days (up to a year or more) are not uncommon.
3. Performance: Linux provides persistent high performance on workstations and on networks. It can
handle unusually large numbers of users simultaneously, and can make old computers sufficiently
responsive to be useful again.
4. Network friendliness: Linux was developed by a group of programmers over the Internet and has
therefore strong support for network functionality; client and server systems can be easily set up on
any computer running Linux. It can perform tasks such as network backups faster and more reliably
than alternative systems.
5. Flexibility: Linux can be used for high performance server applications, desktop applications,
and embedded systems. You can save disk space by only installing the components needed for
a particular use. You can restrict the use of specific computers by installing for example only
selected office applications instead of the whole suite.
6. Compatibility: It runs all common Unix software packages and can process all common file
formats.
7. Choice: The large number of Linux distributions gives you a choice. Each distribution is developed
and supported by a different organization. You can pick the one you like best; the core functionalities
are the same; most software runs on most distributions.
8. Fast and easy installation: Most Linux distributions come with user-friendly installation and
setup programs. Popular Linux distributions come with tools that make installation of additional
software very user friendly as well.
9. Full use of hard disk: Linux continues work well even when the hard disk is almost full.
10. Multitasking: Linux is designed to do many things at the same time; e.g., a large printing job in
the background won’t slow down your other work.
11. Security: Linux is one of the most secure operating systems. “Walls” and flexible file access
permission systems prevent access by unwanted visitors or viruses. Linux users have
to option to select and safely download software, free of charge, from online repositories
containing thousands of high quality packages. No purchase transactions requiring credit card
numbers or other sensitive personal information are necessary.
12. Open Source: If you develop software that requires knowledge or modification of the
operating system code, Linux’s source code is at your fingertips. Most Linux applications are Open
Source as well.
UNIX is copyrighted name only big companies are allowed to use the UNIX copyright and
name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems. The Open
Group holds the UNIX trademark in trust for the industry, and manages the UNIX trademark
licensing program.
Cosc300Dp 8
Linux is a UNIX Clone
But if you consider Portable Operating System Interface (POSIX) standards then Linux can
be considered as UNIX. To quote from Official Linux kernel README file.
Linux is a Unix clone written from scratch by Linus Torvalds with assistance from a loosely-knit
team of hackers across the Net. It aims towards POSIX compliance.
However, "Open Group" do not approve of the construction "Unix-like", and consider it misuse of
their UNIX trademark.
File Systems
Cosc300Dp 9
For number os user it creates only one process.
It will effect to all other users.
Limited number of users increases in users loads to decrease in performance.
Windows is closed system
GUI-it is user friendly
Only one Microsoft Company.
If you ask ten system administrators what their job entails, you'll get ten different answers.
Linux system administration is a job that defines itself over the time you hold it, and redefines itself
over and over thereafter. In simple terms, the system administrator is the person responsible for
maintaining a computer system at peak efficiency. The analysis required to maintain the system makes
the job both challenging and rewarding. Users are the wildcards that make system administration
much more unpredictable than simple system maintenance. Changing user needs,changing security
environments, and changing applications, all conspire to change the system administrator's role over
time. Despite its changing nature, certain tasks confront all system administrators on all Linux
systems.
A system administrator aims to be as transparent to the user as possible. How much the users
need to contact you is a good indicator of how well you are doing your job. If you do your system
administration tasks well, users will seldom need to think of you at all, except to recruit you for the
company softball team or, of course, when they want additional services from the Linux system.
Cosc300Dp 10
Your workload will vary dramatically. You'll learn to cherish the lull times when there is little
external pressure, because they will enable you to work on projects to improve service and because
you'll know from experience that just around the corner something will happen that requires working
through the night or even several consecutive nights. If you spend the lull times evaluating your
system for potential security problems or areas where performance could be improved, you'll find that
there will be more low−pressure times as a result.
But what exactly is system administration? The term is so broad that no definition will give the
whole picture. A simple definition might be "the installation and maintenance of a computer system."
However, because a computer system might be anything from one computer to a networked
system containing hundreds of computers, and because each employer expects something different,
these few words don't define system administration in any strict sense. The real definition must
include the system administrator's role as the mediator between machine and user, since you are the
judge who decides whether problems are computer or user induced and the jury who determines what
should be done about it.
A better way to define system administration might be to develop a list of tasks performed by a system
administrator. This is not a comprehensive list, largely because every time we become comfortable
with our job descriptions, something else is added, but it is a fairly complete list of tasks you can
expect to perform as a Linux system administrator:
Configuring hardware•
Installing the operating system•
Installing application software•
Implementing system security•
Configuring the kernel•
Creating users and groups•
Updating software•
Performance tuning•
Disaster recovery•
Capacity planning•
Network administration
Cosc300Dp 11
Login Linux:
When you first connect to a Linux system, you usually see a prompt such as the following:
login:
To log in:
1. Have your userid (user identification) and password ready. Contact your system administrator if
you don't have these yet.
2. Type your userid at the login prompt, then press ENTER. Your userid is case-sensitive, so be sure
you type it exactly as your system administrator instructed.
3. Type your password at the password prompt, then press ENTER. Your password is also case-
sensitive.
4. If you provided correct userid and password then you would be allowed to enter into the system.
Read the information and messages that come up on the screen something as below.
login : bsr
amrood's password:
Last login: Sun Jun 14 09:32:32 2009 from 62.61.164.73
$
You would be provided with a command prompt ( some time called $ prompt ) where you would type
your all the commands. For example to check calendar you need to type cal command as follows:
$ cal
June 2009
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Change Password:
All Unix systems require passwords to help ensure that your files and data remain your own and that
the system itself is secure from hackers and crackers. Here are the steps to change your password:
3. Type in your new password. Always keep your password complex enough so that no body can
guess it. But make sure, you remember it.
Cosc300Dp 12
4. You would need to verify the password by typing it again.
[bsr@localhost ~]passwd
Changing password for bsr
(current) Unix password:******
New UNIX password:*******
Retype new UNIX password:*******
passwd: all authentication tokens updated successfully
[bsr@localhost ~]
Note: I have put stars (*) just to show you the location where you would need to enter the current and
new passwords otherwise at your system, it would not show you any character when you would type.
$ ls –r
$ ls --reverse
$ ls /scratch
You can run more than one command on the same line by separating the commands with a
semicolon (;)
$ date; ls
Most Linux commands have a manual page or help to describe how they can be used
$ man ls
Cosc300Dp 13
Who Are You?
While you're logged in to the system, you might be willing to know : Who am I?The easiest way to
find out "who you are" is to enter the whoami command:
[bsr@localhost ~]$ whoami
bsr
[bsr@localhost ~]$
Try it on your system. This command lists the account name associated with the current login. You can
try who I command as well to get information about yourself am.
Who is Logged In?
Sometime you might be interested to know who is logged in to the computer at the same time.
There are three commands are available to get you this information, based on how much you'd like to
learn about the other users: users, who, and w.
[bsr@localhost ~]$ users
bsr bsr
[bsr@localhost ~]$ who
bsr :0 Feb 11 00:31
bsr pts/1 Feb 11 00:32 (:0.0)
[bsr@localhost ~]$
Try w command on your system to check the output. This would list down few more information
associated with the users logged in the system.
Logging Out:
When you finish your session, you need to log out of the system to ensure that nobody else accesses
your files while masquerading as you.
To log out:
1. Just type logout command at command prompt, and the system will clean up everything and
break the connection
System Shutdown:
The most consistent way to shut down a Linux system properly via the command line is to use one of
the following commands:
Command Description
halt Brings the system down immediately.
Powers off the system using predefined scripts to synchronize and
init 0
clean up the system prior to shutdown
Reboots the system by shutting it down completely and then
init 6
bringing it completely back up
poweroff Shuts down the system by powering off.
reboot Reboots the system.
shutdown Shuts down the system.
Cosc300Dp 14
You typically need to be the superuser or root (the most privileged account on a Linux system) to shut
down the system, but on some standalone or personally owned Linux boxes, an administrative user and
sometimes regular users can do so.
Exercise #2: Log on a Linux machine or connect to one from a Windows machine. Enter your login
(user name) and password at relevant prompts. Enter these commands at the Linux prompt, and try
*******The End8********
Cosc300Dp 15