Tải bản đầy đủ (.pdf) (24 trang)

Tài Liệu - Võ Tấn Dũng (votandung) Unit1 Linux ITC new

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.7 MB, 24 trang )

Information Technology College of HoChiMinh city
Faculty of Information Technology

Course: Fundamentals of Linux OS

Unit 1

Linux Introduction
Lecturer: Võ Tấn Dũng

/>

Before Linux
• In 80’s, Microsoft’s DOS was the dominated OS for PC
• Apple MAC was better, but expensive
• UNIX was much better, but much, much more expensive.
Only for minicomputer for commercial applications
• People was looking for a UNIX based system, which is
cheaper and can run on PC
• Both DOS, MAC and UNIX were proprietary, i.e., the source
code of their kernel is protected
• No modification is possible without paying high license fees

VÕ TẤN DŨNG


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)
• Some other variants: System V, Solaris, SCO Unix, SunOS,
4.4BSD, FreeBSD, NetBSD, OpenBSD, BSDI,…

VÕ TẤN DŨNG


Beginning of Linux





A famous professor Andrew Tanenbaum developed
Minix, a simplified version of UNIX that runs on PC
Minix is for class teaching only. No intention for
commercial use
In Sept 1991, Linus Torvalds, a second year student of
Computer Science at the University of Helsinki,
developed the preliminary kernel of Linux, known as
Linux version 0.0.1

VÕ TẤN DŨNG


After that…
–Soon

more than a hundred people joined the Linux camp.
Then thousands. Then hundreds of thousands

–It was licensed under GNU General Public License, thus
ensuring that the source codes will be free for all to copy,
study and to change.
–Linux has been used for many computing platforms: PC,
PDA, Supercomputer,…
–Not only character user interface but graphical user interface
is available
–Commercial vendors moved in Linux itself to provide freely
distributed code. They make their money by compiling up
various software and gathering them in a distributable format

VÕ TẤN DŨNG


Linux Today
• Many 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.)
And now, ANDROID of Google

VÕ TẤN DŨNG


Variety of Linux Shell







Shell interprets the command and
request service from kernel
Similar to DOS but DOS has only
one set of interface while Linux
can select different shell
– Bourne shell (bash)
– Korn shell
– C shell
Different shell has similar but different functionality
Bash is the default for Linux
Graphical user interface of Linux is in fact an application
program work on the shell

VÕ TẤN DŨNG


The File System




Linux supports many file-systems: ext, ext2, ext3, xia, minix,
umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs,
affs,…
Common Linux Subdirectories:

VÕ TẤN DŨNG


Some important directories














The starting point (/) is called the root directory.
/usr: contains executable commands, system administration utilities,
and library routines.
/etc: contains system configuration files
/home: contains the user‘s home directory.
/dev: contains files which are pointers to device names.
/root : the root user's home directory.
/bin : important Linux commands available to the average user.
/boot : the files necessary for the system to boot.
/lib : contains system libraries.
/mnt : contains mount points. When you temporarily load the contents
of a CD-ROM, USB drive or a HDD partition, you typically use a
special name under /mnt.
/sbin : contains essential commands that are only for the system
administrator.
VÕ TẤN DŨNG


Log in your Linux system










You must have a user account on the system to log in. The user

account is defined in the /etc/passwd file.
The “root” account is the system administration account.
File /etc/passwd : each entry in this file is made up of seven fields
separated by a colon.
Placeholder, that is /etc/shadow file, it maintains the field for
the password. The /etc/shadow file contains encrypted
passwords .
These two files can only be read by the system administrator.
Example: #cat /etc/passwd OR #cat /etc/shadow

VÕ TẤN DŨNG


Log in, log out
• Start up your computer, then type in your username and
password:

– login: (type in your username here)
– password: (type in your password here)
• If you want to log out your Linux current session, using exit
command or key-combination <Ctrl-D>:
– exit
– <ctrl-D>

