Monday, January 30, 2012

Unit 2 - Package Management

Objectives


Upon completion of this unit, you should be able to:

Install and remove RPM packages

Query packages and verify their state

Manage packages using yum

Understand the relationship between yum and rpm

Configure yum to connect to a RHN Satellite Server

Create a private yum repository

Configure yum to connect to a private repository

Configure and use Red Hat Network

Installing and Removing Software


Primary RPM options:

Install: rpm -i, --install

Upgrade: rpm -U, --upgrade

Freshen: rpm -F, --freshen

Erase: rpm -e, --erase

Output Options: -v, -h

Updating a Kernel RPM


Make sure to install kernel updates

Do not use rpm -U or rpm -F !

rpm -ivh kernel-version.arch.rpm

Boot new kernel to test

Revert to old kernel if a problem arises

rpm -e kernel-oldversion if no problems

rpm Queries


Syntax:

rpm -q what_packages what_information

Installed Package Options:

rpm -qa lists installed packages

rpm -qf filename shows owning package

rpm -qi package_name general information

rpm -ql package_name lists files in package

Uninstalled Package Options:

rpm -qip package_file.i386.rpm

rpm -qlp package_file.i686.rpm

rpm Verification


Installed RPM File Verification:

rpm -V

rpm -Vp .i386.rpm

rpm -Va

Signature verification BEFORE package install:

rpm --import RPM-GPG-KEY

rpm -K .i386.rpm

Using yum


Install/Remove/Update

yum install package...

yum remove package...

yum update [package...]

Searching packages/files


Searching packages

yum search searchterm

yum list (all|available|extras|installed|recent|updates)

yum info packagename

Searching files

yum whatprovides filename

Configuring Additional Repositories


Create a file in /etc/yum.repos.d for your repository

Required information

[repo-name]

name=A nice description

baseurl=http://yourserver.com/path/to/repo

enabled=1

gpgcheck=1


Creating a private repository


Create a directory to hold your packages

Make this directory available by http/ftp

Install the createrepo RPM

Run createrepo -v /package/directory

This will create a repodata subdirectory and the needed support files

Create a file in /etc/yum.repos.d/shishir.repo for your repository

Required information

