01 Linux Basics
01 Linux Basics
01 Linux Basics
Linux vs Unix
I BCA,
LINUX PROGRAMMING (15CA1103)
Session-3
V.S.KUMAR
BasicLinuxCommands
FileHandling TextProcessing
SystemAdministration
ProcessManagement Archival Network
FileSystems AdvancedCommands
http://www.cs.ucr.edu/~weesan/cs183/
Roadmap
What is Unix?
What is Linux?
Which Linux Distribution is better?
Fish vs. Fishing
Basic Commands
Vi and Emacs
Q&A
References
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,
What is Linux?
A clone of Unix
Developed in 1991 by Linus Torvalds, a
http://www.linuxdevices.com/files/misc/ibm-watchpad.jpg
What is Linux?
Originally
Slackware
Gentoo
CentOS
Redhat
http://www.cs.ucr.edu/~weesan/cs183/
Source:
http://futurist.se/gldt/
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 :)
http://www.cs.ucr.edu/~weesan/cs183/
man
man
man
man
ls
2 mkdir
man
-k mkdir
apps
/bin/mkdir
2 System calls
int mkdir(const char *,
);
3 Library calls
int printf(const char *,
);
http://www.cs.ucr.edu/~weesan/cs183/
network protocols
/dev/tty
$ manpath
$ env | grep MANPATH
/etc/man.config
Info
Text-base, menu-based help from GNU
?, h, u, t, ^N, ^P, Enter
$ info info
http://www.cs.ucr.edu/~weesan/cs183/
Basic Commands
ls
$
$
$
$
$
ls
ls
ls
ls
ls
-l
-a
-la
-l --sort=time
-l --sort=size -r
cd
$ cd /usr/bin
pwd
$ pwd
~
$ cd ~
~user
$ cd ~weesan
do?
http://www.cs.ucr.edu/~weesan/cs183/
which
$ which ls
whereis
$ whereis ls
locate
$ locate stdio.h
$ locate iostream
rpm
$ rpm -q bash
$ rpm -qa
$ rpm -qa | sort | less
find
$ find / | grep stdio.h
$ find /usr/include | grep
stdio.h
cat
$ cat /etc/motd
$ cat /proc/cpuinfo
cp
$ cp foo bar
$ cp -a foo bar
mv
$ mv foo bar
mkdir
$ mkdir foo
http://www.cs.ucr.edu/~weesan/cs183/
rm
$ rm foo
$ rm -rf foo
$ rm -i foo
$ rm -- -foo
chgrp
$ chgrp bar /home/foo
chsh
$ chsh foo
chfn
$ chfn foo
chown
$ chown -R foo:bar
/home/foo
gzip
$ gzip -9 lab1.tar
xvf
$ tar xvfz lab1.tar.gz
touch
$ touch foo
$ cat /dev/null > foo
Pipe
$ cal > foo
$ cat /dev/zero > foo
$ cat < /etc/passwd
$ who | cut -d -f1 | sort |
uniq | wc l
backtick
$ echo The date is
`date`
$ echo `seq 1 10`
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/
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/
Vi
2 modes
Input mode
ESC to back to cmd mode
Command mode
Cursor movement
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)
Swtch to input mode
a (append)
i (insert)
o (insert line after
O (insert line before)
http://www.cs.ucr.edu/~weesan/cs183/
Delete
dd (delete a line)
d10d (delete 10 lines)
d$ (delete till end of line)
dG (delete till end of file)
x (current char.)
Paste
p (paste after)
P (paste before)
Undo
u
Search
Save/Quit
:w (write)
:q (quit)
:wq (write and quit)
:q! (give up changes)
Emacs
$ emacs
Cursor movement
char.)
^a (begin of line)
^e (end of line)
^n (next line)
^p (prev. line)
^v (page up)
alt-v (page down)
Deletion
http://www.cs.ucr.edu/~weesan/cs183/
Paste
^y (yank)
Undo
^/
Load file
^x^f
Cancel
^g
Save/Quit
saving)
^x^s (save)
^x^w (write to a new
file)
Q&A
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/