0% found this document useful (0 votes)
48 views

Linux Basics: Weesan Lee

The document discusses Linux basics including what Unix and Linux are, different Linux distributions, getting help in the terminal, basic terminal commands, and text editors like Vim and Emacs. It provides explanations and examples of various Linux concepts and commands.

Uploaded by

Anjali Sahu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Linux Basics: Weesan Lee

The document discusses Linux basics including what Unix and Linux are, different Linux distributions, getting help in the terminal, basic terminal commands, and text editors like Vim and Emacs. It provides explanations and examples of various Linux concepts and commands.

Uploaded by

Anjali Sahu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Linux Basics

WeeSan Lee <[email protected]>

http://www.cs.ucr.edu/~weesan/cs183/
Roadmap

 What is Unix?
 What is Linux?
 Which Linux Distribution is better?
 Getting help in Terminal
 Basic Commands
 Vi and Emacs
 Q&A
 References
http://www.cs.ucr.edu/~weesan/cs183/
What is Unix?

 A multi-task and multi-user Operating System


 Developed in 1969 at AT&T’s 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

http://www.cs.ucr.edu/~weesan/cs183/
What is Linux?
 A clone of Unix
 Developed in 1991 by Linus Torvalds, a Finnish
graduate student
 Inspired by and replacement of Minix(by Andrew S.
Tanenbaum)
 Linus' Minix became Linux
 Consist of
 Linux Kernel
 GNU (GNU is Not Unix) Software
 Software Package management
 Others

http://www.cs.ucr.edu/~weesan/cs183/ http://www.linuxdevices.com/files/misc/ibm-watchpad.jpg
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
 Andriod, PS2, TiVo,
cellphones, watches,
Nokia N810, NDS,
routers, NAS, GPS, …

* See references at the end


http://www.cs.ucr.edu/~weesan/cs183/ 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.)
 …

http://www.cs.ucr.edu/~weesan/cs183/
Which Linux Distribution is better?
Ubuntu
Debian
Knoppix

Slackware Gentoo

CentOS

Redhat

Source:
http://www.cs.ucr.edu/~weesan/cs183/
http://futurist.se/gldt/
Which Linux Distribution is better?

 Ask yourself these questions (from LAH)


 Is it going to be around in 5 yrs?
 Is it going 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 Ubuntu, Opensuse
 But, we will use CentOS (possibly along with
Slackware :)
http://www.cs.ucr.edu/~weesan/cs183/
Linux Terminal Emulator
 Terminal is an interface to OS through
commands
 Other interface is Graphical User Interface
(GUI)
 Terminal emulator is a program that allows
the use of the terminal in a GUI environment
 Shell is a command-line interface that
interprets a user's commands and script files,
and tells the operating system what to do
 Shell Examples: bash, csh, ksh, zsh etc
http://www.cs.ucr.edu/~weesan/cs183/
Getting help in Terminal
 Manpage  4 Device drivers and
network protocols
 $ man ls  $ man 4 tty
 $ man 2 mkdir  /dev/tty
 $ man –a mkdir  5 Standard file formats
 $ man man  $ man 5 hosts
 /etc/hosts
 $ man –k mkdir
 Manpage sections  6 Games and demos
 $ man 6 sol
 1 User-level cmds and apps  /usr/games/sol
 $ man 1 mkdir
 /bin/mkdir
 7 Misc. files and docs
 $ man 7 locale
 2 System calls
 $ man 2 mkdir  8 System admin. Cmds
 int mkdir(const char *, …);  $ man 8 reboot
 /sbin/reboot
 3 Library calls
 $ man 3 printf  $ manpath
 int printf(const char *, …);

http://www.cs.ucr.edu/~weesan/cs183/
Getting help in Terminal (cont)

 Info
 Text-based, menu-based help from GNU
 ?, h, n, p, t, u Enter
 $ info info

http://www.cs.ucr.edu/~weesan/cs183/
Basic Commands
 ls  which
 $ ls -l  $ which ls
 $ ls -a  whereis
 $ ls -la  $ whereis ls
 $ ls -l --sort=time  locate
 $ ls -l --sort=size -r  $ locate stdio.h
 cd  $ locate iostream
 $ cd /usr/bin  Apt (install packages/software)
 pwd  $ apt install emacs
 $ pwd  $ apt remove emacs
 ~  $ apt search emacs
 $ cd ~  $ rpm -qa | sort | less
 ~user  find
 $ cd ~weesan  $ find / | grep stdio.h
 What will “cd ~/weesan” do?  $ find /usr/include | grep stdio.h