[Shishir's Server-repo]

name=Shishir's OWN Linux Server

baseurl=file:///root/Server

enabled=1

gpgcheck=0

LINUX BOOT PROCESS

Steps of boot process


Step 1. BIOS ->Do POST ->power on self test and Check boot priority,
Step 2. MBR ->I stage boot loader,partition table, o/s signature
Step 3. /etc/grub/grub.conf ->root (hd0,0)
kernel /vmlinuz...... ro root=LABEL=/
initrd /initrd.....img
Step 4. /etc/inittab ->/etc/rc.d/rc.sysinit ->Set hostname
->Set clock
->Enable selinux,quota
->check filesystem
->Enable root in rw mode
Step 5. /etc/inittab ->runlevel ->/etc/rc.d/rcx.d (where x is num)
Step 6. /etc/rc.d/rc ->whenever runlevel changes
Step 7. /etc/rc.d/rc.local ->last script executed in boot process


GRUB FEATURES:

Step 1. Grand unified boot loader
Step 2. Grub indentifies upto 15 file systems
Step 3. Grub has a pre-os enviornment use commands to load o/s
Step 4. Grub supports LBA(Logical block addressing)

GRUB COMMANDS

Step 1. root (hd0,0) ->mount the boot partition
Step 2. find /etc/fstab ->find the partition which contains label of /
Step 3. cat (hd0,4)/etc/fstab -> TO check label of root
OR
Step 4. find /etc/fstab ->find the partition which contains label of /
Step 5. root (hd0,4) ->Mount the route partiton
Step 6. cat / + press tab ->shows contents of mounted partition
Step 7. cat /etc/fstab ->open the file to see file contents
Step 8. kernel /vmlinuz........ ro root=LABEL=/ ->Loads the kernel
Step 9. initrd /initrd...img ->provides initital ram disk
Step 10. boot -> Helps to boot the o/s


TO EXTRACT THE INITRD

Step 1. mkdir initrd
Step 2. cp /boot/initrd-2.6.18-53.el5.img initrd/
Step 3. cd initrd/
Step 4. ls
Step 5. file initrd-2.6.18-53.el5.img
Step 6. mv initrd-2.6.18-53.el5.img initrd.gz
Step 7. ls
Step 8. gunzip initrd.gz
Step 9. ls
Step 10.file initrd
Step 11.cpio -ivd < initrd TO SET GRUB PASSWORD Step 1.grub-md5-crypt ->generate the password
Step 2.vim /etc/grub.conf ->open file (write below line in this file)
password --md5 (write below hidden menu)
Step 3.reboot
Step 4.Try pressing e or c in grub prompt it wont let you unless you type p
and provide password


TO EXTRACT SPLASH IMAGE

Step 1. mkdir splash
Step 2. cp /boot/grub/splash.xpm.gz splash
Step 3. cd splash/
Step 4. ls
Step 5. gunzip splash.xpm.gz
Step 6. ls
Step 7. firefox splash.xpm


TO ADD MULTIPLE TEXT TERMINAL

Step 1. vim /etc/inittab
Step 2. 50:2345:respawn:/sbin/mingetty tty50 -->creates 50th terminal
Step 3. init q -->make changes to inittab
Step 4. chvt 50 -->change to 50th terminal
Note: To allow root to login also add entries to /etc/securetty.

TO MAKE SERVICE PERMANENT

Step 1. chkconfig --list |grep network
Step 2. chkconfig --list |grep sendmail
Step 3. chkconfig --list |grep cups
Step 4. chkconfig --list |grep vsftpd
Step 5. chkconfig vsftpd on
Step 6. chkconfig --list |grep vsftpd
Step 7. chkconfig --levels 35 vsftpd on
chkconfig --levels 35

Unit 1 System Initialization

Objectives


Upon completion of this unit, you should be able to:

Discuss the boot sequence

Understand GRUB's role

Understand init's role

Control System V services


Boot Sequence Overview


BIOS Initialization

Boot Loader

Kernel initialization

init starts and enters desired run level by executing:

/etc/rc.d/rc.sysinit

/etc/rc.d/rc and /etc/rc.d/rc?.d/

/etc/rc.d/rc.local



GRUB and grub.conf


GRUB “the GRand Unified Bootloader”

Command-line interface available at boot prompt

Boot from ext2/ext3, ReiserFS, JFS, FAT, minix, or FFS file systems

Supports MD5 password protection

/boot/grub/grub.conf

Changes to grub.conf take effect immediately

If MBR on /dev/hda is corrupted, reinstall the first stage bootloader with:

/sbin/grub-install /dev/hda

Kernel Initialization


Kernel boot time functions

Device detection

Device driver initialization

Mounts root filesystem read only

Loads initial process (init)

Kernel Initialization


Kernel boot time functions

Device detection

Device driver initialization

Mounts root filesystem read only

Loads initial process (init)

Run Levels


init defines run levels 0-6, S, emergency

The run level is selected by either

the default in /etc/inittab at boot

passing an argument from the boot loader

using the command init new_runlevel

Show current and previous run levels

/sbin/runlevel

/etc/rc.d/rc


Initializes the default run level per the /etc/inittab file initdefault line such as id:3:initdefault:

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3 (default)
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

RH133 - Red Hat Linux System Administration

Introduction
Understand system and service initialization
Integrate new filesystems

Understand advanced partitioning schemes

Perform filesystem management tasks

Set up networking

Perform user and group administration

Automate tasks with at, cron, and anacron

Set up core services: Logging, Printing, X Window system

Manage software packages with yum and rpm

Install the system interactively and with Kickstart

Perform basic troubleshooting

Friday, January 27, 2012

Unit 11 Network Clients

Objectives


Upon completion of this unit, you should be able to:

Browse the web

Exchange email and instant messages

Access a Linux system remotely

Transfer files between systems

Use network diagnostic tools


Web Clients


Firefox

Other web browsers

Non-GUI web browsers

wget

wget


Retrieves files via HTTP and FTP

Non-interactive - useful in shell scripts

Can follow links and traverse directory trees on the remote server - useful for mirroring web and FTP sites

Evolution


Default email and groupware tool

Provides email, calendar, tasks and contacts

Can maintain multiple accounts at once

Supports GnuPG encryption and signatures

"Trainable" bayesian spam filters

Task/Calendar notifications in Gnome clock

Can sync with many PDAs

Configuring Evolution


Defining accounts

Tools->Settings->Mail Accounts

Supports IMAP, pop, Novell Groupware, Usenet and local email accounts

MS Exchange support via plug-in

Provided by evolution-connector rpm

Install before configuring other accounts

Other GUI Mail Clients


Thunderbird

Standalone Mozilla email client

Kmail

KDE email client

Non-GUI Mail Clients


mutt

Supports pop, imap and local mailboxes

Highly configurable

Mappable hotkeys

Message threading and colorizing

GnuPG integration

OpenSSH: Secure Remote Shell


Secure replacement for older remote-access tools

Allows authenticated, encrypted access to remote systems

ssh [user@]hostname

ssh [user@]hostname command

scp: Secure File Transfer


Secure replacement for rcp

Layered on top of ssh

scp source destination

Remote files can be specified using:

[user@]host:/path/to/file

Use -r to enable recursion

Use -p to preserve times and permissions

Use -C to compress datastream

rsync: Efficient File Sync


Efficiently copies files to or from remote systems

Uses secure ssh connections for transport

rsync *.conf barney:/home/joe/configs/

Faster than scp - copies differences in like files

OpenSSH Key-based Authentication


Optional, password-less, but still secure, authentication

Uses two keys generated by ssh-keygen:

private key stays on your system

Usually passphrase-protected (recommended)

public key is copied to destination with ssh-copy-id

ssh-copy-id [user@]host

OpenSSH Key-based Authentication
continued


An authentication agent stores decrypted private keys

Thus, passphrase only needs to be entered once

An agent is provided automatically in GNOME

Otherwise, run ssh-agent bash

Keys are added to the agent with ssh-add

FTP Clients


CLI: lftp

$ lftp ftp.example.com

$ lftp -u joe ftp.example.com

Automated transfers with lftpget

GUI: gFTP

Applications->Internet->gFTP

Allows Drag-and-Drop transfers

Anonymous or authenticated access

Optional secure transfer via ssh (sftp)

smbclient


FTP-like client to access SMB/CIFS resources

Examples:

smbclient -L server1 lists shares on server1

smbclient -U student //server1/homes accesses a share


Network Diagnostic Tools


ping

traceroute

host

dig

netstat

gnome-nettool (GUI)

Unit 10 Basic System Configuration Tools

Objectives


Upon completion of this unit, you should be able to:

Configure date, network and printer settings

Send text to the printer

Set the system's date and time

TCP/IP Network Configuration


Important network settings:

IP Configuration

Device Activation

DNS Configuration

Default Gateway

Managing Ethernet Connections


Network interfaces are named sequentially: eth0, eth1, etc

Multiple addresses can be assigned to a device with aliases

Aliases are labeled eth0:1, eth0:2, etc.

Aliases are treated like separate interfaces

View interface configuration with ifconfig [ethX]

Enable interface with ifup ethX

Disable interface with ifdown ethX

Graphical Network Configuration
system-config-network


System->Administration->Network

Activate/Deactivate interfaces

Assign IP Addresses/DHCP

Modify DNS settings

Modify gateway address


Network Configuration Files
Ethernet Devices


Device configuration is stored in text files

/etc/sysconfig/network-scripts/ifcfg-ethX

Complete list of options in /usr/share/doc/initscripts-*/sysconfig.txt

Dynamic Configuration

DEVICE=ethX
HWADDR=0:02:8A:A6:30:45
BOOTPROTO=dhcp
ONBOOT=yes
Type=Ethernet

Static Configuration

DEVICE=ethX
HWADDR=0:02:8A:A6:30:45
IPADDR=192.168.0.254
NETMASK=255.255.255.0
GATEWAY=192.168.2.254
ONBOOT=yes
Type=Ethernet

Network Configuration Files
Other Global Network Settings


Global Settings in /etc/sysconfig/network

Many may be provided by DHCP

GATEWAY can be overridden in ifcfg file

NETWORKING=yes
HOSTNAME=server1.example.com
GATEWAY=192.168.2.254

Network Configuration Files
DNS Configuration


Domain Name Service translates hostnames to network addresses

Server address is specified by dhcp or in /etc/resolv.conf

search example.com cracker.org
nameserver 192.168.0.254
nameserver 192.168.1.254


system-config-printer


System->Administration->Printing

Supported printer connections:

Local (parallel or usb)

Unix/Linux print server

Windows print server

Netware print server

HP JetDirect

Configuration stored in /etc/cups/printers.conf

Printing Commands


lpr sends a job to the queue to be printed

Accepts ASCII, PostScript, PDF, others

lpq views the contents of the queue

lprm removes a job from the queue

System V printing commands such as lp, lpstat and cancel are also supported

Printing Utilities


evince views PDF documents

lpstat -a lists configured printers

enscript and a2ps convert text to PostScript

ps2pdf converts PostScript to PDF

mpage prints multiple pages per sheet

Setting the System's Date and Time


GUI: system-config-date

System->Administration->Date & Time

Can set date/time manually or use NTP

Additional NTP servers can be added

Can use local time or UTC

CLI: date [MMDDhhmm[[CC]YY][.ss]]

# date 01011330

# date 010113302007.05

Inodes


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), including:

