Understanding the basics of Linux OS
Upcoming SlideShare
Loading in...5

Understanding the basics of Linux OS



This Presentation would help in understanding the basic concept of Linux OS and attributes related to its features.

This Presentation would help in understanding the basic concept of Linux OS and attributes related to its features.



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Understanding the basics of Linux OS Understanding the basics of Linux OS Presentation Transcript

  • LINUX OPERATING SYSTEM A Practical Training Seminar Presentation Submitted By: Rahul K.M. Department of Computer Science Engineering Alwar Institute of Engineering and Technology NOTE: Play slideshow , then only the whole thing would make sense
  • Contents • Introduction To Linux • Benefits Of Linux • Unix • Linux Distributions • Linux Installation • Linux File system • Users In Linux • File Management • Linux Commands • Linux File Permissions • Redirection In Linux • Pipe, Grep & Sort Commands • Networking & Communication In Linux • Vi Editor • Shell Programming • Perl Programming • Gcc/G++ In Linux
  • •Linux is an operating system or a kernel which germinated as an idea in a young and bright “Linus Torvalds”. •Before Linux , A famous professor “Andrew Tanenbaum” developed Minix, a simplified version of UNIX that runs on PC. It was for class teaching only. No intention for commercial use. •Linus used to work on Unix OS and thought it needed improvements. But his suggestions where rejected by the developers of Unix then he thought of creating an OS which would be “Receptive to the changes, modification suggested by its users” • So Linus was devised as the kernel named Linux in 1991. •So he came with the collaboration with various programmers in places like MIT(Massachusetts Institute of Technology).A working Linus OS with some applications was launched in 1991. •The early versions of Linux were not so user friendly as they were mostly used by computer programmers. This lead to minimized popularity as other commercially oriented OS like Windows got famous. But now Linux gets its due attention. Introduction to Linux
  • Benefits Of Linux • The main advantage of Linux is that programmers were able to use the Linux kernel in order to design there custom Operating system. • There are 1000‟s of OS on Linux which offers a variety of functions to the user. • Linux is useful for Programmers as well as the regular computer users around the world. • It‟s a free Operating System unlike windows which has to be purchased. • Other benefits are being open source, anyone with programming knowledge can modify it. • Once installed in your system, no antivirus required. Linux is a highly secure system. • With its upgrades Linux becomes more secure and robust. • Linux is the OS of choice for servers environment due to its stability and reliability. • Companies like Amazon, Google, Facebook use Linux for their servers. • Linux based servers could run non-stop without a reboot for years.
  • Unix • Unix is the mother of the OS which lay down the foundation to Linux. • Unix is designed mainly for mainframes, enterprises and universities. While Linux is becoming a household lane for computer users, developers and server environments. • We may have to pay for Unix while Linux is free. • Commands used in both the OS is usually the same , There is not much difference bw Unix and Linux. • Though they might look different but at core they are the same since Linux is the clone of Unix.
  • Linux Distribution • Linux is used by programmers, organizations around the world in order to create custom OS to suite their requirements. These custom version of Linux is known as Linux distributions or distros. • There are 100‟s of Linux distros available, some of them are designed to accomplish a sole purpose like running servers, act as network switches, routers, etc.. • The latest example of one of the most popular Smartphone based Linux distro is Android. • Some of the popular distros : arch Linux :popular among developers. Cent OS(Community Enterprise OS): used mostly for enterprise & web servers. Gentoo : source based distros. Linux mint: 4th most popular distro available since 2006. Ubuntu: 3rd most popular OS after MS Windows & Apple Mac OS.
  • Linux Installation • Linux can be installed in your system via the below mentioned methods: USB stick Live CD Virtual Installation: It offers you of running Linux on an existing OS already installed on your system by using virtual machine software's like Oracle Virtual Box or Vmplayer Workstations.
  • Linux File system • Unix/Linux uses a tree like hierarchical file system, unlike in windows where files are stored in folders under different data drives like C: , D: , E: etc.. • In Unix/Linux everything is a file and even devices like printers, mouse, keyboard, cdrom are all files. • In Linux there are two types of files: General files: ordinary files like images videos, music or text. It can be ASCII or Binary format Directory files: are warehouse for other file types or other directories like folders in windows.
  • Users In Linux • There are three types of users accounts in Linux: Regular user: ordinary user contains limited privileges. Root user: can access restricted files, install software's and has administrative privileges, also called as the super user.  Service user: Linux is widely used as a server OS, services such as apache, squid have their own service accounts, having service accounts increases security of computer.
  • File Management • The most frequent task performed by an average user on a computer is browsing, creating, moving & deleting files. • There are two ways to manage files : CLI: Command Line Interface or Terminal GUI: Graphical User Interface or File manager • CLI provides commands are flexible and offer more options which are not available in the GUI mode • Some configuration in GUI may consist of several steps while it can be done in a single command in CLI mode. Creating an account in Linux may take 4 different steps but in CLI mode a single command is executed for the same [home@virtualbox :~$ sudo usermod –a –G home rkm] • Working on multiple files at a time in GUI may take long intervals, while using CLI it can be done in seconds. • CLI loads fast as compare to GUI as it does not take much ram space, so it does not effect the system performance at all. This is important to handle situations while server is down.
  • Linux Commands Commands Description PWD For determining the directory in which you are working on. CD <directory name> To change to a particular directory. CD or CD ~ Navigate to HOME directory. CD/ To move to ROOT directory. CD /dir1/dir2 Navigate through multiple directories at the same time. CD .. Move one level up Some of the important commands used for navigation in CLI
  • Some of the commands used in file management Commands Description ls List all the files and directories in the present working directory ls -r List all the files in a directory and its sub-directory as well ls -al Show detailed information about the files and the directories ls -a Shows hidden files present in a directory. All hidden files are listed and all of them starts with a period. cat > filename This will create a new file in the present working directory cat filename This displays the file contents Cat file1 file2 > file3 Joins the content of two files(file1, file2) and stores the output in a new file(file3). mv file “new_file_path” Moves the file to the given location
  • Commands Description mv filename new_file_name Rename the file to a new filename. sudo or su Allows regular user to run programs as superuser or root. rm <filename> Delete a file or a directory. mkdir< directory_name> Creates a new directory in the present working directory. mkdir <path/dir> Creates a new directory at the specified path. man command man stands for manual, the ref. book for Linux. Gives details about the command. history Gives a list of all past commands typed in the current terminal session. clear Clears the
  • Linux File Permissions • Linux being a multi-user system uses permissions & ownership for security. • Linux security is defined by Authorization levels : Ownership Permission • Ownership are of three types: User: owner of the file, user also called as owner. Group: usergroup can contain multiple users, all users in the group have the same file permission Others: any other user who has access to a file but doesn‟t own a file or doesn‟t belong to a usergroup. Set permission to others also refers to set permission to the world • Permission system in Linux. Every file or directory in a Unix/Linux system has three permissions, read, write & execute defined for all the three owners.
  • • Read provide reading the file permission, Write enables to edit or manipulate the file and save it, execute enables the execute permission. • The file permissions on a file can be changed by “chmod” commands which can be further divided into Absolute & Symbolic mode. • The “chown command” can change the ownership of a file/directory. The command : Chown <username> <filename> or Chown <username> :<group> <filename> can change the ownership of the file. • The “chgrp” command can change the group ownership with the command chgrp <group_name> <filename>.
  • Redirection In Linux • Most of the commands in Linux takes an input & gives an output, the standard (stdin) input device is the keyboard & the standard (stdout) output device is the screen. • Output redirection denoted by „>‟ is used for stdout redirection. • For example: “echo hello > text”, “cat text” : hello • The symbol „>>‟ appends to an existing file. • Input redirection denoted by „<‟ is used for stdin redirection. • For example : mail -s “News Today” abc@ymail.com < Newsflash • “<&” re-directs output of one file to another. • Each file in Linux has its associated number called file descriptor FD associated with it. • When a program is executed, the output is send to FD of the screen ,then the o/p is seen on the screen. • There are three types of descriptors :stdin FD0, stdout FD1, stderr FD2. • Error redirection is routing the errors to a file other than the screen. • Error messages clutter up program output while executing shell scripts. The solution is to redirect the error messages to a file.
  • Linux Pipe, Grep & Sort Commands • The symbol „|‟ denotes the pipe. • Using pipes enables us to run more than one commands consecutively which helps in creation of powerful commands in Linux. • For example : “cat fruits | less” , this way we can scroll the contents of the file. • If we have to search a file for a text or a piece of information we use Grep command. • Using „grep‟ command we can scan a document, and present the result in a format you want. • For example : “cat <filename> | grep <text_string>” • The sort command comes in handy when you try to list the contents of a files alphabetically. • The syntax is “sort <filename>”, which sort the contents of the file alphabetically. • Sorting have some extensions like –r(reverse), -n(sorts numerically), -f(case insensitive sorting) • Filters are the outputs from the first command which becomes the input for the second one. • When we pipe two commands, the filtered output of first command is given to the next one.
  • Networking & Communication in Linux • While working on a Linux OS we need to communicate with other devices. • For this we can use some basic utilities which will help you communicate with: Networks Other Linux systems Remote users • Ping Utility is to check whether your connection with the server is healthy or not. • This command is also used in analyzing the network & host connections, tracking network performance & managing it, testing hardware & software issues. • The command is given by “ ping <IP address or hostname> “. • On running the ping command system sends 64 bytes of the data to the IP address, if even one of the data packets does not return or lost it would report a connection failure. • For example : ping www.google.com .
  • FTP • FTP stands for File Transfer Protocol. • It is the most preferred protocol for data transfer amongst computers. • It can be used for logging in & establishing a connection with the remote host. • Used in uploading & downloading of files. • Navigating through directories of the remote computer. • Browsing through the files in the directories of the remote system. • The command is : ftp <IP address or hostname> . • Username & the password is required for authenticating the connection. • Once locked in some of the following commands can be used: dir : displays the files in the directory of the remote computer. Passive : passive mode is used to eradicate the firewall restrictions or data port errors.  put <filename> /get <filename>: used to upload or download files. Quit : logout from FTP.
  • Telnet • Telnet is used to connect to a remote Linux computer. • Used to run programs and administrative task remotely. • It is similar to the remote desktop found in Windows. • The command : “ telnet <IP address or hostname> “. • Once authenticated by typing in username & password, you will able to execute commands in the remote system. • Once locked in you will not be able to execute the commands in your local system except those commands will be executed in the remote computer. • Now a days telnet has been ignored since more secure protocols to connect to remote computer have come up.
  • SSH • SSH stands for secure shell. • It is used to securely connect to a remote computer. • Compared to telnet, SSH is more secure in which a connection is authenticated using a digital certificate & an encrypted password. • It is widely used by system administrators to control remote Linux servers. • The syntax to login to SSH : “ SSH <username>@<IP_address> or <hostname> ”. • Upon entering the password SSH would be logged in. • Now the commands used for FTP could run in the terminal, and used to execute various task. • The commands will be executed on the remote computer at a fast rate. • Exit command would logout from SSH.
  • Vi Editor • Editing a file can be done either by GUI (gedit) or Terminal (vi editor). • Vi editor is most popular & classic text editor in the Linux family. • It is available in almost all the Linux distros. • It works the same across different platforms & distributions. • It is User friendly. • Many versions of vi are available: Vim (vi improved) , elvis, nvi, nano & vile. • Vi is always recommended as it is feature rich & provides endless possibilities to edit a file. • There are two operation modes in vi editor: Command mode: it takes the user commands Insert Mode: it is used to edit text files. • Learning to use this editor can benefit you in creating scripts and editing files.
  • Shell Scripting • There are two prime components in an OS: Kernel: it is at the nucleus of the computer, it makes the communication between the software and the hardware possible Shell: it is the outermost part of the OS. A shell is something that takes a command from the user process it and gives the output according to the command. • Shell is an interface from which a user works on the programs, command & scripts. • Shell is accessed by the terminal which runs it. • The Shell wraps arround the delicate interior of an Os protecting it from any accidental damage. Hence the name Shell. • There are two main Shells in Linux: Bourne Shell: the prompt is “$”, its derivatives are:
  • Derivatives of Bourne Shell: POSIX Shell also known as sh. Korn Shell also known as sh. Bourne Again Shell also known as bash which is the most popular of them all.  C Shell: the prompt for this Shell is “%” & its derivatives are:  C Shell also known as csh.  Tops C shell also known as tcsh. • Writing a series of commands & combining lengthy and repetitive sequence of commands which can be stored and executed at anytime. • Creating a Shell script:  Create a file using a text editor vi.  Name script file with extension .sh .  Start the script with #!/bin/sh.  Write some code.  Save the script file as filename.sh.  For executing the script type bash filename.sh.
  • Perl Programming • Perl is programming language specially designed for text editing. • It is now widely used for a variety of purposes including Linux system administration, network programming, web development etc.. • Perl can be used in: Creating programs. Handle databases and e-mails. GUI (Graphical User Interface) development. Networking & System Administration. • Shell v/s Perl: Programming in Perl doesn‟t cause any portability issues which is common while using different Shell‟s in Shell scripting. Error handling is very easy on Perl. Writing long & complex programs is easy in Perl. Shell is less secure.
  • • Creating a Perl Script: Create a file using vi editor Name the script file with the extension .pl. Start the script with #!/usr/bin/perl. Write some code. Save the script file as filename.pl. Run the script using bash filename.pl. • Some important notes before creating a Perl script: Defining a variable value: $var_name=“value”; [ eg:-$name=“Rahul”;]. Output in Perl: printf(“value to be printed”); [eg:-printf(“thanks”);]. Input in Perl: $variable=<STDIN>; [eg:- $name=<STDIN>;]. A comment should start with a # symbol. Every statement in Perl ends with a semi-colon. Perl is case-sensitive Space should not be used while naming the Perl script file
  • GCCG++ In Linux • The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages. • Originally named as GNU C Compiler, because it only handled the C programming language, GCC 1.0 was released in 1987 and the compiler was extended to compile C++ in December of that year. • GCC has been adopted as the standard compiler by most of the modern Unix/Linux OS, gcc is the "GNU" C Compiler, and g++ is the "GNU C++ compiler. • Let "hello.C" be a file that contains the C++ code: Start the terminal script with: vi hello.c . Write a simple C++ code. Save the code in the file. For compiling the code type g++ hello.C -o hello. For executing type ./hello. #include "iostream.h" int main() { cout << "Hellon"; }
  • Thank you !  Rahul K.M.