0% found this document useful (0 votes)
58 views26 pages

Linux Presentation: Authored By: Jyoti Kumar & Santosh Kamble Presented By: Jyoti Kumar Date: 11-12-2007

intro

Uploaded by

logcabinn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views26 pages

Linux Presentation: Authored By: Jyoti Kumar & Santosh Kamble Presented By: Jyoti Kumar Date: 11-12-2007

intro

Uploaded by

logcabinn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 26

LINUX PRESENTATION

Authored by: Jyoti Kumar & Santosh Kamble


Presented by: Jyoti Kumar
Date: 11-12-2007

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
AGENDA

Unix/Linux Overview and getting


help in Linux
Browsing Linux Filesystem
The Bash Shell

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
UNIX HISTORY & ITS PRINCIPLES
Unix History
First version of Unix was created in Bell Labs in 1969
Thereafter many Unix flavors emerged with its new name
E.g. IBM – AIX, HP – UX, SUN – Solaris etc..
These all flavors operate in similar manner

Unix Principles
Everything is a file including hardware
Can create small, single purpose programs
Chain the programs together to perform complex tasks

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
LINUX ORIGINS AND WHY LINUX
Linus Torvald, a Finnish college student in 1991 created Linux kernel
And when Linux kernel combined with GNU applications, Complete free UNIX-
like OS possible
It is open source development model – Free software!
It supports wide variety of hardware
It supports many networking protocols and configurations
Now it is fully supported (RedHat, SuSE)

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
LOGINS / VIRTUAL CONSOLES / COMMAND
SYNTAX
Login Modes: Text & Graphical Login Mode
Virtual consoles provide multiple non-GUI logins
There are by default 6 available virtual consoles
It is available through CTRL – ALT - F [ 1 - 6 ]
And X will be available at CTRL – ALT – F7, incase if it is running
Linux Commands have the following syntax:
 commands [options] [arguments]
Each item is separated by a space
Command options modify the command behavior
Arguments are filenames or other information needed by the command
Command can be separated with semicolon (;)

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
GETTING HELP IN LINUX
Don’t try to memorize everything!
Many levels of help is there in Linux
 whatis <command>
 <command> --help
 man and info
 /usr/share/doc
Man is called as Linux manual
Navigating Man pages
Searching the manual with man –k <keyword> | This will list all matching
pages
Alternative command apropos <keyword>

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
BROWSING THE FILESYSTEM
Understand Linux File Hierarchy Concepts
All Linux files and directories are organized into a single-rooted inverted
tree structure
Filesystem begins at the “root” directory (Top level Directory), represented
by “/” (forward slash) character
The home directories
 /root (superuser home directory), /home/<username>
The bin directories
 /bin, /usr/bin, /usr/local/bin
 /sbin, /usr/sbin, /usr/local/sbin
Foreign filesystem mountpoints
 /media and /mnt

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
OTHER IMPORTANT DIRECTORIES
/etc – Consists of system config files
/tmp – Consists of temporary files
/boot - Kernel and bootloader (Grub)
/var and /srv - Server data
/proc and /sys - System information
/lib, /usr/lib, - The lib directories
/usr/local/lib - The lib directories
pwd - Current Working Directory & it
displays the absolute path to the
current directory

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
ABSOLUTE PATHNAMES & RELATIVE
PATHNAMES
Absolute pathnames begin with a slash (/)
It signifies complete "road map" to file location
It can be used anytime you wish to specify a file name

Relative pathnames do not begin with /


It specifies location relative to your present working directory
It can be used as a shorter way to specify a file name

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
CHANGING DIRECTORIES & LISTING
DIRECTORY CONTENTS
cd - Changing directories
Change directories to an absolute or relative path
 $ cd /home/jkumar/project
 $ cd project/documents
Move to a directory one level up
 $ cd ..
Move to your home directory
 $ cd
Move to your previous working directory:
 $ cd –
Lists the contents of the current directory or as specified
 ls [options] [files_or_dirs]

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
COPYING, MOVING AND RENAMING FILES AND
DIRECTORIES
cp - Copying files and directories
 cp [options] file destination
More than one file may be copied at a time if the destination is a directory
 cp [options] file1 file2 destination
mv - Moving and/or rename files and directories
 mv [options] file destination
More than one file may be moved at a time if the destination is a directory
 mv [options] file1 file2 dest

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
CREATING AND REMOVING FILES &
DIRECTORIES
rm - remove files
 Usage: rm [options] filenames
 -i - interactive
 -r - recursive
 -f - force
touch – create empty files or update file timestamps
mkdir - make a directory
rmdir - remove an empty directory
rm –r - recursively remove a directory and all of its contents

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
DETERMINING FILE CONTENT & VIEWING
TEXT FILE
Files can contain many types of data
Check file type with file before opening to determine appropriate command
or application to use
 file [options] filename(s)
Viewing Text File
 cat [options] [file...]
 less [options] [filename]
 Scroll with arrows/pgUp/pgDown
 Useful commands while viewing:
 /text - search for text
 n - next match
 v - open file in text editor
