Linux Basics
WeeSan Lee <weesan@[Link]>
[Link]
Roadmap
What is Unix? What is Linux? Which Linux Distribution is better? Fish vs. Fishing Basic Commands Vi and Emacs Q&A References
[Link]
What is Unix?
A multi-task and multi-user Operating System Developed in 1969 at AT&Ts Bell Labs by
Ken Thompson (Unix) Dennis Ritchie (C) Douglas Mcllroy (Pipes - Do one thing, do it well)
Some other variants: System V, Solaris, SCO Unix, SunOS, 4.4BSD, FreeBSD, NetBSD, OpenBSD, BSDI
[Link]
What is Linux?
A clone of Unix Developed in 1991 by Linus Torvalds, a Finnish graduate student Inspired by and replacement of Minix Linus' Minix became Linux Consist of
Linux Kernel GNU (GNU is Not Unix) Software Software Package management Others
[Link]
[Link]
What is Linux?
Originally developed for 32-bit x86-based PC Ported to other architectures, eg.
Alpha, VAX, PowerPC, IBM S/390, MIPS, IA-64 PS2, TiVo, cellphones, watches, Nokia N810, NDS, routers, NAS, GPS,
[Link]
* See references at the end for the corresponding websites.
Which Linux Distribution is better?
> 300 Linux Distributions
Slackware (one of the oldest, simple and stable distro.) Redhat
RHEL (commercially support) Fedora (free)
CentOS (free RHEL, based in England) SuSe ( based in German) Gentoo (Source code based) Debian (one of the few called GNU/Linux) Ubuntu (based in South Africa) Knoppix (first LiveCD distro.)
[Link]
Which Linux Distribution is better?
Ubuntu Debian
Knoppix
Slackware
Gentoo
CentOS
Redhat
Source: [Link]
[Link]
Which Linux Distribution is better?
Ask yourself these questions (from LAH)
Is it going to be around in 5 yrs? Is it giong to stay on top of the latest security patches? Is it going to release updated software promptly? If I have problems, will the vendor talk to me?
Personally, I use Slackware But, we will use CentOS (possibly along with Slackware :)
[Link]
Fish vs. Fishing
Manpage
$ man ls $ man 2 mkdir $ man man $ man -k mkdir
4 Device drivers and network protocols
/dev/tty
/etc/hosts /usr/games/fortune man 7 locale /sbin/reboot
5 Standard file formats
Manpage sections (LAH Table 1.2 @ page 12)
6 Games and demos
1 User-level cmds and apps
7 Misc. files and docs
/bin/mkdir int mkdir(const char *, ); int printf(const char *, );
2 System calls
8 System admin. Cmds
3 Library calls
$ manpath $ env | grep MANPATH /etc/[Link]
[Link]
Fish vs. Fishing (cont)
Google
linux package management -rpm linux package management -rpm linux OR windows rpm site:[Link] linux faq filetype:pdf
Text-base, menu-based help from GNU ?, h, u, t, ^N, ^P, Enter $ info info
[Link]
Info
Basic Commands
ls
which
$ ls -l $ ls -a $ ls -la $ ls -l --sort=time $ ls -l --sort=size -r
$ which ls $ whereis ls $ locate stdio.h $ locate iostream $ rpm -q bash $ rpm -qa $ rpm -qa | sort | less
whereis
locate
cd
$ cd /usr/bin
$ pwd $ cd ~ $ cd ~weesan
rpm
pwd
find
~user
$ find / | grep stdio.h $ find /usr/include | grep stdio.h
What will cd ~/weesan do?
[Link]
Basic Commands (cont)
echo
rm
$ echo Hello World $ echo -n Hello World $ cat /etc/motd $ cat /proc/cpuinfo $ cp foo bar $ cp -a foo bar
cat
$ rm foo $ rm -rf foo $ rm -i foo $ rm -- -foo
$ chgrp bar /home/foo
$ chsh foo $ chfn foo $ chown -R foo:bar /home/foo
chgrp
cp
chsh
mv
chfn
$ mv foo bar
mkdir
chown
$ mkdir foo
[Link]
Basic Commands (cont)
tar
Pipe
$ tar cvfp [Link] lab1 $ gzip -9 [Link] $ gzip -cd [Link] | tar xvf $ tar xvfz [Link]
gzip
untar & ungzip
$ cal > foo $ cat /dev/zero > foo $ cat < /etc/passwd $ who | cut -d -f1 | sort | uniq | wc l $ echo The date is `date` $ echo `seq 1 10` ln vmlinuz-[Link] vmlinuz ln -s firefox-[Link] firefox
backtick
touch
$ touch foo $ cat /dev/null > foo
Hard, soft (symbolic) link
[Link]
Basic Commands (cont)
Disk usage
$ df -h /
$ du -sxh ~/
File space usage
Advance stuff
$ ssh eon who $ ssh eon cd .html ; tar cvfp - cs183 | gzip -9c | tar xvfpz $ ssh kilo-1 tar cvfp - /extra/weesan | tar xvfp - -C /
[Link]
Vi
2 modes Input mode
Delete
ESC to back to cmd mode Cursor movement
Command mode
dd (delete a line) d10d (delete 10 lines) d$ (delete till end of line) dG (delete till end of file) x (current char.) p (paste after) P (paste before) u / :w (write) :q (quit) :wq (write and quit) :q! (give up changes)
h (left), j (down), k (up), l (right) ^f (page down) ^b (page up) ^ (first char.) $ (last char.) G (bottom page) :1 (goto first line)
Paste
Undo
Search
Swtch to input mode
Save/Quit
a (append) i (insert) o (insert line after O (insert line before)
[Link]
Emacs
$ emacs Cursor movement
Paste
^y (yank) ^/ ^x^f ^g ^x^c (quit w/out saving) ^x^s (save) ^x^w (write to a new file)
^f (forward one char.) ^b (backward one char.) ^a (begin of line) ^e (end of line) ^n (next line) ^p (prev. line) ^v (page up) alt-v (page down)
Undo
Load file
Cancel
Save/Quit
Deletion
^d (delete one char) alt-d (delete one word) ^k (delete line)
[Link]
Q&A
[Link]
References
LAH
Ch 1: Where to Start
[Link] [Link] [Link] [Link] [Link]
[Link]
Unix history
Linus Torvalds
Linux Kernel
References
GNU (Gnus Not Unix)
[Link]
[Link] [Link] [Link] [Link] [Link]
Linux Distribution
PS2: Computational Cluster
Linux Gadgets
TiVo
[Link]
References
Nintendo DS Lite [Link] Nokia N810 [Link] [Link] Linux Distribution [Link] GNU/Linux Distro Timeline: [Link] [Link] [Link] Google Advance Search [Link]
[Link]