By :- Shreyas Sanjay Deshpande
Abhijit Ravindra Chaudhari
Introduction to LINUX
l
Linus Tordvals developed LINUX in 1991
l
Linux is based on UNIX.
l
LINUX = LINU's uniX
l
Unix was commercial OS and not very user friendly
Linus Tordvals developed LINUX
keeping students and home users in mind.
Introduction to LINUX
• Linux is NOT an OS
• Linux is an interface between computer/server
hardware, and the programs which run on it.
• Simply put LINUX is a KERNEL.
• Because it does not include apps like file system
utilities, GUI , system admin, text editor etc.
• Kernel: Kernel is described as the heart of the OS
which provides services like,
i) Process management
ii) Device drivers
iii) Memory management
iv) Interrupt handling etc.
LINUX vs WINDOWS
• L:Open source software
W:Commercially developed OS.
• L:free downloadable file
W:needs to be purchased.
• L:distribution and Modifications
allowed
W:Distribution is illegal.
LINUX vs WINDOWS
l
L: Frequent Updates available
W: Updates only once in two years or more.
●
L: works on all processors from ARM to Supercomputers.
W: Limited processors (Domestic and Office).
LINUX vs WINDOWS
●
L: only 48 viruses know
W: new viruses produced daily.
●
L:This is the KERNEL which can be used to developed
RTOS as well as GPOS.
W:It is complete GPOS so we have to use it as is.
This is why LINUX is preferred.
LINUX Flavours
• Being an Open source KERNEL, many
enthusiastic groups developed their
own LINUX OS ,known as Flavours
redhat Mint Fedora
Debian Ubuntu
RedHat
Debian
Fedora
Mint
Ubuntu
How to Install
oPrerequisites:
●
20 GB free space(unallocated) EXT4
●
2 GB free space (unallocated) SWAP
●
RAM: >512MB
●
LINUX iso file.
Basic Commands
ls (list)
When you first login, your current working directory is your home directory.
Lists the files present in your CWD
username@hostname:~ $ ls (short for list)
Also try:
LS
ls -a
ls -l
ls -l | more
Basic Commands
pwd (print working directory)
Pathnames enable you to work out where you are in relation to the whole file-system.
For example, to find out the absolute pathname of your home-directory, type cd to get
back to your home-directory and then type
$ pwd
mkdir (make directory)
We will now make a subdirectory in your home directory to hold the files you will
be creating and using in the course of this tutorial. To make a subdirectory
called unixstuff in your current working directory type
$ mkdir unixstuff
Basic Commands
cd (change directory)
The command cd directory means change the current working directory to 'directory'.
The current working directory may be thought of as the directory you are in, i.e. your
current position in the file-system tree.
To change to the directory you have just made, type
$ cd unixstuff
cat (concatenate)
The command cat can be used to create and display the contents of a
file on the screen.
$ cat > science.txt (to save CTRL + D)
To view the contents of the file
$ cat science.txt
For some fun, try
$ tac science.txt
Basic Commands
vi
VI is an editor for Linux by using which you can create and modify text files.
$ vi test.txt
press “i” for insert mode
enter text
to save and exit : press ESC -> press “:” -> press
“w” and “q”
To view and edit
$ vi test.txt
To exit without saving: press ESC ->press”:”-> press
“q” and “!”
Basic Commands
rm (remove)
To delete (remove) a file, use the rm command. As an example, we
are going to create a copy of the science.txt file then delete it.
Inside your unixstuff directory, type
$ rm science.txt
$ ls (to check if it has deleted the file)
$ cd ..
will take you one directory up the hierarchy (back
to your home directory).
Basic Commands
rmdir (remove directory)
To delete (remove) a file, use the rm command. As an example, we
are going to create a copy of the science.txt file then delete it.
Inside your unixstuff directory, type
$ rmdir unixstuff
$ ls (to check if it has deleted the directory)
Basic Commands
clear
To clear the screen
$ clear
cal
To show the month view of calendar
$ cal
Basic Commands
date
To show date and time
$ date
uptime
To find out how long the system is up
$ uptime
Basic Commands
Hostname
Displays the computer name
$ hostname
lshw
Displays the hardware configuration
$ lshw
Basic Commands
ifconfig
To check the network Configuration
$ ifconfig
To add command output to a file
$ ifconfig >> network.txt
Basic Commands
Linux has a ROOT user and a LIMITED user.
All the computers here are logged in limited user
access. Hence the “$”
For the root user it will be replaced by “#”
sudo
Limited user cannot manage packages
but to give temporary rights to the user
for manage packages we use this
command.
Basic Commands
apt-get
This is a utility software which helps to manage the
packages on the computer
$ sudo apt-get update
$ sudo apt-get upgrade
Basic Commands
startx
To load the GUI (x window)
$startx
To go back to the CLI
CTRL + ALT + F1
Package Installation
l
Via INTERNET :
●
To install VIM package
●
$ sudo apt-get install vim
●
To uninstall VIM, replace install with remove.
●
Via downloaded package
●
To install Packet Tracer
●
$ sudo chmod 777 packagename (to get ownership)
●
$ sudo ./packagename
Package Installation
l
LINUX has four types of installation package
●
.rpm
●
$ rpm -ivh packagename
●
.deb
●
$ sudo dpkg -i pakagename
●
.sh
●
$ sudo sh packagename
●
.run
●
$ sudo ./packagename
Compiling a C program
l
LINUX uses a compiler called as GCC(Gnome C Compiler)
l
To write a program we can use either “vim” or “cat” command
l
Let us build our first program for LINUX
●
$ sudo vim
●
press “i” for insert mode
●
#include <stdio.h>
●
#include <stdlib.h>
●
void main ()
●
{
●
printf(“\n JAI HIND \n”);
●
}
Compiling a C program
l
To save the program
●
press ESC → press “:” → type “wq first.c”
●
To Compile
●
$ gcc first.c (a.out file will be created)
●
$ ./a.out (to run the program)
●
To make customized out file
●
$ gcc -o first first.c
●
$ ./first (to run the program)
Any Doubts ??
Thank you