file type, permissions, UID, GID

the link count (count of path names pointing to this file)

the file's size and various time stamps

pointers to the file's data blocks on disk

other data about the file



Directories


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


Hard Links


A hard link adds an additional pathname to reference a single file

One physical file on the filesystem

Each directory references the same inode number

Increments the link count

The rm command decrements the link count

File exists as long as at least one link remains

When the link count is zero, the file is removed

Cannot span drives or partitions

Syntax:

ln filename [linkname]

Symbolic (or Soft) Links


A symbolic link points to another file

ls -l displays the link name and the referenced file

lrwxrwxrwx 1 joe joe 11 Sep 25 18:02 pf -> /etc/passwd

File type: l for symbolic link

The content of a symbolic link is the name of the file that it references

Syntax:

ln -s filename linkname

Unit 9 - vim: An Advanced Text Editor

Objectives


Upon completion of this unit, you should be able to:

Use the three primary modes of vi and vim

Navigate text and enter Insert mode

Change, delete, yank, and put text

Undo changes

Search a document

Save and exit

vim Basics


To use vim, you must at least be able to

Open a file

Modify a file (insert mode)

Save a file (ex mode)

Opening a file in vim


To start vi:

vim filename

If the file exists, the file is opened and the contents are displayed

If the file does not exist, vi creates it when the edits are saved for the first time

