Introduction to LinuxUnix UNIX is an operating system
- Slides: 17
Introduction to Linux/Unix • UNIX is an operating system which was first developed in the 1960 s, and has been under constant development ever since. By operating system, we mean the suite of programs which make the computer work. It is a stable, multi-user, multi-tasking system for servers, desktops and laptops. • UNIX systems also have a graphical user interface (GUI) similar to Microsoft Windows which provides an easy to use environment • There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and Mac. OS X.
The UNIX operating system • The UNIX operating system is made up of three parts; the kernel, the shell and the programs. • The kernel - The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls. • The shell - The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI).
Roadmap • • What is Unix? What is Linux? Which Linux Distribution is better? Fish vs. Fishing Basic Commands Vi and Emacs Q&A References http: //www. cs. ucr. edu/~weesan/cs 183/
What is Linux? • Originally developed for 32 -bit x 86 -based PC • Ported to other architectures, eg. – Alpha, VAX, Power. PC, IBM S/390, MIPS, IA-64 – PS 2, Ti. Vo, cellphones, watches, Nokia N 810, NDS, routers, NAS, GPS, … http: //www. cs. ucr. edu/~weesan/cs 183/ * See references at the end for the corresponding websites.
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 Package management Others http: //www. cs. ucr. edu/~weesan/cs 183/ http: //www. linuxdevices. com/files/misc/ibm-watchpad. jpg
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, Sun. OS, 4. 4 BSD, Free. BSD, Net. BSD, Open. BSD, BSDI http: //www. cs. ucr. edu/~weesan/cs 183/
Which Linux Distribution is better? • > 300 Linux Distributions – Slackware (one of the oldest, simple and stable distro. ) – Redhat • RHEL (commercially support) • Fedora (free) – – – – Cent. OS (free RHEL, based in England) Su. Se ( based in German) Gentoo (Source code based) Debian (one of the few called GNU/Linux) Ubuntu (based in South Africa) Knoppix (first Live. CD distro. ) … http: //www. cs. ucr. edu/~weesan/cs 183/
Starting an UNIX terminal
Basic Linux command • ls (list) - The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory. • mkdir (make directory) – Used for creating the directory/and subdirectory. • cd (change directory) - The command cd directory means change the current working directory to 'directory'. The current working directory may be thought of as the directory you are in, i. e. your current position in the filesystem tree. • The current directory (. ) - In UNIX, (. ) means the current directory
Basic Linux command • cp (copy) - cp file 1 file 2 is the command which makes a copy of file 1 in the current working directory and calls it file 2 • mv (move) - mv file 1 file 2 moves (or renames) file 1 to file 2 To move a file from one place to another, use the mv command. This has the effect of moving rather than copying the file, so you end up with only one file rather than two. • rm (remove), rmdir (remove directory) - To delete (remove) a file, use the rm command • clear (clear screen) - Before you start the next section, you may like to clear the terminal window of the previous commands so the output of the following commands can be clearly understood. • cat (concatenate) - The command cat can be used to display the contents of a file on the screen
Basic Linux command • Tail - The tail command writes the last ten lines of a file to the screen. • Grep - grep is one of many standard UNIX utilities. It searches files for specified words or patterns. First clear the screen, then type • wc (word count) - A handy little utility is the wc command, short for word coun • rmdir - remove a directory • Man – most important command, used to get information about commands • whoami – tell about the current user
Basic Commands (cont) • echo • rm – $ echo “Hello World” – $ echo -n “Hello World” • cat – $ cat /etc/motd – $ cat /proc/cpuinfo • cp – $ cp foo bar – $ cp -a foo bar • mv – $ mv foo bar • mkdir – $ mkdir foo • – $ 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 http: //www. cs. ucr. edu/~weesan/cs 183/
Basic Commands • ls – – – • cd • which $ ls -l $ ls -a $ ls -l --sort=time $ ls -l --sort=size -r – $ which ls • whereis – $ whereis ls • locate – $ locate stdio. h – $ locate iostream – $ cd /usr/bin • rpm • pwd – $ rpm -q bash – $ rpm -qa | sort | less – $ pwd • ~ – $ cd ~ • find • ~user – $ cd ~weesan • What will “cd ~/weesan” do? – $ find / | grep stdio. h – $ find /usr/include | grep stdio. h http: //www. cs. ucr. edu/~weesan/cs 183/
Installing software on Linux/Unix Env • Yum - yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories, as well as other third-party repositories. yum is used in Red Hat Enterprise Linux versions 5 and later.
Basic Commands (cont) • Disk usage – $ df -h / • File space usage – $ du -sxh ~/ • Advance stuff – $ ssh eon who – $ ssh eon ‘cd. html ; tar cvfp - cs 183 | gzip -9 c’ | tar xvfpz – $ ssh kilo-1 ‘tar cvfp - /extra/weesan’ | tar xvfp - -C / http: //www. cs. ucr. edu/~weesan/cs 183/
Exercise • Create a linux box on windows using Virtual BOX or VMWare Player. • Practice of the commands.