http://www.cs.ucr.edu/~weesan/cs183/
Basic Commands (cont)
 echo  rm
 $ echo “Hello World”  $ rm foo
 $ echo -n “Hello World”  $ rm -rf foo
 cat  $ rm -i foo
 $ cat /etc/hostname  $ rm -- -foo
 $ cat /proc/cpuinfo  chgrp
 $ cat /proc/meminfo  $ chgrp bar /home/foo
 cp  chsh
 $ cp foo bar  $ chsh foo
 $ cp -a foo bar  chfn
 mv  $ chfn foo
 $ mv foo bar  chown
 $ chown -R foo:bar /home/foo
 mkdir
 $ mkdir foo
http://www.cs.ucr.edu/~weesan/cs183/
Basic Commands (cont)
 tar  Pipe
 $ tar cvfp lab1.tar lab1  $ cal > foo
 gzip  $ cat /dev/zero > foo
 $ gzip -9 lab1.tar  $ cat < /etc/passwd
 untar & ungzip  $ who | cut -d’ ‘ -f1 | sort |
 $ gzip -cd lab1.tar.gz | tar xvf – uniq | wc –l
 $ tar xvfz lab1.tar.gz  backtick
 touch  $ echo “The date is `date`”
 $ touch foo  $ echo `seq 1 10`
 $ cat /dev/null > foo  Hard, soft (symbolic) link
 ln vmlinuz-2.6.24.4 vmlinuz
 ln -s firefox-2.0.0.3 firefox

http://www.cs.ucr.edu/~weesan/cs183/
Basic Commands (cont)

 Disk usage
 $ df -h /
 File space usage
 $ du -sxh ~/
 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 /

http://www.cs.ucr.edu/~weesan/cs183/
Vim
 2 modes  Delete
 dd (delete a line)
 Input mode
 d10d (delete 10 lines)
 ESC to back to cmd mode  d$ (delete till end of line)
 Command mode  dG (delete till end of file)
 Cursor movement  x (current char.)
 h (left), j (down), k (up), l (right)  Paste
 ^ (first char.)  p (paste after)
 $ (last char.)  P (paste before)
 G (bottom page)  Undo
 :1 (goto first line)  u
 Swtch to input mode  Search
 a (append)  /
 i (insert)  Save/Quit
 o (insert line after  :w (write)
 O (insert line before)  :q (quit)
 :wq (write and quit)
 :q! (give up changes)

http://www.cs.ucr.edu/~weesan/cs183/
Other

 Windows  Linux
 Notepad, Wordpad  Gedit, nano, vim
 MS OFFICE  Libreoffice
 IE, Mozilla Firefox  Mozilla Firefox
 VLC  VLC
 Explorer(GUI)  Gnome, KDE
 Command Prompt  Gnome-terminal,
Konsole

http://www.cs.ucr.edu/~weesan/cs183/
Q&A

http://www.cs.ucr.edu/~weesan/cs183/
References

 LAH
 Ch 1: Where to Start
 Unix history
 http://en.wikipedia.org/wiki/Unix
 http://upload.wikimedia.org/wikipedia/commons/7/77/Unix_
history-simple.svg
 Linus Torvalds
 http://en.wikipedia.org/wiki/Linus_Torvalds
 Linux Kernel
 http://www.kernel.org/

http://www.cs.ucr.edu/~weesan/cs183/
References

 GNU (Gnu’s Not Unix)


 http://www.gnu.org/
 Linux Distribution
 http://en.wikipedia.org/wiki/Linux_distribution
 http://en.wikipedia.org/wiki/List_of_Linux_distributions
 PS2: Computational Cluster
 http://arrakis.ncsa.uiuc.edu/ps2/cluster.php
 Linux Gadgets
 http://linuxdevices.com/articles/AT4936596231.html
 TiVo
 http://dynamic.tivo.com/linux/linux.asp

http://www.cs.ucr.edu/~weesan/cs183/
References
 Nintendo DS Lite
 http://www.nintendo.com/ds/

 Nokia N810
 http://www.nokia.com/

 http://www.engadget.com/2007/10/17/nokia-n810-gets-official/

 Linux Distribution
 http://en.wikipedia.org/wiki/Linux_distribution

 GNU/Linux Distro Timeline: http://futurist.se/gldt/

 http://www.distrowatch.com/

 http://www.linux.org/dist/

 Google Advance Search


 http://www.google.com/intl/en/help/refinesearch.html

http://www.cs.ucr.edu/~weesan/cs183/

You might also like