Modifying a File
Insert Mode


i begins insert mode at the cursor

Many other options exist

A append to end of line

I insert at beginning of line

o insert new a line (below)

O insert new line (above)

Saving a File and Exiting vim
Ex Mode


Enter Ex Mode with :

Creates a command prompt at bottom-left of screen

Common write/quit commands:

:w writes (saves) the file to disk

:wq writes and quits

:q! quits, even if changes are lost


Moving Around
Command Mode


Move by character: Arrow Keys, h, j, k, l

Non-arrow keys useful for remote connections to older systems

Move by word: w, b

Move by sentence: ), (

Move by paragraph: }, {

Jump to line x: xG

Jump to end: G

Search and Replace
Command Mode


Search as in less

/, n, N


Undoing Changes
Command Mode


u undo most recent change

U undo all changes to the current line since the cursor landed on the line

Ctrl-r redo last "undone" change


Using multiple "windows"


Multiple documents can be viewed in a single vim screen.

Ctrl-w, s splits the screen horizontally

Ctrl-w, v splits the screen vertically

Ctrl-w, Arrow moves between windows

Ex-mode instructions always affect the current window

:help windows displays more window commands

Unit 8 - Text Processing Tools

Objectives


Upon completion of this unit, you should be able to:

Use tools for extracting, analyzing and manipulating text data.

Tools for Extracting Text


File Contents: less and cat

File Excerpts: head and tail

Extract by Column: cut

Extract by Keyword: grep

Viewing File Contents
less and cat


cat: dump one or more files to STDOUT

Multiple files are concatenated together

less: view file or STDIN one page at a time

Useful commands while viewing:

/text searches for text

n/N jumps to the next/previous match

v opens the file in a text editor

less is the pager used by man

Viewing File Excerpts
head and tail


head: Display the first 10 lines of a file

Use -n to change number of lines displayed

tail: Display the last 10 lines of a file

Use -n to change number of lines displayed

Use -f to "follow" subsequent additions to the file

Very useful for monitoring log files!

Extracting Text by Keyword
grep


Prints lines of files or STDIN where a pattern is matched

$ grep 'john' /etc/passwd

$ date --help | grep year

Use -i to search case-insensitively

Use -n to print line numbers of matches

Use -v to print lines not containing pattern

Use -AX to include the X lines after each match

Use -BX to include the X lines before each match

Tools for Analyzing Text


Text Stats: wc

Sorting Text: sort

Comparing Files: diff and patch

Spell Check: aspell

Gathering Text Statistics
wc (word count)


Counts words, lines, bytes and characters

Can act upon a file or STDIN

$ wc story.txt
39 237 1901 story.txt

Use -l for only line count

Use -w for only word count

Use -c for only byte count

Use -m for character count (not displayed)

Eliminating Duplicate Lines
sort and uniq


sort -u: removes duplicate lines from input

uniq: removes duplicate adjacent lines from input

Use -c to count number of occurrences

Use with sort for best effect:

$ sort userlist.txt | uniq -c

Comparing Files
diff


Compares two files for differences

$ diff foo.conf-broken foo.conf-works
5c5
< use_widgets = no --- > use_widgets = yes

Denotes a difference (change) on line 5

Use gvimdiff for graphical diff

Provided by vim-X11 package

Duplicating File Changes
patch


diff output stored in a file is called a "patchfile"

Use -u for "unified" diff, best in patchfiles

patch duplicates changes in other files (use with care!)

Use -b to automatically back up changed files

$ diff -u foo.conf-broken foo.conf-works > foo.patch
$ patch -b foo.conf-broken foo.patch


Spell Checking with aspell


Interactively spell-check files:

$ aspell check letter.txt

Non-interactively list mis-spelled words in STDIN

$ aspell list < letter.txt $ aspell list < letter.txt | wc -l Tools for Manipulating Text
tr and sed


Alter (translate) Characters: tr

Converts characters in one set to corresponding characters in another set

Only reads data from STDIN

$ tr 'a-z' 'A-Z' < lowercase.txt

Alter Strings: sed

stream editor

Performs search/replace operations on a stream of text

Normally does not alter source file

Use -i.bak to back-up and alter source file

Unit 7 - Standard I/O and Pipes

Objectives


Upon completion of this unit, you should be able to:

Redirect I/O channels to files

Connect commands using pipes

Use the for loops to iterate over sets of values

Standard Input and Output


Linux provides three I/O channels to Programs

Standard input (STDIN) - keyboard by default

Standard output (STDOUT) - terminal window by default

Standard error (STDERR) - terminal window by default

Redirecting STDOUT to a Program (Piping)


Pipes (the | character) can connect commands:

command1 | command2

Sends STDOUT of command1 to STDIN of command2 instead of the screen.

STDERR is not forwarded across pipes

Used to combine the functionality of multiple tools

command1 | command2 | command3... etc

Redirecting STDOUT to a Program
Examples


less: View input one page at a time:

$ ls -l /etc | less

Input can be searched with /

mail: Send input via email:

$ echo "test email" | mail -s "test" user@example.com

lpr : Send input to a printer

$ echo "test print" | lpr

$ echo "test print" | lpr -P printer_name


Scripting: for loops


Performs actions on each member of a set of values

Example:

for NAME in joe jane julie
do
ADDRESS="$NAME@example.com"
MESSAGE='Projects are due today!'
echo $MESSAGE | mail -s Reminder $ADDRESS
done

Wednesday, January 25, 2012

Unit 6 - Using the bash Shell

Objectives


Upon completion of this unit, you should be able to:

Use command-line shortcuts

Use command-line expansion

Use history and editing tricks

Use the gnome-terminal

Command Line Shortcuts
The Tab Key


Type Tab to complete command lines:

For the command name, it will complete a command name

For an argument, it will complete a file name

Examples:

$ xte
$ xterm
$ ls myf
$ ls myfile.txt

Command Line Shortcuts
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

$ history
14 cd /tmp
15 ls -l
16 cd
17 cp /etc/passwd .
18 vi passwd
... output truncated ...

Use the up and down 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)

