22/07/07

Linux Basics Tutorial

About this tutorial

Yet Another Linux Basics tutorial...

* RedHat does it in four 8 hour days, the compressed version is one 8 hour day

* Novell does it in 5 hours

* This is the attempt to teach you THE BASICS in 2.5 hours without corporate bias

This is a BETA.

If this is too slow or fast let me know!

What is Linux?

A Fully-Functional Multi-User Multi-Process Unixlike Open Source Operating System comprised of Linus Torvalds' kernel, many GNU tools, and software from many many more contributers worldwide

http://www.linux.org

http://www.kernel.org

http://www-2.cs.cmu.edu/~brians/comp/demon_penguin.html

http://web.mit.edu/jonas/www/faim/whatislinux.pdf

Grabbing your distro...

distrowatch.com Boasts that there are 304 Linux distros in their database

Retailers like amazon.com will sell Linux distros still in the box and books that include a copy of the author's favorite distro

Once you've made a choice you can download the ISOs or install floppies from the distributor's website or a mirror

Don't have a cdrw? cheapbytes Can help you out.

Burning ISOs – Linux in 2 steps

1) cdrecord -scanbus

2) cdrecord -v speed=2 dev=0,0,0 -data cdimage.iso

Copying cdrom

1) Mount /mnt/cdrom

2) mkisofs -r -o cdimage.iso /mnt/cdrom

3) cdrecord -v speed=2 dev=0,0,0 -data cdimage.iso

More than you ever wanted to know about Linux cd

writing can be found at the howto...

http://www.ibiblio.org/pub/Linux/docs/HOWTO/CD-Writing-HOWTO

Windows ISO burning

http://www.deepburner.com/

Shameless plug...

LUGs are another great way to get started with Linux.

http://www.wplug.org

Installfests, General Users Meetings, Tutorials such as this, Mailing Lists, and more!

Good commands that you need to memorize, today!

File Commands: ls, cd, cp, mv, rm, mkdir, rmdir

text reading: cat, more, less

text tools: awk, grep, sed

text editors: vi, emacs, pico, gedit

time: date, cal, uptime

Location: find, locate, which, whereis

file extraction: tar, unzip, gunzip

Processes: top, ps, lsof, kill, fg, bg

User tools: passwd, w, who, finger, talk

environment: printenv, setenv, echo

Internet: lynx, pine, whois

Service control: chkconfig, init.d, service

Printing: lpr, lpq

Networking: ifconfig, route, traceroute, dig, ping

disk usage: du, df, quota

partitions: fdisk, fsck, mkfs, tune2fs, mount

Tell me something about my computer

uname -a

hostname

cat /proc/cpuinfo

lspci

cat /proc/pci

lsmod

Init allows you to control your system state

1 single user

2 multiuser

3 networking

4 reserved

5 X (aka the GUI)

6.reboot


Shutting down and Rebooting

/etc/shutdown -h now

/etc/poweroff

/etc/shutdown -t60 -r

/sbin/reboot


Output redirection

echo “this” > foo

echo “that” >> foo

cat foo

this

that

Pipes and More

The pipe |

cat /etc/passwd | grep

The semicolon ;


mkfs /dev/hdb1 ; mkfs /dev/hdb2

The slashdot ./

./myscript

Shell Scripting

A series of commands in an executable text file

----------------------------------------------------

echo “Hello World”

echo “Print this to File” >> foo

lpr -Pmyprinter foo

--------------------------------------------------

It all starts with /

/bin

/boot

/dev

/etc

/home

/lib

/mnt

/opt

/proc

/root

/sbin

/tmp

/usr

/var

Partitions

/boot

/usr

/opt

/home

/var

/tmp

/

Files you never want to rm

*anything in /dev

*anything in /proc

*don't get tempted by /proc/kcore

*anything in /boot

*/lib/kernel/modules/{the kernel you want to use}

*contents of /etc, /bin, /usr/bin, /usr/lib

*you may remove the contents of /tmp but not /tmp

lilo.conf example

boot=/dev/hda

map=/boot/map

install=/boot/boot.b

prompt

timeout=50

message=/boot/message

password=huggybot


lba32

default=linux

image=/boot/vmlinuz-2.0.36

label=linux

root=/dev/hda2

read-only

other=/dev/hda1

label=win

Installing Packages

Debian Packages - dpkg

Red Hat Packages – rpm

rpm -Uvh package.rpm

rpm -ivh package.rpm

rpm -aq | grep package

rpm -e package

Tar files

To extract a tar.gz file: tar -zxvf {filename}

To extract a .tar file: tar -xvf foo.tar

To create a .tar file: tar -cvf /foodir foo.tar

once you've extracted the tar file look for a readme.

Perhaps there's an executable installation file

Or a Makefile

Perhaps it's source you need to compile yourself

File permissions

To check the permissions use “ls -l”

utilize groups

chown {username} {filename}

chown :{groupname} {filename}

chmod to change permissions

chmod a+rwx {filename}

chmod u+r {filename}

chmod o-x {filename}

chmod 700 {filename}

Start with a minimal configuration!

Don't install all the whistles and bells.

Only install what you need now.

Educate yourself about the services

you are running!

No one should use telnet or ftp, use ssh/scp instead

Use chkconfig –list

check http://www.cert.org for vulnerabilities

turn off any services that are vulnerabilities until you

can update or patch!

0 komentar:

In the News

Quote of the Day