VÕ TẤN DŨNG


Changing User Password
• Using passwd command for changing the user password.


$ passwd
Changing password for cis1.
Old password:
New password:
Retype new password:
Hashed database not in use,
only /etc/passwd text file updated.
$

VÕ TẤN DŨNG


Test who are logging in
• whoami, tells you who is currently logging in to a
terminal.
$ whoami
user1
$

• To see more details about the user who is currently
loging in to a terminal, type the command “who am i” as
follows
$ who am i
user1
pts/4
$

Mar 3 08:40

(172.18.10.22)


VÕ TẤN DŨNG


Current log-in users
• The who command, will tell you who are log-in right now.

$ who

jlp tty0 sep 20 10:05
you tty2 sep 22 10:34
host name

If #, that means user
root. If $, that means
regular user (not user
root)

[root@redhat9 tmpdocs]#

current user

current working directory
VÕ TẤN DŨNG


Viewing hostname
• hostname command displays the name of the host
computer you have logged into.


$hostname
redhat9
$
• To change the host name:

$hostname <type in a new name here>

VÕ TẤN DŨNG


Shutdown your Linux system


Some CLI commands to shutdown your Linux: halt, poweroff,
reboot, shutdown, init 0

Examples:
#shutdown -r 5 “It will be rebooted in 5 minutes!”
#shutdown -h 3 “Your system will be turned off in 3 minutes“
#shutdown -r now
#reboot
#init 0
#halt
#poweroff

VÕ TẤN DŨNG


Using runlevel





A runlevel is a mode of operation of the Linux OS, that
provides a particular set of services.
File : /etc/inittab
Using init command to switch between levels.

VÕ TẤN DŨNG


Displaying Man Pages
• Use the man command to display on-line man pages for
commands.
Command Format
man <name-of-a-command>
Example:
$ man cd
Reformatting page. Wait... done
CD(1)
Linux User’s Manual
CD(1)
NAME
cd, chdir, pushd, popd, dirs - change working directory
SYNOPSIS
/usr/bin/cd [ directory ]
sh
cd [ argument ]



SEE ALSO
csh(1), ksh(1), pwd(1), sh(1), chdir(2), attributes(5), environ(5)

(END)

VÕ TẤN DŨNG


Scrolling in Man Pages


Use the following keys to control the scrolling capabilities
while using the man command:

VÕ TẤN DŨNG


Command-Line Syntax
At the shell prompt, you can type commands.
Commands are instructions which tell the system to
perform an action.
The general format for Linux commands is:
#command [option (s)] [argument[s]]

VÕ TẤN DŨNG


Command-Line Syntax (cont.)
Examples:


ls -a -l /etc/mydir
useradd -u 503 -g sales alan
mkdir -p /mnt/ docs/xls/priv
cp -i sales.doc /mydoc
cat /mnt/ploppydisk/baitap.txt
head -6 /usr/dict/words
tar -xvf /home/backup.tar

VÕ TẤN DŨNG


Some Linux’s commands
mkdir – make directories
ls – list directory contents
cd – changes directories
pwd print name of current working directory
cp – copy files and directories
mv – move (rename) files
rm remove files or directories
find – search for files in a directory hierarchy
history – prints recently used commands
cat – concatenate files and print on the standard output
echo – display a line of text
wc print the number of newlines, words, and bytes in files
sort – sort lines of text files
su – change user ID or become superuser
zip – package and compress (archive) files
fdisk – partition manipulator
VÕ TẤN DŨNG



Control Characters
Control characters are used to perform specific tasks such as
stopping and starting screen output. When displayed on the
screen, the Control key is represented by the caret symbol (^). To
enter a sequence of control characters, hold down the Control key
and press the appropriate character on the keyboard.

VÕ TẤN DŨNG


END OF UNIT 1
• remember to do your homework
(see />
VÕ TẤN DŨNG



×