Command Line Expansion
The tilde


Tilde ( ~ )

May refer to your home directory

$ cat ~/.bash_profile

May refer to another user's home directory

$ ls ~julie/public_html

Command Line Expansion
Commands and Braced Sets


Command Expansion: $() or ``

Prints output of one command as an argument to another

$ echo "This system's name is $(hostname)"
This system's name is server1.example.com

Brace Expansion: { }

Shorthand for printing repetitive strings

$ echo file{1,3,5}
file1 file3 file5
$ rm -f file{1,3,5}

Command Editing Tricks


Ctrl-a moves to beginning of line

Ctrl-e moves to end of line

Ctrl-u deletes to beginning of line

Ctrl-k deletes to end of line

Ctrl-arrow moves left or right by word

gnome-terminal


Applications->Accessories->Terminal

Graphical terminal emulator that supports multiple "tabbed" shells

Ctrl-Shift-t creates a new tab

Ctrl-PgUp/PgDn switches to next/prev tab

Ctrl-Shift-c copies selected text

Ctrl-Shift-v pastes text to the prompt

Sample Shell Script


#!/bin/bash
# This script displays some information about your environment

echo "Greetings. The date and time are $(date)"

echo "Your working directory is: $(pwd)"

Unit 5 - Users, Groups and Permissions