less is the pager used by man

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
PARTITIONS, FILE SYSTEM AND FILE TYPES
Disk drives are divided into partitions
Partitions are formatted with file system allowing user to store data
Default file system: ext3, The Third Extended Linux File System
Other common file systems: ext2 and msdos (Typically used for the floppies)
& iso 9660 (Typically used for the CDs)
There are seven fundamental file types..
 Regular File (-)
 Directory (d)
 Symbolic Link (l)
 Block Special File (b)
 Character Special File (c)
 Named Pipe (p)
 Socket (s)

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
INODE – INDEX NODE
An inode table contains a list of all files in an ext2 or ext3 filesystem
An inode (index node) is an entry in the table, containing information about a
file (the metadata) which includes
 file type, permissions, link count, UID, GID
 the file's size and various time stamps
 pointers to the file's data blocks on disk
 other data about the file
The computer's reference for a file is the inode number
The human way to reference a file is by file name
A directory is a mapping between the human name for the file and the
computer's inode number

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
SYMBOLIC AND HARD LINKS
A symbolic link points to another file
ls –l displays the link name and the referenced file
The content of the symbolic link is the name of the file that that its references
 ln –s <file name> <link name>

Hard Link: One physical file on the file system


Each link references the file’s inode
File is present in the file system as long as one link remains
 ln <file name> <link name>
It cannot span drive or partitions

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
CHECKING FREE SPACE
df - Reports disk space usage
Reports total kilobytes, kilobytes used, kilobytes free per file system
-h displays sizes in easier to read units
 df –h /home
du - Reports disk space usage
Reports kilobytes used per directory
Includes subtotals for each subdirectory
 du –sh /home

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
REMOVABLE MEDIA
“Mounting” means making a foreign filesystem look like part of the main
tree.
Before accessing, media must be mounted
Before removing, media must be unmounted
By default, non-root users may only mount certain devices (cd, dvd, floppy,
usb, etc)
Mountpoints are usually under /mnt
 mount /mnt/cdrom
 umount /mnt/cdrom
 mount /mnt/floppy
 umount /mnt/floppy

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
ARCHIVE FILES & COMPRESSION UTILITIES
Archiving places many files into one target file
 Easier to back up, store, and transfer
tar - Archiving command
Creating Archives
 tar cvf archive_name files...
Inspecting Archives
 tar tvf archive_name.tar
Extracting Archives
 tar xvf archive_name.tar
gzip, gunzip - Standard Linux compression utility
bzip2, bunzip2 - Newer Linux compression utility
Often tar archives are compressed

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
THE BASH SHELL
"Bourne Again Shell"
Backward-compatible with Bourne shell (sh) - the original (standard) UNIX
shell.
Bourne Shell (sh) - Original UNIX shell written by Steven Bourne at AT&T
Bash shell Implements many of the extra features found in csh, ksh, and tcsh
 Command line completion
 Command line editing
 Command line history

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
COMMAND LINE SHORTCUTS
File Globing, wildcard expansion
 * - matches zero or more characters
 ? - matches any single character
 [a-z] - matches a range of characters
 [^a-z] - matches all except the range
The Tab Key, <TAB> to complete command lines:
 For the command name, it will complete a command name
 For an argument, it will complete a file name
History, $history
 bash stores a history of commands you've entered, which can be used to
repeat commands
 Use history command to see list of "remembered" commands

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
COMMAND LINE EXPANSION
Tilde ( ~ ) : It may refer to your home directory
 cat ~/.bashrc
It may also refer to another user's home directory
 $ ls ~jkumar/projects.doc
Variable and String
Parameter/Variable: ( $ )
Substitute the value of a variable in a command line
 $ cd $HOME/projects.doc
Curly braces: { } - A string is created for every pattern inside the braces
regardless if any file exists
 $ rm hello.{c,o}
Command Output - ``
 Substitute output from a command in a command line
 $ echo “Current Working Directory is: `pwd`"

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
PROTECTING FROM EXPANSION
Backslash ( \ ) is the escape character and makes the next character literal
 $ echo Your cost: \$5.00
Quote prevents expansion
Single quotes (') inhibit all expansion
Double quotes (") inhibit all expansion, except:
 $ (dollar sign) including $() and $[], variable expansion
 ` (backquotes), command substitution
 \ (backslash), single character inhibition
 ! (exclamation point), history substitution

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
HISTORY TRICKS
Use the up and down arrow keys to scroll through previous commands
Type <CTRL-R> to search for a command in command history.
 (reverse-i-search)`':
To recall last argument from previous command:
 <ESC>. (the escape key followed by a period)
 <ALT-.> (hold down the alt key while pressing the period)

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
VARIABLES & ALIASES
A variable is a label that has a value
Variables are used to configure the shell or other programs
Variables are resident in memory
There are two types of variables: local and environment
Local variables are used only by the shell
Environment variables are passed onto other commands
set to display all variables
env to display environment variables

Aliases let you create shortcuts to commands


 alias dir='ls -laF'
Use alias by itself to see all set aliases
Use alias followed by an alias name to see alias value

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.
THANK YOU !

COPYRIGHT © 2007. CYBAGE SOFTWARE PVT. LTD. ALL RIGHTS RESERVED. CYBAGE

CONFIDENTIAL.

You might also like