Вы находитесь на странице: 1из 8

WhatisOperatingSystem

OperatingSystemissoftwarethatworksasaninterfacebetweenauserandthecomputer
hardware.Theprimaryobjectiveofanoperatingsystemistomakecomputersystemconvenientto
useandtoutilizecomputerhardwareinanefficientmanner.Theoperatingsystemperformsthe
basictaskssuchasreceivinginputfromthekeyboard,processinginstructionsandsendingoutputto
thescreen.
SomepopularOperatingSystemsincludeWindows,OSXandLinux.

Here in this course we will be learning about Linux

Linux

Linux is an operating system or a kernel created by Linus Torvalds and is around us since mid 90s.
Today, supercomputers, smart phones, desktop, web servers, tablet, laptops and home appliances
like washing machines, DVD players, routers, modems, cars, refrigerators, etc use Linux OS.

LinuxAdvantage
Itisanopensourceoperatingsystemandprogrammerscandesigntheirownoperating
system

HighlySecuredyoudon'tneedanantivirus

Itsabsolutelyfreeandyoucaninstallitonasmanycomputersasyouwant.

TheLinuxoperatingsystemsnowoffermillionsofapplicationstochoosefrom,mostof
themfree.
LinuxistheOSofchoiceforServerenvironmentsduetoitsstabilityandreliability(Mega
companieslikeAmazon,Facebook,andGoogleuseLinuxfortheirServers).ALinuxbased
servercouldrunnonstopwithoutarebootforyearsonend.
LinuxDistributionsList
ThereareonanaveragesixhundredLinuxdistributorsprovidingdifferentfeaturessomeofwhich
regularlyusedare:

Distribution Why To Use


This is the third most popular desktop operating system after Microsoft
UBuntu Windows and Apple Mac OS. It is based on the Debian Linux Distribution and
it is known for its desktop environment
Linux mint It works like windows and should be use by new comers.
Debian is a stable and popular non-commercial Linux distribution. It is widely
Debian used as a desktop Linux Distro and is user-oriented. It strictly acts within the
Linux protocols.
Fedora An endeavor by Red Hat. It is popular among desktop users.
Red hat enterprise To be used commercially.
It is one of the most used Linux Distribution for enterprise and web servers. It is
CentOS a free enterprise class Operating system and is based heavily on Red Hat
enterprise Distro
It is not for the beginners because every package has to be installed by yourself
Arch Linux
and popular amongst Developers.

Unix Vs Linux
UNIX is called the mother of operating systems which laid out the foundation to Linux. Though
they might seem different, at core, they are essentially the same. Since, Linux is a clone of UNIX.
So learning one is same as learning another.

Comparison Linux Unix


It is an open-source operating system which It is an operating system which can
Definition
is freely available to everyone. be only used by its copyrighters.
It has different distros like Ubuntu, Redhat,
Examples IBM AIX, HP-UX and Sun Solaris.
Fedora, etc
Nowadays, Linux is in great demand.
It was developed mainly for servers,
Users Anyone can use Linux whether a home user,
workstations and mainframes.
developer or a student.
Linux is used everywhere from servers, PC,
It is used in servers, workstations
Usage smartphones, tablets to mainframes and
and PCs.
supercomputers.
Linux is freely distributed,downloaded, and
Unix copyright vendors decide
distributed through magazines also. And
Cost different costs for their respective
priced distros of Linux are also cheaper than
Unix Operating systems.
Windows.
Operating Unix is a complete package of
Linux is just the kernel.
system Operating system.
LINUX ARCHITECTURE

The architecture of a Linux System consists of the following layers

Hardware layer Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).

Kernel It is the core component of Operating System, interacts directly with hardware,
provides low level services to upper layer components.

Shell An interface to kernel, hiding complexity of kernel's functions from users. The shell
takes commands from the user and executes kernel's functions.

Utilities Utility programs that provide the user most of the functionalities of an operating
systems.
Linux Commands:
All the Linux commands are classified into 3 groups.
a) Basic Utility Commands
b) Directory Related Commands
c) File Related Commands

Syntax
The commands in Linux have the following syntax:
$command options arguments

Basic Utility Commands:


COMMAND - banner
Description Display a blown-up text in large letters and multiple lines.
Syntax $ banner comment
Example $ banner ' linux ' ' lab '

COMMAND - echo
Description Used to display a message on the screen.
Syntax $ echo " comment "
Example $ echo " UBUNTU "

Description The echo command is used to display the values of a variable. One such
variable is HOME. To check the value of a variable precede the variable
with a $ sign.
Syntax $ echo $HOME
Example $ echo $HOME

COMMAND - tty
Description It is a teletype command and it Displays current terminal.
Syntax $ tty
Example $ tty

COMMAND - cal
Description Displays the calendar of the current month.
Syntax $ cal
Example July 2017

Description cal will display calendar for the specified month and year.
Syntax $ cal mm yyyy
Example cal 02 2017

COMMAND date
Description Displays current date and time.
Syntax $ date

Description If you are interested only in time ( hh:mm:ss )


Syntax $ date +%T

Description Current day of the month.


Syntax $ date +%d

Description last two digits of the year


Syntax $ date +%y

Description month in numeric form and 4 digit year


Syntax $ date +"%H %Y"