Objectives


Upon completion of this unit, you should be able to:

Explain the Linux security model

Explain the purpose of user and group accounts

Read and set file permissions

Users


Every user is assigned a unique User ID number (UID)

UID 0 identifies root

Users' names and UIDs are stored in /etc/passwd

Users cannot read, write or execute each others' files without permission.

Groups

Users are assigned to groups

Each group is assigned a unique Group ID number (gid)

GIDs are stored in /etc/group

Each user is given their own private group

Can be added to other groups for additional access

All users in a group can share files that belong to the group

Linux File Security


Every file is owned by a UID and a GID

Every process runs as a UID and one or more GIDs

Usually determined by who runs the process

Three access categories:

Processes running with the same UID as the file (user)

Processes running with the same GID as the file (group)

All other processes (other)

Permission Types


Four symbols are used when displaying permissions:

r: permission to read a file or list a directory's contents

w: permission to write to a file or create and remove files from a directory

x: permission to execute a program or change into a directory and do a long listing of the directory

-: no permission (in place of the r, w, or x)

Examining Permissions

File permissions may be viewed using ls -l

$ ls -l /bin/login

-rwxr-xr-x 1 root root 19080 Apr 1 18:26 /bin/login

File type and permissions represented by a 10-character string

-rwxr-x--- 1 andersen trusted 2948 Oct 11 14:07 myscript

Read, Write and Execute for the owner, andersen

Read and Execute for members of the trusted group

No access for all others

Changing File Ownership


Only root can change a file's owner

Only root or the owner can change a file's group

Ownership is changed with chown:

chown [-R] user_name file|directory

Group-Ownership is changed with chgrp:

chgrp [-R] group_name file|directory


Changing Permissions - Symbolic Method


To change access modes:

chmod [-R] mode file

Where mode is:

u,g or o for user, group and other

+ or - for grant or deny

r, w or x for read, write and execute

Examples:

ugo+r: Grant read access to all

o-wx: Deny write and execute to others

Changing Permissions - Numeric Method


Uses a three-digit mode number

first digit specifies owner's permissions

second digit specifies group permissions

third digit represents others' permissions

Permissions are calculated by adding:

4 (for read)

2 (for write)

1 (for execute)

Example:

chmod 640 myfile

Unit 4 - Browsing the Filesystem

Objectives


Upon completion of this unit, you should be able to:

Describe important elements of the filesystem hierarchy

Copy, move, and remove files

Create and view files

Manage files with Nautilus

Linux File Hierarchy Concepts


Files and directories are organized into a single-rooted inverted tree structure

Filesystem begins at the root directory, represented by a lone / (forward slash) character.

Names are case-sensitive

Paths are delimited by /

Some Important Directories


Home Directories: /root,/home/username

User Executables: /bin, /usr/bin, /usr/local/bin

System Executables: /sbin, /usr/sbin, /usr/local/sbin

Other Mountpoints: /media, /mnt

Configuration: /etc

Temporary Files: /tmp

Kernels and Bootloader: /boot

Server Data: /var, /srv

System Information: /proc, /sys

Shared Libraries: /lib, /usr/lib, /usr/local/lib

Current Working Directory


Each shell and system process has a current working directory(cwd)

pwd

File and Directory Names


Names may be up to 255 characters

All characters are valid, except the forward-slash

It may be unwise to use certain special characters in file or directory names

Some characters should be protected with quotes when referencing them

Names are case-sensitive

Example: MAIL, Mail, mail, and mAiL

