View
2.317
Download
0
Category
Tags:
Preview:
Citation preview
Open Technology Centre, Chennai 1
LINUX TRAINING
Open Technology Centre,
National Informatics Centre,DIT, MCIT, Govt of INDIA,
E-3-A, Rajaji Bhavan, Besant Nagar, Chennai-600090.
Open Technology Centre, Chennai 2
Operating Systems
OPERATING SYSTEM DESIGN
• A program that acts as an intermediary between a user of a computer and the computer hardware.
• Operating systems provide an environment in which a user can execute programs.
• A program that controls the execution of application programs.
Open Technology Centre, Chennai 3
OPERATING SYSTEMS SERVICES
● File Mangement● I/O Management● Memory Management● Device Management● Resource Management● CPU Management● Hardware Management
Open Technology Centre, Chennai 4
Operating Systems Evolutions
OPERATING SYSTEM DESIGN
DOS
OS/2
OPERATING SYSTEMS
MICROSOFT WINDOWS
MAC
LINUX
SOLARIS
Open Technology Centre, Chennai 5
Operating Systems View
OPERATING SYSTEM DESIGN
OPERATINGSYSTEM DESIGN
DETAILED OPERATINGSYSTEM DESIGN
LINUX OPERATINGSYSTEM DESIGN
Open Technology Centre, Chennai 6
LINUX vs Windows
Particular Linux Windows
Software Cost Free /Low Costly
Easy Easy Easier
Reliability Required further improvement
Sofware Tools Less Numbers but freely More but Cost
Few Many
Security Very few attacks
Open Source Yes No
Support Less Compare to windows Better Support
More Reliable than Windows
Hardware driver and user Interfaces
More vulnerable to viruses/attacks
Open Technology Centre, Chennai 7
LINUX ORIGIN
• Linux is a “free” Unix-type operating system originally created by “Linus Torvalds” with the assistance of developers around the world.
• August 25 1991 “Linus” conceives the idea of Linux and announces the project.
Open Technology Centre, Chennai 8
INTRODUCTION TO LINUX
• Open Source.• Modular Fashion.• Strong Security.• Structured File Systems.• Multi-User, Multi-Tasking Operating System.
Open Technology Centre, Chennai 9
Why LINUX?
Linux, is a free, UNIX-like operating system.
Works on any kind of Hardwares ( PC/Workstations /Embedded Systems/Mainframe).
Comes with complete development environment includes compilers, toolkits, scripting Languages.
Linux provides rich Graphical User Interface (GUI) Support.
Strong Security Nature – iptables, file permissions, ownership's.
Open Technology Centre, Chennai 10
LINUX FLAVOURS
Open Technology Centre, Chennai 11
Type of Distribution – Community Edition
Open Technology Centre, Chennai 12
Type of Distribution – Commerical Edition
Open Technology Centre, Chennai 13
LINUX INSTALLATION
• Multiple Operating system
• Multiple Partitions within an operating system
• Different file system types
Open Technology Centre, Chennai 14
LINUX BOOT SEQUENCES
System Startup
Stage 1 Boot Loader
Stage 2 Boot Loader
Kernel
Init
Master Boot Record
BIOS
LILO, GRUB
User - Space
Linux
Open Technology Centre, Chennai 15
LINUX BOOT SEQUENCES - Run Levels
● A runlevel is a software configuration of the system that allows only a selected group of processes to exist.
● Init can run the system in one of six runlevels.0 - halt1 - Single user mode2 - Multiuser, without NFS (The same
as 3, if you don't have networking)3 - Full multiuser mode4 - unused5 - X116 - Reboot
Open Technology Centre, Chennai 16
LINUX APPLICATION PACKAGESServer
• Database Server – PostgreSQL• Web Server – Apache, Apache Tomcat• Mail Server – Cyrus• Proxy Server – Squid• Firewall – iptables• NTP Server – ntp• DHCP Server - dhcp• N/W information service - NIS• N/W File System - NFS• Windows File Share - Samba• Remote Connection - openSSH Server
Open Technology Centre, Chennai 17
LINUX APPLICATION PACKAGES
Desktop
● Office Software – OpenOffice, koffice● Graphics - Gimp/CAD Programmes (QCAD)● Internet Browser – Mozilla, Konqueror● Emulation / Virtual Terminal – SSH● Development – C, C++, Perl , Python & gcc● Editor – Emacs, Vi / Vim● Sound & Video – VLC, Brasero Dics Burner● Mail Client – Evolution● Chat – Empathy
Open Technology Centre, Chennai 18
LINUX FILE STRUCTURE
• In the Linux operating system, all filesystems are contained within one directory hierarchy.
• The root directory is the top level directory, and all its subdirectories make up the directory hierarchy.
• This differs to other operating systems such as MS-Windows.
• All directories are grouped under the root entry "/".
Open Technology Centre, Chennai 19
LINUX FILE STRUCTURE
Open Technology Centre, Chennai 20
LINUX FILE STRUCTURE...
root - The home directory for the root user
home - Contains the user's home directories
bin - Commands needed during bootup
sbin - Like bin but not for normal users.
proc - Is a virtual filesystem that exists in the kernels imagination which is memory.
Open Technology Centre, Chennai 21
LINUX FILE STRUCTURE...
usr - Contains all commands, libraries, pages and static files.
lib - Unchanging data files for programs and subsystems.
local - The place for locally installed software and other files.
mnt - Allows to mount the external partion.
Open Technology Centre, Chennai 22
LINUX FILE STRUCTURE...
boot - Files used by the bootstrap loader, LILO Kernel images are often kept here.
var - Files in /var are dynamic and are constantly being written to or changed.
etc - Configuration files specific to the machine.
dev - Contains device files for interfacing with hardware. Either block or character devices.
Open Technology Centre, Chennai 23
LINUX CONFIGURATION FILES
/etc/crontab - Lists commands and times to run them for the cron deamon.
/etc/exports - Exporting file systems using NFS service.
/etc/fstab - Lists ther file systems mounted at boot time Automatically.
/etc/group - Contains basic group attributes for system Groups.
/etc/hosts.conf - Specifies the hostnames are resolved.
Open Technology Centre, Chennai 24
LINUX CONFIGURATION FILES...
/etc/hosts - lists hosts for name lookup that are locally Required.
/etc/inittab - Configuration file for init, controls startup run Levels, determines scripts to start with.
/etc/passwd - The users database contains username, encrypted password, user default shell.users home directory.
/etc/profile - Contains the files that are executed at startup time.
Open Technology Centre, Chennai 25
LINUX CONFIGURATION FILES...
/etc/shells - shells file contains a list of '' login shells '' on the system.
/proc/devices - file displays the various character and block devices currently configured.
/var/log/lastlog - Tells about the last login time on the System.
/var/log - Contains system log files.
Open Technology Centre, Chennai 26
LINUX CONFIGURATION FILES...
/etc/rc.d/rc0.d - Contains the file that are used to control at run level 0.
/etc/rc.d/rc1.d - Contains the file that are used to control at run level 1.
/etc/rc.d/rc2.d - Contains the file that are used to control at run level 2.
/etc/rc.d/rc3.d - Contains the file that are used to control at run level 3.
/etc/rc.d/rc4.d - Contains the file that are used to control at run level 4.
/etc/rc.d/rc5.d - Contains the file that are used to control at run level 5.
/etc/rc.d/rc6.d - Contains the file that are used to control at run level 6.
Open Technology Centre, Chennai 27
LINUX KERNEL
Kernel - “ heart of the operating system ”
The kernel image isn't so much an executable kernel, but a compressed kernel image.
A routine that does some minimal amount of hardware setup and then decompresses the kernel contained within the kernel image and places it into high memory.
Open Technology Centre, Chennai 28
SHELLS IN LINUXA shell is a program that provides the traditional, text-only user interface for Linux and other Unix-like operating systems. Its primary function is to read commands that are typed into a console.
Types of shells: * Bourne shell (sh) - /bin/sh * C shell (csh) - /bin/csh * TC shell (tcsh) - /bin/tcsh * Korn shell (ksh) - /bin/ksh * Bourne Again SHell (bash)- /bin/bash
Open Technology Centre, Chennai 29
Working in the File System
• Viewing the file system• Creating files and Directories• Removing files and Directories• Linking Files• Change Directory• List of Files• Copy or Move files and Directories• Clear Shell Commands• Kernel version• Exit, Shutdown & Reboot
Open Technology Centre, Chennai 30
Viewing File system...(1)
tail - Output the last part of files, print the last part (10 lines by default) of each FILE.
Example1. tail /var/log/syslogDisplay the last 10 lines of the file called syslog.
2. tail -f /var/log/syslog-f - output appended data as the file grows.
Open Technology Centre, Chennai 31
Viewing File system...(2)
less - lets an admin scroll through configuration and error log files, displaying text files.
Ex: 1. less /html/index.html
more - Paginates the specified file so it can be read line by line (using Enter key).Use b key to move back and q to quit.
Ex: 2. more /home/html/index.html
Open Technology Centre, Chennai 32
Viewing File system...(3)
cat is to read and redirect the output to another file.
Ex: cat /etc/hosts – Prints specified file to the screen.
Ex: cat file.a > file.b - cat is redirected using the output
redirection operator.
Open Technology Centre, Chennai 33
Creating File and Directories (1)
touch - create a simple empty fileEx : touch file-name
touch test.txt
vim - using vim editor create a fileEx : vim test.txt
creates a empty txt file in the name of test
Open Technology Centre, Chennai 34
Creating Files and Directories (2)
mkdir - Create one or more directories.
Ex: 1. mkdir personal
Create a directory named personal
Ex: 2. mkdir -p work/junk/questions
Create intervening parent directories if they don't
exist
Open Technology Centre, Chennai 35
Removing Files and Directory (1)
rm – Allows the user to remove one or more files and and directories.
Ex: (1) rm /home/index.html – Delete the File index.html
(2) rm -rf /home/test/Desktop/testing - Delete the file or directory force-fully
Note: -rf cause unrecoverable deletion, If file is a directory, remove the entire directory and all its contents, including subdirectories.
Open Technology Centre, Chennai 36
Linking Files
ln – used to make link between existing files.
Ex: ln -s /home/otc/Desktop/test /mnt/
Open Technology Centre, Chennai 37
Change Directory
Change the current working directory to dirName.
Ex: cd /path/to/the/directory
cd personal – change the directory into personal.cd .. - Back to the previous directorycd - switch to the previous previous directory
Open Technology Centre, Chennai 38
ls - list
ls List information about the FILEs (the current directory by default). Sort entries alphabetically.
Ex : 1. ls - List the contents of a directory.
2. ls -ld - Check the Permissions of the directory.
3. ls -al - List the hidden contents of a directory.
Open Technology Centre, Chennai 39
cp - copy & mv - move
cp copies files from one location to another within system
Ex: (1) cp /home/test/Desktop/test.txt /opt/test.txt.orgi
mv
Commands for moving files are fairly straightforward. To change the location of a file, use the mv command.
Ex: (1) mv /home/test/Desktop/documents.odt /data1
Open Technology Centre, Chennai 40
alias
alias
Create an alias, aliases allow a string to be substituted for a word when it is used as the first word of a simple command.
SYNTAX: alias [-p] [name[=value] ...] unalias [-a] [name ... ]
Ex : 1. alias ls = 'ls -F' - Now issuing the command 'ls' will actually run 'ls -F'
Open Technology Centre, Chennai 41
Kernel version
unameThis command is helpful when working on different computers which may not be in synch at the OS level. Also, you can print information about those systems.
Ex: 1. uname -a- This will print to the screen the Linux Kernel in
use on your system.
Open Technology Centre, Chennai 42
Clear Shell Commands
clear
Clears your screen if this is possible. It looks in the environment for the terminal type and then in the terminfo database to figure out how to clear the screen.
Ex: (1) clear
Open Technology Centre, Chennai 43
Reboot, Poweroff, Shutdown
reboot/halt/poweroff/shutdown
halt or reboot is called when the system is not in runlevel 0 or 6.
Ex: (1) reboot or init 6 – Reboot the system (2) poweroff – poweroff the system (3) shutdown -r 5• - Shutdown the system in 5 minutes and
reboot.
Open Technology Centre, Chennai 44
Exit and Logout
exit● The exit causes normal program terminate.
logout● Exit a login shell.● A login shell, is your topmost shell, and is started
when you log in. ● Terminate a login shell allow to logged out.
Open Technology Centre, Chennai 45
LINUX GUI
● Gnome● KDE
Open Technology Centre, Chennai 46
LINUX GUI
Gnome – GNU Network Object Model Environment
The GNOME is a desktop environment, a graphical user interface that runs on top of a computer operating system.
The GNOME desktop environment, an intuitive and attractive desktop for users, and the GNOME development platform, an extensive framework for building applications that integrate into the rest of the desktop.
Open Technology Centre, Chennai 47
LINUX GUI - GNOME
Open Technology Centre, Chennai 48
LINUX GUI
KDE
KDE is the easier Linux GUI for users with Windows background.
It is best known for its Plasma Desktop, a desktop environment provided as the default working environment on many Linux distributions, such as openSUSE, Mandriva Linux and Kubuntu.
Open Technology Centre, Chennai 49
LINUX GUI - KDE
Open Technology Centre, Chennai 50
ADVANTAGE OF LINUX GUI
● It provides user friendly to the novice user.● It invokes multi-GUI environment in Remote.● GUI allows to take full advantages of multi-
tasking.● We can do all the CLI operations in GUI mode.● Users are free to choose amoung many of GUI's
such as GNOME, KDE.● More Customizable.● Any Problem in GUI, we can Kill GUI & Restart
GUI service.
Open Technology Centre, Chennai 51
Managing File Permissions
● Setting File Permissions● Setting File Ownership
Open Technology Centre, Chennai 52
File Permission (1)
In linux user can set file permissions, they are read, write and execute.
If the command ls -l is given, a long list of file names is displayed.
The first column in this list details the permissions applying to the file.
If a permission is missing for a owner, group of other, it is represented by ex: drwxr-x—x
Open Technology Centre, Chennai 53
File Permission (2)
Read = 4 Write = 2Execute = 1
Open Technology Centre, Chennai 54
File Permission (3)
chmod changes the permissions of each given file according to MODE.
User (rwx) = 4+2+1 = 7Group(rx) = 4+1 = 5World (rx) = 4+1 = 5
chmod mode = 755
Open Technology Centre, Chennai 55
File Permission (4)
Ex: (1) chmod 444 filename - Allow read permission to everyone.
(2) chmod 066 filename - Make a file rw by the group and others.
(3) chmod 777 filename - Allow everyone to rwx the file.
Open Technology Centre, Chennai 56
Setting File Ownership (1)
Change file owner and/or group. `chown' changes the user and/or group ownership of each given File to NewOwner or to the user and group of an existing reference file.
Ex: 1. chown [owner] : [groups] target_file_name 2. chown otc:otc /data1/index.html
3. u – user/owner, g – group/owner, o– all other r – read, w – write, x – execute a - for all; user/owner,group and all other
Open Technology Centre, Chennai 57
Setting File Ownership (1)
Ex: (3) To change the owner's permissions of a files or directory
chown u+r file.1 chown u+w file.1 chown u+x file.1
chown u-r file.1 chown u-w file.1 chown u-x file.1
Ex: (4) To change the group's permissions of a files or directory
chown g+r file.1 chown g+w file.1 chown g+x file.1
chown g-r file.1 chown g-w file.1 chown g-x file.1
Ex: (5) To change the permissions of a files or directory for everyone.
chown o+r file.1 chown o+w file.1 chown o+x file.1
chown o-r file.1 chown o-w file.1 chown o-x file.1
Open Technology Centre, Chennai 58
User Administration
● Create user● Delete user● Create Group● Delete Group● Password● Root login
Open Technology Centre, Chennai 59
User Administration (1)
useradd Allows to create new user accounts Ex: (1) useradd test
passwd change the password to the particular user. Ex: (1) passwd username
Open Technology Centre, Chennai 60
User Administration (2)
groupadd Allows the user to create new group using the values specified on the command line.
Ex: (1) groupadd user-name-to-add groupadd otc
Open Technology Centre, Chennai 61
User Administration (3)
userdelDelete a user account and realted filesEx: userdel user-name
groupdelDelete a group modifies the system filesEx: groupdel group-name
Open Technology Centre, Chennai 62
User Administration (4)
passwd - passwd is a text file, that contains a list of the system's accounts.
Often, it also contains the encrypted passwords for each account.
Example: passwd username
Enter new UNIX password: ********Confirm new UNIX password: ********
Open Technology Centre, Chennai 63
User Administration (5)
sudo or su -sudo (superuser do) allows a system administrator to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while logging the commands and arguments.
Ex: 1. sudo -i #Enter the Password - It's use for debian and Ubuntu based linux.
2. su - #Enter the Password - It's use for Redhat, suse, mandriva based
linux.
Open Technology Centre, Chennai 64
File System Management in Linux
● Viewing Mounted Filesystem● Viewing Diskspace Usage● Viewing Space by Files● Viewing Partitions● Finding Files
Open Technology Centre, Chennai 65
Viewing Mounted Filesystem (1)
mount● Used to view and mount the intend filesystem● Instruct the kernel to attach the filesystem● Mount allowed to access all devices, partitions,
CD-ROMs and other storage devices as files.
Ex: (1) mount /dev/sda7 /mnt//dev/sda7 – source-directory (hard-disk partition)/mnt – destination-directory or mount point
Ex: (2) mount -a – Display Mount all filesystems.Ex: (3) mount -t ext3 /dev/sda6 /diskS
Open Technology Centre, Chennai 66
Viewing Mounted Filesystem (2)
umountreverse process of mounting, i.e unmount the partition.
Ex: (1) umount /mnt /mnt – is the place where mount previously.
Open Technology Centre, Chennai 67
Filesystem Disk Space Usage
df - Disk Free
● Viewing Filesystem usage● Viewing Available disk space.
Ex: df -h -h - print sizes in human readable format
(e.g., 1K, 234M, 2G)
Open Technology Centre, Chennai 68
Viewing Diskspace by Files
du – Disk Usage
du (i.e., disk usage) command reports the sizes of directory trees inclusive of all of their contents and the sizes of individual files.
Ex: (1) du /sbin/file1 (2) du -h /home
Open Technology Centre, Chennai 69
Viewing Partition Table (1)
fdisk – Format Disk ● Menu driven approach● Creating & manipulate partition tables.● Partitions are mentioned like /dev/sda
Ex: (1) fdisk -ls List the partition tables for the specified devices and Size.
Open Technology Centre, Chennai 70
Viewing Partition Table (2)
cfdisk cfdisk is a curses/slang based program for partitioning any hard disk drive.
Typical values of the device argument are
Ex: (1) cfdisk /dev/sda
Open Technology Centre, Chennai 71
Finding Files
grep (Grand Regular Expression) The grep command searches one or more input files for lines containing a match to a specified pattern.
Ex: (1) cat /etc/passwd | grep dsoThis searches for pattern specified. In this case all instances of dso from the /etc/passwd file are printed.
Open Technology Centre, Chennai 72
Finding Files (1)
grep -i “Sample” /home/dsoneil The -i option makes the search in different to case (e.g.sample or SAMPLE)
Open Technology Centre, Chennai 73
Finding Files (2)
find ● Used to locate files on a Unix or Linux system.● Search any set of directories you specify for files
that match the supplied search criteria.
Ex: (1) find / -name log -print - find the file log in the wholo system and
prints it.
Open Technology Centre, Chennai 74
who
who Show who is logged into the system. With no options, list the names of users currently logged in, their terminal, the time they have been logged in, and the name of the host from which they have logged in. An optional system file (default is /etc/utmp) can be supplied to give additional information.
Ex : 1. who -uH
Open Technology Centre, Chennai 75
which
which which takes one or more arguments. For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt.
Ex: 1. which -a filename
- This will search through all directories in your current path and find all files named filename
Open Technology Centre, Chennai 76
Finding Files (3)
locate Locate lists files in a database that match a pattern
Ex: (1) locate wordperfectThe locate command will locate the file specified and output a directory path.
Open Technology Centre, Chennai 77
Process Management in Linux
● Viewing Running Services and Runlevel● Viewing Running Process● Killing a Running Process
Open Technology Centre, Chennai 78
Viewing Running Process (1)
topProvides an outgoing look at processor activity and update dynamically.
Listing of the process based on ● CPU usage● Memory usage● Runtime.Can monitor process belongs to the specific process id.
Open Technology Centre, Chennai 79
Viewing Running Process (2)
Ex:(1) top -p process-id
• Provides the information about process whose pid is as input.
Open Technology Centre, Chennai 80
Viewing Running Process (3)
ps● Enumerates the currently running processes.● Process are identified by its id (pid).● List the Process with its id, state, usage too.
Ex: (1) ps au a – lists all process u – select by effective user-id
Open Technology Centre, Chennai 81
Viewing Running Process (4)
We can combine ps with grep to find a process by name.
Ex: (1) ps aux | grep soffice
● Lists the process whose name is soffice.● List the Process with its id, state, usage too.
Open Technology Centre, Chennai 82
Kill a Running Process (1)
● ps is most often used to obtain the PID.● using pid kill/terminate a unintended process.● if the PID of a program is found to be 1125● combine ps with grep to find a process by name.
Ex: kill process-id (1) Kill -9 1125
Open Technology Centre, Chennai 83
Network Management in Linux
● Viewing Networking Configurations● Viewing Routing Tables● Viewing Network Services and Ports
Open Technology Centre, Chennai 84
Introduction to Networking
Network commands useful when networking with other computers.
Within the network and across the internet, obtaining more information about other computers.
Open Technology Centre, Chennai 85
Basic Networking Commands
➔ ifconfig➔ ping➔ telnet➔ dig➔ nslookup➔ traceroute➔ hostname
Open Technology Centre, Chennai 86
Viewing Network Configurations (1)
ifconfig - used to configure and view network configurations.
Ex: (1) ifconfig -a - shows the network interface about the machine.
Open Technology Centre, Chennai 87
Viewing Network Connections (2)
ping Sends an ICMP ECHO_REQUEST packet to the specified host. If the host responds, you get an ICMP packet back.
Ex: (1) ping xxx.xxx.xxx.xxx (xx - ip address or hostname)
Open Technology Centre, Chennai 88
Viewing Network Connections (2)
telnet - ability to remotely log in and work on another computer.
Ex: telnet ip_number port_number
(1) telnet 10.163.14.58 21also tell whether the port is opened or not.
Open Technology Centre, Chennai 89
Viewing Network Connections (3)
dig Is a DNS lookup utility used to perform DNS lookup and return the output from the internet servers.
Ex: dig www.gmail.com
Open Technology Centre, Chennai 90
Viewing Route Informations (1)
route Show and manipulate the routing tables. It manipulates the IP routing table and set up the routing to the specific hosts in the network.
Allows the user to modify the routing table manually using add or del options.
Open Technology Centre, Chennai 91
Viewing Route Informations (2)
netstat ● Output the network statistics includes routing
table tables, interface statistics.● Print the list of open ports
Ex: (1) netstat -pant
- Will display the currently opened ports in the system.
Open Technology Centre, Chennai 92
Viewing Route Informations (3)
traceroute - network diagnostic tool.
traceroute displays each host that a packet travels through as it tries to reach its destination.
Ex: (1) traceroute www.google.co.in
- Shows each host will be displayed, along with the response times at each host.
Open Technology Centre, Chennai 93
Viewing Route Informations (4)
nslookup Query the internet domain name servers for getting about the various hosts in the network.
Ex: nslookup domain name (1) nslookup mail.nic.in
Open Technology Centre, Chennai 94
Shell and Remote Copy
● Secure Shell (ssh)● Secure Copy● rsync
Open Technology Centre, Chennai 95
Secure Shell
ssh● Allows logging into remote machine● Provides secure encrypted communications● Must need an identity
Ex: ssh username@ip-address (1) ssh otc@10.163.14.100
Open Technology Centre, Chennai 96
Secure Copy
scp
● scp copies files between hosts on a network. ● use ssh for data transfer● provides security as ssh. ● scp will ask for passwords for authentication.
Ex: (1) scp -r /data1 root@10.163.14.58:/home/otc/Desktop
Open Technology Centre, Chennai 97
rsync
● rsync is focused on synching data from one disk location to another.
● rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network link.
Ex: (1) rsync -avz root@10.163.14.57:/data /data/tmp
Open Technology Centre, Chennai 98
File Archiving in Linux
● File archiving● Creating Compressed Files
Open Technology Centre, Chennai 99
File Archiving (1)
tar The tar (tape archive) command bundles a bunch of files together and creates an archive.
Ex: (1) tar -cvf archives.tar archives/–c - Create a tar file–v - Verbose Mode–f - File Name
Open Technology Centre, Chennai 100
File Archiving (2)
Ex: (2) tar -tvf archives.tar To view files in tar file.
Ex: (3) tar -xvf archives.tar x – Extract the tar contents.
Ex: (4) tar -rvf archives.tar testing.txt r – Append files to existing tar file.
Open Technology Centre, Chennai 101
File Archiving (3)
dd ● whose primary purpose is the low-level copying.
● It can also be used in computer forensics.
● Can snapchot magnetic pattern of an entire disk needs to be preserved as a byte-exact copy.
Open Technology Centre, Chennai 102
File Archiving (4)
Hard Disk Clone
dd if=/dev/sda of=/dev/sdb'' of '' is the distination and ''if '' is the source.
Partition Clone
dd if=/dev/sda1 of=~/disk2.imgBacking up a hard disk partition is much similar to backing up a whole hard disk.
Open Technology Centre, Chennai 103
File Archiving (5)
Restoring from an Image File
To restore a partition or a hard disk from an image file, just exchange the arguments "if" and "of"
For example, restore the whole hard disk from the image file "disk1.img"
Ex (1): dd if=disk2.img of=/dev/sda
Open Technology Centre, Chennai 104
zipzip
The zip program puts one or more compressed files into a single zip archive, along with information about the files (name, path, date, time of last modification, protection, and check information to verify file integrity). An entire directory structure can be packed into a zip archive with a single command. Compression ratios of 2:1 to 3:1 are common for text files. .
Ex: (1) zip -r foo foo.zip
Open Technology Centre, Chennai 105
unzip
unzip
Unzip is to extract into the current directory (and subdirectories below it) all files from the specified ZIP archive.
Ex: (1) unzip foo.zip foo
Open Technology Centre, Chennai 106
Misc
● Debugging● Time Management Command● Reboot, Poweroff, Shutdown● Shells● Printing● Man ● Package Installation
Open Technology Centre, Chennai 107
Debugging (1)
dmesg
● Display the system control messages from the kernel ring buffer.
● This buffer stores all messages since the last system boot, or the most recent ones
Ex: (1) dmesg
Open Technology Centre, Chennai 108
Time Management
● hwclock - Set or read the hardware CMOS Clock.● uptime - reports how long the system is running● clock - used to set or get current time.● tset - used to set the users private time Zone.● w – Lists users currently logged into the system.
Open Technology Centre, Chennai 109
Printing System
● CUPS - Common UNIX Printing System
● CUPS is a open source printing system developed by Apple Inc.
● CUPS is the software use to print from applications.
Open Technology Centre, Chennai 110
Printing System (1)
● Access the Web Interface for Printing.
● CUPS provides a web interface, that allows you to view print jobs, printers, and the online help, as well as manage your printers.
● The CUPS web interface is available on your machine at the following URL:
● http://localhost:631
Open Technology Centre, Chennai 111
Printing System (2)
lpr submits files for printing, If no files are listed on the command-line, lpr reads the print file from the standard input.
Ex: (1) lpr /home/html/index.html– This command will print the file index.html to the printer.
(2) lprm 12– This command will cancel pint job 12 in the printer queue.
(3) lpq– Show the contents of the print queue.
Open Technology Centre, Chennai 112
man
man is the system’s manual pager. Each page argument given to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided, will direct man to look only in that section of the manual. The default action is to search in all of the available sections, following a pre-defined order and to show only the first page found, even if page exists in several sections.
Open Technology Centre, Chennai 113
PACKAGE INSTALLATION
Install packages from source
The installation procedure for software that comes in tar.gz and tar.bz2 packages isn't always the same, but usually it's like this:
# tar xvzf package-name.tar.gz # cd package-name# ./configure# make# make install
Open Technology Centre, Chennai 114
PACKAGE INSTALLATION (2)
Install package from ubuntu repository
# sudo apt-get update - update ubuntu repository# sudo apt-get install <Package Name># sudo apt-get install apache2 - Install apache webserver from repository
Open Technology Centre, Chennai 115
PACKAGE INSTALLATION (3)
Remove Package
# sudo apt-get remove apache2 - remove packages from system
# sudo apt-get remove --purge apache - remove packages with configuration files.
Open Technology Centre, Chennai 116
Server
● Apache Webserver● PostgreSQL● OpenSSH Server● DHCP Server● FTP Server
Open Technology Centre, Chennai 117
APACHE SERVER
● Web server● Fully open source ● Developed by Apache Software Foundation● Directives that control the configuration of Apache.● Secure Sockets Layer.
Open Technology Centre, Chennai 118
POSTGRESQL SERVER
PostgreSQL is a powerful, open source relational database system.
It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGIIRIX, Mac OS X, Solaris, Tru64), and Windows.
PostgreSQL boasts sophisticated features such as Multi-Version Concurrency Control (MVCC), point in time recovery, tablespaces, asynchronous replication, nested transactions (savepoints).
Packages for PostgreSQL come with many Linux distributions, and it can be compiled and installed on almost all varieties of Unix.
Open Technology Centre, Chennai 119
POSTGRESQL SERVER
PostgreSQL consists of a server process that reads and writes the actual database files, and a set of client programs that communicate with the server.
All of the PostgreSQL database files are stored under a directory such as /var/lib/pgsql or /usr/local/pgsql.
The most important is pg_hba.conf, which lists client hosts that are allowed to connect to the server.
This module allows an administration to manage databases, tables, fields and records in a PostgreSQL server.
Open Technology Centre, Chennai 120
OpenSSH Server
Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices.
Ex: 1. ssh user@host
2. ssh -p user@host – connect to host on port as user. 3. ssh-copy-id user@host – add your key to host for user to enable a keyed or passwordless login.
Open Technology Centre, Chennai 121
DHCP SERVER
● DHCP - Dynamic Host Configuration Protocol.
● Provides advanced IP address allocation and management for TCP/IP LAN computing environments.
● This protocol saves the system administrator much time having to manually configure each host workstation manually, and to maintain large databases storing IP assignment details.
Open Technology Centre, Chennai 122
FTP SERVER
● FTP (File Transfer Protocol) is the simplest and most secure way to exchange files over the Internet.
● The most common use for FTP is to download files from the Internet.
FTP Types:● Active● Passive● Asynchronous
Open Technology Centre, Chennai 123
Q/A SESSION
Open Technology Centre, Chennai 124
Thank you
Recommended