Linux Guide
From Wikibooks
Contents[hide] |
Basic Usage and Installation
Linux GUIs
KDE - The K Desktop Environment is a free Windows like GUI for linux. It features a slick interface that is easy to control and customize.
GNOME - GNOME is a simple and easy to use desktop. Its a complete GUI for Linux usually bundled with loads of applications ranging from a word processor to a music player.
XFCE - A small, fast, very simplistic and nice looking GUI for linux with a variety of themes from which to choose.
FLUXBOX - Fluxbox is yet another GUI for X, way more minimalistic than XFCE. It's based on the Blackbox 0.61.1 code.
IceWM - an even more minimalistic GUI for X. The goal of IceWM is speed, simplicity, and not getting in the user's way.
[Note: Both GNOME and KDE use comparatively higher system resources than XFCE and Fluxbox. So if you are on a old PC (eg., Pentium 200 MHz, or have less than 128 MB RAM) you should seriously consider XFCE and Fluxbox over the heavyweights. Same apply if you find KDE or GNOME somehow slow on your high end workstation. IceWM, though minimalistic, is fast, reliable, themable, and less resource intensive than the others.
Distributions
Overall Ease of Use: (Most of the 'hardness' of use can be easily supressed by a bit of reading.)
(A) Easy (B) Almost Easy (C) Feasible, but not the easiest. (D) Lot of Linux knowledge recommended.
centOS - A distribution that correlates with Red Hat Enterprise Linux minus the copyrighted material.
College Linux - Based on Slackware, designed for students.
Gentoo Linux - Offers four levels of installation, very time consuming, but easy to upgrade, and very pleasant to use. (B)
Redhat Linux - Designed mostly for business, yet usable for individuals also. (A)
Fedora Linux - Unsupported by Redhat but excellent open source version of RedHat Linux. (A)
Debian Linux - Contains a lot of packages, easy to use and update. (B)
Ubuntu Linux - Based on Debian, it uses GNOME, and have frequent updates. Easy to use and install. The Ubuntu team will send you Ubuntu CDs at no charge. (A)
SuSE Linux - Designed mostly for business, but still usable for individuals. (A)
Slackware Linux - One of the first Linux distributions. It has a pretty easy installation, but a bit of knowledge would be useful. (C)
Mandriva Linux - Easy to install and use. (A)
Linux From Scratch - This is what would be considered a Distribution Building HOW-TO. Time consuming, and knowledge of linux (or fast reading skills) is a must. (D)
Linspire - Designed to 'feel' and act like Windows. (A)
Lycoris Desktop/LX - Designed to look like Windows, it has support for many windows features. (A)
Xandros Linux - Good distribution for anyone from businesses, to individuals. Easy to install, and use. (A)
MEPIS Linux - A Debian-based distribution with superb hardware support. Allows you to test before installing using a LiveCD. Comes in two flavors: SimplyMEPIS for the regular desktop users and ProMEPIS for use in a more commercial environment. (A)
Live CDs
Live CDs don't need to be installed to your hard drive for you to use them. Besides letting you test Linux easily, they are useful as system repair or recovery disks. Just set your system BIOS to boot from CD, insert the disk into your CD-ROM drive, restart you computer, and Linux should boot up hassle free.
Damn Small Linux - A Linux distro so small it can be carried on a business card sized CD or USB key. Now you can take Linux with you everywhere. Hard drive install is also available and easy.
Knoppix - Mother of almost all Live CDs! Knoppix is a great live CD for giving a Linux demo or for general desktop use. Knoppix runs KDE and is packed with applications of all sorts. Contains 2Gb of packages on the disk due to compression algorithms. If you like Knoppix, it can be installed permanently from your live CD too! Best of all, it's based on Debian!
Linspire - A nice distro that is made for office and workstation use, contains basic programs for many functions though it's not as mutable as Knoppix. The Live CD version does not access the software warehouse, one of Linspire's best features.
SimplyMEPIS - A great Debian-based live CD. SimplyMEPIS is a complete desktop Linux including KDE 3.3.2 and the lighter IceWM desktop, OpenOffice, Mozilla-Firefox, Skype, kphone for VOIP, GIMP2, and Xine among 2Gb of compressed applications. Unlike Knoppix which is primarily a live CD, MEPIS was designed to make a complete and full-featured install, after testing, in about 15 minutes --the simple install process is possibly the easiest of any distribution. (Desktoplinux.com Review)
Morphix - Morphix is designed to be a highly customizable live CD. There are four basic versions of it: Light GUI, GNOME, KDE and Gamer. Each version leaves at lease a couple hundred megs for you to add Run from a live CD to get a taste (run the whole operating sytem from a CD)
- Austrumi Latvian language with English support
- Puppy Small and Windows-like, can run from CD or keydrive
- Beatrix Simple, Gnome based
- Feather Linux Small dark and cool. Knoppix based.
- Live CDs - A comprehensive list of 100+ live Linux distributions.
- A Taste of Linux - An extremetech.com review of several popular live Linux CD distributions.
- List of Linux Distributions
Linux Basics
What is Linux?
The name "Linux" properly refers to an operating system "kernel", a single but key component of a complete operating system.
In everday use, the term "Linux" is frequently used to refer to a complete operating system which consists of the kernel and some of the thousands of other programs required to make an operating system useful. Much of the important system software that is typicaly installed on a Linux system comes from The GNU Project, a project to build an operating system run by The Free Software Foundation. The Free Software Foundation was founded by Richard Stallman. Stallman believes that the people should use the term "Gnu/Linux" to refer to such an operating system, because so many of the required programs were in fact, written as part of the GNU Project.
Starting Linux (Booting)
When a computer is turned on, it normally begins the process of "booting" by reading sofware from the system's hard disk (or other non-volatile storage medium), and loading into it memory and then executing it. In this process the kernel is loaded and then various other system programs may be loaded.
A Linux system can be configured to boot up to one of several available "run levels":
0 Halt the system. 1 Single-user mode (for special administration). 2-5 Normal operation (user defined). 6 Reboot.
Customize Boot
Debian
The following quote from The Debian GNU/Linux FAQ explains how to add a custom procedure to a Debian or Debian based system boot:
Suppose a system needs to execute script foo on start-up, or on entry to a particular (System V) runlevel. Then the system administrator should:
- Enter the script foo into the directory /etc/init.d/.
- Run the Debian command update-rc.d with appropriate arguments, to set up links between the (command-line-specified) directories rc?.d and /etc/init.d/foo. Here, '?' is a number from 0 through 6 and corresponds to each of the System V runlevels.
- Reboot the system.
The command update-rc.d will set up links between files in the directories rc?.d and the script in /etc/init.d/. Each link will begin with a 'S' or a 'K', followed by a number, followed by the name of the script. Scripts beginning with 'S' in /etc/rcN.d/ are executed when runlevel N is entered. Scripts beginning with a 'K' are executed when leaving runlevel N.
External Links
Linux Guru Training
Security and Linux Server Configuration
Cfengine: a set of tools that administers and configures computers according to the instructions in its configuration files, which describe the desired characteristics of system components using a high-level language. More at cfengine the Cfengine Home Page and cfwiki.org
Linux Programming
Some Useful Terminal Commands
- For help about a command, try man <command> which will bring up the manual for it. Note that some command are build in your shell and do not have a man page, use your interpreter internal command (should be help <command>).
File Manipulation
Copy directory options:
$cp -frvp /source /destination
^ ^^^^ ^ ^
| |||| | \----------- Path from root is best
| |||| \-------------------- Path to copy from root best
| ||||
| |||| OPTION FLAGS----------------
| |||\------------------------- Keep permissions
| ||\-------------------------- Verbose
| |\--------------------------- Recursive files and folders
| \---------------------------- Force
| ----------------------------
\-------------------------------- Copy command
cp prod/p* reports -copy all files beginning with "p" to reports directory -can reverse p* to *p for files ending with "p"
Copy img to floppy:
dd bs=2x80x18b if=/dev/fd0 of=/tmp/floppy.img
Copy source to make img:
dd if=/dev/cdrom of=filename.iso
^------^_________ replace with file name
Remove directory:
$rm -frv /dir
^ ^^^ ^
| ||| \---------------------- Remove directory
| |||
| ||| OPTIONS--------------------
| ||\-------------------------- Verbose
| |\--------------------------- Recursively through all dir
| \---------------------------- Force
| ---------------------------
|
\-------------------------------- Remove command
rm* <- delete all files in directory rm -r <- Delete directory and contents
Command options for permissions r = read w = write x = execute X = execute only if user already has execute s = set user or group id on execution t = sticky + u = permission granted to user who owns file g = permissions granted to group members o = permissions granted to users other than "u" or "g"
format:
drwxrwxrwx
^^^^^^^^^^
||||||||||
|||||||\\\----------- other users
|||||||
||||\\\-------------- group
||||
|\\\----------------- owner
|
\-------------------- directory = "d" (possible: -, b, c, q)
Octal Method: chmod
permissions
4 = read examples: 7 = 4+2+1 will show "rwx"
2 = write 6 = 4+2 will show "rw-"
1 = execute 5 = 4+1 will show "r-x"
Usage: chmod 755 FileName <--- change file permissions
Usage: chmod -R 755 DirectoryName <--- change directory permissions recursively
will show permissions "-rwxr-xr-x"
Note: first character in permissions show what kind of file
- = file
d = directory
b, c, or q = divice files
Usage format:
chmod -R ugoa =+- rwx filename
^ ^^^^ ^^^ ^^^ ^
| |||| ||| ||| |
| |||| ||| ||| \---------- file or directory
| |||| ||| ||| -----------------------------------
| |||| ||| ||\---------------- Execute
| |||| ||| |\----------------- Write
| |||| ||| \------------------ Read
| |||| ||| -----------------------------------
| |||| ||\-------------------- Remove
| |||| |\--------------------- Add
| |||| \---------------------- assign
| |||| -----------------------------------
| |||\------------------------ All s = sticky bit
| ||\------------------------- Others (set usr/grp on execution)
| |\-------------------------- Group
| \--------------------------- User
| -----------------------------------
\----------------------------- Recursively through all directories
-----------------------------------
Usage: chmod g+w filename
VI/M uses 2 modes in which to process text. To process the various commands available use the "<esc>" key. To insert text simply type "i" to return to text insert mode.
For Starters/Basics------------------------
Start Vi >vi [From command line]
Insert mode i
Command mode <esc>
Save doc :w
Quit app :q
Usage: :wq [will save and exit document]
Navigation------------------------------ Right l Left h up k Down j ----------------------------------------
Sort all
:1,$ !sort
Replace text
:1,$s /and/AND/g ^^^^^ ^ ^ ^ ||||| | | | ||||| | | \----------- Globally ||||| | \-------------- Replace with ||||| \------------------ Find ||||| ||||\---------------------- substitute for text |||\----------------------- To last line ||\------------------------ separator |\------------------------- From line "1" \-------------------------- ":" operator to start command processing Select Ranges :1,$ = All lines in file :1,. = All lines from start of file to current (included) :.,$ = All lines from current to end of file (inclusive) :.-2 = Single line 2 lines before current line :10,20 w abc <enter> = Write lines 10,20 to new file abc :r abc <enter> = Reads contents of file abc into working file :10,20d <enter> = Delete block lines 10 ~ 20
See Line Numbers
:set number to disable :set nonumber
Write lines to new file
:1,10w abc [puts lines 1~10 into file abc]
Change working file from current to file abc [be sure to save first]
:e abc
Read abc file into working file after cursor
:r abc
Execute command from prompt
:!cmd [where cmd is could be a bash command]
Example -> :r !date [inserts time and date at prompt]
Enable syntax option for programming source text highlighting
:syntax enable To disable = :syntax off
VI Navigation [escape key = <esc>]
0 [zero] = Move to beginning of line
G = Go to end of file
5G = Move to beginning of 5th line
u = Undo
. = Repeat last command
x = Delete character
dd = Delete line
dw = Delete word
d$ = Delete from cursor to end of line
$ then J = Join/append following line with current
$ then a = Append input at end of line
A = Append input at end of line [same as above, but one less key stroke]
i = Insert text at cursor
/ = Bottom of screen type search string and <enter> will move
cursor to first occurance
Printing
Work from Bash Prompt:
lpr -P //PrintServer/PrinterName "file name"
Other options:
-# Number of copies [example "-2" for 2 copies]
-c Make copy before print
lpq -P PrinterName : Displays printer status report
lprm 4 : Removes job #4 from printer
pr : Formats, paginates, prints header
OPTIONS
-d : forces double spacing
-h : Customize header
-l : Change number of lines per page | default=66
example: pr customers | lpr <format and print file "customers">
example: lprm 1006 <canceled job 1006>
lpstat -s
ex: lp -n 2 all files
ex: lp -n 3 all files -d a3printer
ex: lpstat -d a3printer