Changing Directories


cd changes directories

To an absolute or relative path:

cd /home/joshua/work

cd project/docs

To a directory one level up:

cd ..

To your home directory:

cd

To your previous working directory:

cd -

Listing Directory Contents


Lists the contents of the current directory or a specified directory

Usage:

ls [options] [files_or_dirs]

Example:

ls -a (include hidden files)

ls -l (display extra information)

ls -R (recurse through directories)

ls -ld (directory and symlink information)

Copying Files and Directories


cp - copy files and directories

Usage:

cp [options] file destination

More than one file may be copied at a time if the destination is a directory:

cp [options] file1 file2 dest

If the destination is a directory, the copy is placed there

If the destination is a file, the copy overwrites the destination

If the destination does not exist, the copy is renamed

Moving and Renaming Files and Directories


mv - move and/or rename files and directories

Usage:

mv [options] file destination

More than one file may be moved at a time if the destination is a directory:

mv [options] file1 file2 destination

Destination works like cp


Creating and Removing Files


touch - create empty files or update file timestamps

rm - remove files

Usage:

rm [options] ...

Example:

rm -i file (interactive)

rm -r directory (recursive)

rm -f file (force)

Creating and Removing Directories


mkdir creates directories

rmdir removes empty directories

rm -r recursively removes directory trees

Unit 3 - Running Commands and Getting Help

Objectives


Upon completion of this unit, you should be able to:

Execute commands at the prompt

Explain the purpose and usage of some simple commands

Use the built-in help resources in Red Hat Enterprise Linux

Some Simple Commands


date - display date and time

cal - display calendar

Many levels of help

whatis

command --help

man and info

/usr/share/doc/

Tuesday, January 24, 2012

Unit 2 - Linux Usage Basics

Upon completion of this unit, you should be able to:

Log into a Red Hat Enterprise Linux system

Start X from a console

Access the command line from X

Change your password

Understand the nature of root privileges

Elevate your privileges

Edit plain text files


Logging in to a Linux System


Two types of login screens: virtual consoles (text-based) and graphical
logins (called display managers)

Login using login name and password

Each user has a home directory for personal file storage

Switching between virtual consoles and the graphical environment


A typical Linux system will run six virtual consoles and one graphical console

Server systems often have only virtual consoles

Desktops and workstations typically have both

Switch among virtual consoles by typing: Ctrl-Alt-F[1-6]

Access the graphical console by typing Ctrl-Alt-F7

Two desktop environments provided by Red Hat:

GNOME: the default desktop environment

KDE: an alternate desktop environment

Changing Your Password


To change your password using GNOME, navigate to System->Preferences->About Me and then click Password.

To change your password from a terminal: passwd

The root user


The root user: a special administrative account

Also called the superuser

root has near complete control over the system

Changing Identities


su - creates new shell as root

sudo command runs command as root

Requires prior configuration by a system-administrator

id shows information on the current user

Editing text files


The nano editor

Easy to learn, easy to use

Not as feature-packed as some advanced editors

Other editors:

gedit, a simple graphical editor

vim, an advanced, full feature editor

gvim, a graphical version of the vim editor

Overview of Linus Benedict Torvalds

Linus Benedict Torvalds



Linus Benedict Torvalds was born December 28, 1969 in Helsinki, Finland is a Finnish American software engineer and hacker, best known for having initiated the development of the open source Linux kernel. He later became the chief architect of the Linux kernel, and now acts as the project's coordinator.
He is the son of journalists Anna and Nils Torvalds, and the grandson of poet Ole Torvalds. Both of his parents were campus radicals at the University of Helsinki in the 1960s. His family belongs to the Swedish-speaking minority (5.5%) of Finland's population. Torvalds was named after Linus Pauling, the American Nobel Prize-winning chemist, although in the book Rebel Code: Linux and the Open Source Revolution, Torvalds is quoted as saying, "I think I was named equally for Linus the Peanuts cartoon character", noting that this makes him half "Nobel-prize-winning chemist" and half "blanket-carrying cartoon character".
Torvalds attended the University of Helsinki between 1988 and 1996, graduating with a master's degree in computer science from NODES research group. His academic career was interrupted after his first year of study when he joined the Finnish Army, selecting the 11-month officer training program to fulfill the mandatory military service of Finland. In the army he holds the rank of second lieutenant, with the role of a ballistic calculation officer. In 1990, he resumed his university studies, and was exposed to UNIX for the first time, in the form of a DEC MicroVAX running ULTRIX. His M.Sc. thesis was titled Linux: A Portable Operating System.