COMMAND man
Description The man pages are properly documented pages. They have following
sections:
NAME: The name and one line description of the command.
SYNOPSIS: The command syntax.
DESCRIPTION: Detailed description about what a command does.
OPTIONS: A list and description of all of the command's options.
EXAMPLES: Examples of command usage.
FILES: Any file associated with the command.
AUTHOR: Author of the man page
REPORTING BUGS: Link of website or mail-id where you can report
any bug.
SEE ALSO: Any commands related to the command, for further
reference.
Syntax man command
Example $man date

COMMAND ispell
Description ispell is used to spell check a document and let you perform the correction on
line
Syntax $ispell (enter) {work for which spelling is to be checked}
Example $ispell (enter) admin

COMMAND who
Description to get all information of current users.
Syntax $who

COMMAND whoami
Description to get details of the current users.
Syntax $whoami

COMMAND uname
Description to get operating system name and edition
Syntax $uname

COMMAND history
Description to display all the current activities of the system.
Syntax $history

COMMAND passwd
Description to display all the current activities of the system.
Syntax $history

COMMAND - clear
Description to clears the display screen
Syntax $clear

COMMAND - ps
Description to get present process status
Syntax $ps

COMMAND - logout
Description to work out from log in session
Syntax $logout

COMMAND - bc
Description to active calculator
Syntax bc(enter)expression(enter) <cntrl+d>
Example bc(enter) 12+5(enter)
bc(enter) scale=2[to get digits after decimal] 15/2(enter)<cntrl+d>
bc(enter)ibase=2[to get base of 10 from binary value]10110(enter)<cntrl+d>
bc(enter)obase=2[to get base of binary value from base of 10 value ]10
(enter) <cntrl+d>
Directory Related Commands

COMMAND pwd
Description The pwd command (print working directory) writes the full pathname of the
current working directory to the standard output.
Example pwd

COMMAND cd / chdir
Description The cd command (change directory), is used to change the current working
directory in operating systems.
Example cd /etc
pwd
cd /bin
pwd

COMMAND cd ~
Description The cd is also a shortcut to get back into your home directory. Just typing cd
without a target directory, will put you in your home directory. Typing cd ~
has the same effect.
Example cd~ , cd

COMMAND cd ..
Description To go to the parent directory (the one just above your current directory )
Example pwd
cd ..
pwd

COMMAND cd -
Description to go to the previous directory
Example cd -

Path
A path is a unique location to a file or a folder in a file system of an OS. A path to a file is a
combination of / and alpha-numeric characters.
Absolute path name
An absolute path is a complete path from start of actual filesystem from / directory.
Example - /var/ftp/pub
Relative Path
A reative path does not begin with a slash ( / ). Generally you specifies location relative to your
current working directory. This is most useful to short a path name.
Example if your current working directory is /home/tom and if you would like to change directory to
/home/tom/docs/bio you can enter command cd docs/bio instead of cd /home/tom/docs/bio .
Example:

Absolute Path Relative Path


$ pwd $ pwd
/home/user1 /home/user1
$cd /home/user1/Documents/ (using absolute $cd Documents/ (using relative path)
path) $pwd
$ pwd /home/user1/Documents
/home/user1/Documents

COMMAND ls
Description ls with no option list files and directories in bare format where we wont be
able to view details like file types, size, modified date and time, permission
and links etc.

COMMAND ls -l
Description ls -l shows file or directory, size, modified date and time, file or folder name
and owner of file and its permission. It gives you a long listing.

COMMAND ls -a
Description ls -a is used to show all files ( including the hidden files). When a file name
on a Linux file system starts with a dot, it is considered a hidden file and it
doesn't show up in regular file listings.
Example ls { you will see file without any . Symbol }
ls -a
COMMAND mkdir
Description The mkdir stands for 'make directory' and a new directory can be created
whenever required
Syntax mkdir <dirname>
Example mkdir FRUITS

Description To make multiple directories


Syntax mkdir <dirname1> <dirname2> <dirname3> ..
Example mkdir Apple Mango Banana

COMMAND rmdir
Description When a directory is empty, rmdir is used to remove the directory.
Example rmdir FRUITS
Description To remove multiple directories
Example rmdir Apple Mango

COMMAND mv
Description The 'mv' (move) command can be used for renaming directories.
Syntax mv <directoryname> <newdirectoryname>
Example mv Banana fruits

PROBLEMS WITH SOLUTIONS


1. Display your current directory. pwd
2. Change to the /etc directory. cd /etc
3. Now change to your home directory using only three key presses. cd (and the enter key)
4. Change to the /boot/grub directory using only eleven key presses. cd /boot/grub (use the tab
key)
5. Go to the parent directory of the current directory. cd .. (with space between cd &..)
6. Go to the root directory. cd /
7. List the contents of the root directory. ls
8. List a long listing of the root directory. ls -l
9. Stay where you are, and list the contents of /etc. ls /etc
10. Stay where you are, and list the contents of /bin and /sbin. ls /bin /sbin
11. Stay where you are, and list the contents of ~. ls ~
12. List all the files (including hidden files) in your home directory. ls -a
14. Create a directory testdir in your home directory. mkdir ~/testdir
15. Change to the /etc directory, stay here and create a directory newdir in your home
directory. cd /etc ; mkdir ~/newdir
17. Remove the directory testdir. rmdir testdir
18. Display the system date in following format : Today is Friday, 17 May 96
$ echo "Today is "`date +%A`" , "`date +%d` `date +%B` `date +%g`
19 Display the following text message on the monitor screenDeposited $100 to you account
$ echo -e "Deposited \$100 to you account"

Вам также может понравиться