Installing Linux
You have already done thatbut a few things to note: y g
Operating System Administration
Linux Distributions and Utilities for Non-Programmers
There are many distributions to choose from Only a few distributions are widely deployed (see: linux.org and
distrowatch.com) The code for Linux and the GNU utilities is open source so there is no charge for the code itselfbut depending on the distribution h f h d lf b d d h d b and packaging, media, and support, you may have to pay. Distributions Distributions:
Debian (debian.org) Red Hat Fedora (fedora.redhat.com) ( ) Mandrake (mandrakelinux.com) Ubuntu (ubuntu.com) [this is what we have in lab] SuSE (suse.com)
2
Disclaimer: Some of the slides have been adapted from the course textbook
TruboLinux (turbolinux.com),
How Much to Install
If you have the disk space (storage is cheap), install everything that
How You Want to Run Linux
Live CD
Some distributions allow you to run Linux live off a CD (e.g. SuSE) without
comes with the distribution X Window System
Graphical user interface Provides the basic windowing functions and interfaces to the screen Linux distributions use either XFree86 or X.org Foundation X org
installing it. Good option for trying it out (slow)
Virtual Machine
If you use a virtual machine (vmware.com) you can run Linux from within
Windows.
Desktop environments
In addition to X Window you need a desktop environment Window, Provides the interfaces that a person uses like icons, menus, toolbars
dual-boot
Th most likely option is to install Li The lik l i i i ll Linux alongside windows (d l b ) [ hi is what l id i d (dual-boot) [this i h
you have done in the lab]
GNOME (GNU Object Model Environment) [well use this] ( j )[ ] Simple and elegant KDE (the K Desktop Environment) Complex and flexible
3
Disk partitioning
A disk partition is an area of the disk that is treated as a separate unit The most intimidating step of the installation process, especially if you want to
keep existing Windows data (tools to help: Partition Magic)
4
If you have a second disk drive not currently used by Windows, use that for Linux
Other Details
If you plan to dual-boot windows partitions can be mounted and dual-boot,
GNU Utilities for Non-programmers p g
Logging in
Need an account (username and password, itlab and citlab) ( p ) Your shell starts off at a special directory (your home directory) Change your password (command: passwd) g y p p
read by Linux (mount as read-only so they are not accidently a te e ) altered) Boot loaders
Load windows when the system is booted Loads the kernel and Linux boots up Two options but they do the same job The original LILO (the Linux Loader) The recent GRUB (GNU Grand Unified Boot loader)
The $ or % prompt that you see when you first log in or start a
Boot floppy
Create one during installation. It can be used to boot Linux in case of
5
terminal window is displayed by the shell p y y The shell is a program that acts as a middleman between you and the Linux operating system ( lets you run p g p g y (it y programs and work with files) f ) The three most popular shells are (and each has its own p g programming language): g g g )
The Bourne Again shell (bash) The Korn shell (ksh)
6
system crash or failure
The C shell (csh)
Input, Output, and Special Characters
The output of commands are written to the terminal window, or window
Utilities & Pathnames
Terminate a process: Control-C End of input: Control-D L Logging out: C t l D ( exit or quit) i t Control-D (or it it) Change password: passwd
can be written to files. Three default I/O channels:
Standard input: where a program expects to find input Standard output: where a program writes its output Standard error: where a program writes error messages
By default, all three I/O channels are the terminal Special characters
Some characters are interpreted specially Known as metacharacters (Ctrl-D Ctrl-C etc) (Ctrl-D, Ctrl-C, Can be listed using the stty command
7
Note: commands are case sensitive
P th Pathnames:
Two files in the same directory cannot have the same name (different
directories ok) Current directory (represented by .) and parent directory (..) Absolute pathname: relative to the root (/) directory Relative pathname: relative to the current working directory
Absolute & Relative Pathnames
Examples using the cd (change directory) command
Utilities for Working with File System
pwd cat l ls more page head tail mv mkdir cp cd rm rmdir di lp/lpstat/cancel lpr/lpq/lprm (BSD) wc file groups g p chgrp chmod
10
Utilities and Their Details
pwd
Every Linux process has a location in the directory hierarchy termed
Utilities and Their Details Details
ls
With no arguments, lists all of the files in the current working
current working directory When you log into Linux your shell starts at your home directory Linux, your directory Every user has a different home directory (may begin with /home) The system administrator assigns these home directory values The pwd command is used to display your shells current working directory y
cat
Takes input from standard input or list of files and displays them to p p p y
directory in alphabetical order, excluding filename that start with a period (hidden files) With -a for all files including hidden files l f long f -l for l format (including owner, size, date of last modification) l d d fl df -R recursively lists the contents of a directory and its subdirectories S example of l See l f long li i on the next slide listing h lid
Listing contents of a file
Use the cat command for small files (doesnt pause between screens) Use the more command for large files U head n f l to d l the f Use h d file display h first n l lines of f l (d f l is 10 l ) f file (default lines)
12
standard output (default input is keyboard, default output is screen) Standard output can be sent to a file using output redirection >. If file doesnt exist it is created, otherwise its contents are overwritten 11 cat is short for concatenate (to connect in a series of links)
Use tail n file to display the last n lines of file (default is 10 lines)
File Attributes (Meaning quality or characteristic that a file has)
Consider this example:
Utilities and Their Details Details
mv
Renames a file (mv oldFileName newFileName). Use the -i option for
-rw-rw-r-- 1 sam cs 150 Oct 05 08:08 abc.txt
-rw-rw-r--: file permissions (more on this later) 1: hard link count sam: username (owner) cs: group name 150: file size in bytes y Oct 05 08:08: date the file was last modified abc txt: the name of the file abc.txt: File names: A Linux filename may be up to 255 characters in
13
confirmation Can also b used to move a f l or a collection of f l to a d l be d file ll f files directory And it can be used to move an entire directory (renames it)
mkdir
Creates a directory (if a directory already exists, an error message id
displayed) di l d)
cd
Ch Changes (or moves to) a d ( ) directory If no directory name is provided, the shell is moved to its owners home
length; may contain any printable character except the slash (/); and there is no requirement for file extension
directory
14
Comments regarding labs
Note the following:
mv command is for renaming the file
Utilities and Their Details Details
cp
Makes a copy of a file Can also be used to copy one or more files to a directory
Syntax:
#mv i oldFileName newFileName #mv -i {filename}* directoryName {f } y #mv -i oldDirectoryName newDirectoryName
rmdir
Removes one or more directories A directory must be empty before it can be removed To recursively remove a directory and all of its contents, use the -r
mv is a fast track that j f just remane the f ( dir) but file (or )
not move the contents of a file (or a dir). The i is for confirmation if that file (dir) already exists f f f f ( ) y
option
rm
Removes a file from the directory hierarchy rm with the -r option removes a directory and all of its contents
15
16
Comments regarding labs C t di l b
Note the following:
Cp command is for copying the file
Utilities and Their Details Details
lp/lpstat/cancel
Prints the named files to the printer specified by -d option (destination) d Use the lpstat to find the status of a particular job or printer Use the cancel to cancel a print job (you need the job ID displayed by cancel
Syntax:
#cp -i oldFileName newFileName # cp -ir {filename}* directoryName p {f } y
lpstat)
lpr/lpq/lprm p pq p
BSD Unix provides its own print commands, which are also supported by
cp is a fast track that just copies the oldfilename to
17
newfilename where I want to keep the oldfilename . The sencond form of cp copies a list of files into directoryname The -i is for confirmation if that file (dir) already exists The -r option causes any source files that are directories to be recursively copied, i.e. coping the entire directory.
Linux Similar to lp/lpstat/cancel (print, check queue, cancel a print job)
wc
Counts the number of lines, words, and characters using the -lwc options,
respectively
18
Utilities and Their Details Details
file
Describes the content of a file (its type: text binary symbolic link) text, binary,
File Permissions
User group everyone else: User, group,
groups
Each user is a member of one or more groups on the system The groups command with no arguments, displays a list of all the
g p groups that you are a member of (groups userID to display a list of y (g p p y that users groups)
chgrp gp
Changes the group of files you own This utility is seldom used by normal users ( y y (unless youre member of y
several groups
chown
19
Allows super-user to change the ownership of files
20
File Permissions Permissions
The hard way
The chmod Command
For changing permissions on files (and directories) Doing it the hard way
21
22
File Permissions
Memorizing the hard way way
File Permissions
Premissions
The easy way 0 = 1=x 2=w 3 3=wx 4=r 5=rx 6=rw 7=rwx
Premission
23
24
File Permissions Permissions
The easy wayexamples:
25