Born : Linus Benedict Torvalds
December 28, 1969 (age 42)
Helsinki, Finland
Residence : Portland, Oregon, United States
Nationality : Finnish American
Ethnicity : Swedish-speaking Finn
Alma mater : University of Helsinki
Occupation : Software engineer
Employer : Linux Foundation
Known for : Linux kernel, Git
Spouse : Tove Torvalds née Monni
Children : 3
Parents : Nils Torvalds (father)
Anna Torvalds (mother)
Relatives : Ole Torvalds (grandfather)
Website : torvalds-family.blogspot.com
cs.helsinki.fi/u/torvalds (outdated)

Unit 1 Linux Ideas and History

Upon completion of this unit, you should be able to:

Explain the nature of open source software

Discuss the origins of Linux

List the Red Hat operating system distributions

Explain basic Linux principles


What is Open Source?


Open source: software and source code available to all

The freedom to distribute software and source code

The ability to modify and create derived works

Linux Origins


1984: The GNU Project and the Free Software Foundation

Creates open source version of UNIX utilities

Creates the General Public License (GPL)

Software license enforcing open source principles

1991: Linus Torvalds

Creates open source, UNIX-like kernel, released under the GPL

Ports some GNU utilities, solicits assistance online

Today:

Linux kernel + GNU utilities = complete, open source, UNIX-like operating system


Linux principles


Everything is a file (including hardware)

Small, single-purpose programs

Ability to chain programs together to perform complex tasks

Avoid captive user interfaces

Configuration data stored in text

RH033 - Red Hat Linux Essentials & its Advantages

Linux Operating System

Linux is a free open-source operating system based on Unix. Linux was originally created by Linus Torvalds with the assistance of developers from around the globe. Linux is free to download, edit and distribute. Linux is a very powerful operating system and it is gradually becoming popular throughout the world.

Advantages of Linux


Low cost:
There is no need to spend time and huge amount money to obtain licenses since Linux and much of it’s software come with the GNU General Public License. There is no need to worry about any software's that you use in Linux.

Stability:
Linux has high stability compared with other operating systems. There is no need to reboot the Linux system to maintain performance levels. Rarely it freeze up or slow down. It has a continuous up-times of hundreds of days or more.

Performance:
Linux provides high performance on various networks. It has the ability to handle large numbers of users simultaneously.

Networking:
Linux provides a strong support for network functionality; client and server systems can be easily set up on any computer running Linux. It can perform tasks like network backup more faster than other operating systems.

Flexibility:
Linux is very flexible. Linux can be used for high performance server applications, desktop applications, and embedded systems. You can install only the needed components for a particular use. You can also restrict the use of specific computers.

Compatibility:
It runs all common Unix software packages and can process all common file formats.

Wider Choice:
There is a large number of Linux distributions which gives you a wider choice. Each organization develop and support different distribution. You can pick the one you like best; the core function's are the same.

Fast and easy installation:
Linux distributions come with user-friendly installation.

Better use of hard disk:
Linux uses its resources well enough even when the hard disk is almost full.

Multitasking:
Linux is a multitasking operating system. It can handle many things at the same time.

Security:
Linux is one of the most secure operating systems. File ownership and permissions make linux more secure.

Open source:
Linux is an Open source operating systems. You can easily get the source code for linux and edit it to develop your personal operating system.

Today, Linux is widely used for both basic home and office uses. It is the main operating system used for high performance business and in web servers. Linux has made a high impact in this world.




Objectives of Red Hat Linux Internationalization :-

A user who can use effectively employ Red Hat Enterprise Linux to customize his or her operating environment as well as accomplish common command-line tasks and desktop productivity roles.

Red Hat Enterprise Linux supports nineteen languages

Default language can be selected:

During installation

With system-config-language

System->Administration->Language

Alternate languages can be used on a per-command basis:

$ LANG=en_US.UTF8 date

Language settings are stored in /etc/sysconfig/i18n

Red Hat sponsored open source project

Focused on latest open source technology

Rapid four to six month release cycle

Available as free download from the Internet

An open, community-supported proving ground for technologies which may be used in upcoming enterprise products.