Unix/Linux - Lamar University

Download Report

Transcript Unix/Linux - Lamar University

Unix/Linux
1
Unix History
• Unix History
– Originally developed in 1969 at Bell Labs by Ken
Thompson and Dennis Ritchie
– Berkeley UNIX began in 1977: BSD (Berkeley Software
Distribution)
– Two main directions: BSD and System V
• Some of today’s main Unix versions
– Mostly BSD (4.4BSD-Lite)
• BSD, FreeBSD, Mac OS X
– Mostly SysV:
• Solaris (Sun Microsystems), HP-UX (HP), IRIX (by SGI)
2
Some Unix Versions
3
Unix Basics
• The OS is divided into
– Kernel
– Shell
– Tools & Applications
• Basic Unix features
– Multitasking
– Multiuser
– Portability
• POSIX – Portable Operating System Interface for uniX
– Networking capabilities
4
Unix Basics – Con’t
• These features result in
– Multi-user concepts
•
•
•
•
•
User privilege
File permissions
Process ownership and priorities
Communication with users
Disk quotas
– Superuser account
• Unrestricted access for superuser
• Requires strong authentication
– Security considerations
• Protect user data
• Protect communication
• Protect superuser account
5
Linux
• The Linux kernel was created by Linus Torvalds
• Defines only an OS kernel
• Distributions
– Redhat, SuSE, Debian, TurboLinux…
• Make sure you have a login name and password. Use
passwd to change your password
• If you do not have a graphical user interface, use vi to
edit files
• Documentation is stored on-line, It can be accessed
by the man command
6
Ubuntu Linux
• Various organizations package the Linux
kernel and system programs as Linux
distributions
– SUSE, Fedora, Ubuntu, Debian…
• Canonical Ltd. (www.canonical.com) - the
sponsor of Ubuntu Linux – supports many
similar Linux distributions
–
–
–
–
Ubuntu: GNOME desktop
Kubuntu: www.kubuntu.org, KDE desktop
Edubuntu: www.edubuntu.org: school app.
Xubuntu: www.xubuntu.org: lightweight
7
Tasks of System Admin.
•
•
•
•
•
•
•
•
•
Adding and removing users
Adding and removing hardware
Performing backups
Installing new software
Monitoring the system
Troubleshooting
Maintaining local documentation
Auditing security
Helping user
8
Simple Linux Commands
•
•
•
•
•
•
•
•
•
•
•
•
•
•
date – display the date
ls – list the files in the current directory
more – display files one screen at a time
cat – display the contents of a file
wc – displays lines, words, and characters
cp, mv, rm, pwd, mkdir, cd, rmdir, chmod,
head – show the first few lines of a file
file – determine a file type
tail – show the last few lines of a file
cal – display calendar
kill – terminate a running command
lpr – send a job to the printer
grep – searches a file for a specific pattern
….
9
vi editor
• One of the most powerful editors in
Linux/Unix
• Two different modes:
– Command mode: most of the keys perform the vi
command
– Insert mode: the mode where what you type is
inserted into the document
• When using vi, it is necessary to make
transitions from one mode to the other
10
Booting and Shutting Down – Basic Steps
•
•
•
•
•
•
Load and init the kernel
Detect and config the devices
Create spontaneous processes
Operator intervention (manual boot only)
System startup scripts
Multi-user operation
11
Kernel Initialization
• Kernel is a program
• Path is vendor dependent
– Solaris - /kernel/genunix
– Linux – depends, /vmlinuz, /boot/vmlinuz
• Two stage process
– Boot loader read from disk or tape
– Kernel loaded into memory
12
Bootstrapping
Bootstrap loader (“boot sector”)
1
2
BIOS loader 0x0000100
0x0001000
3
Loader
OS
0x0008000
0x000A000
Primary Memory
4. Initialize hardware
5. Create user environment
6. …
13
Kernel Initialization – Con’t
• Hardware configuration
– Detect and initialize devices built into the kernel
– Probes for additional device info and other devices
• System Processes
– init
– Spontaneous processes
• Boot Loaders
– LILO
– GRUB
• “info grub” on your shell prompt
– Multibooting
14
Kernel Initialization – Con’t
• Startup Scripts
– Location, content, and organization of the startup
scripts varies by the system
– /etc/rc* scripts run programs that start with “S” in
the /etc/rc*.d directories
– /etc/rc*.d startup scripts are usually linked to
scripts in a common /etc/init.d directory
– Example:
• sudo /etc/init.d/networking start
• sudo /etc/init.d/networking restart
15
Starting all the other processes
•
•
•
•
•
Runlevel
0: Brings the system down
1: Brings the system to single-user (S, recovery: /etc/rcS.d) mode
2: Multiuser mode, graphical login, all scheduled system services running
3, 4, 5: Multiuser mode, graphical login, all scheduled system services
running (for system customization, runlevels 2-5 are identical)
• 6: Reboots the system
• Default runlevel:2
16
Rebooting and Shutting down
• halt, reboot, poweroff
• shutdown –h 09:30 “Going down for scheduled
maintenance”
• telinit
– telinit 1: take the system to single-user mode
• Never just turn off a Linux computer. Just like
other OS’s, it needs to be told you want to
finish using it.
17
Ubuntu Software Package
• A software package is the collection of scripts,
programs, files and directories required to
install and run applications, utilies, and system
software
aptitude
• Install and remove package using aptitude
• Examples
– sudo aptitude install tcsh: install tcsh shell
– sudo aptitude install apache2.2-comm
– sudo aptitude remove tcsh
packages
• /etc/apt/sources.list
– Repositories APT (Advanced Package Tool)
searches when asked to find or install a package
– Software sources window
– deb: packages of executable files
– deb-src: packages of source files
packages
• /etc/apt/sources.list
– type URL repository category-list
– Category
• main: Ubuntu-supported open-source software
• universe: Community maintained open-source software
• multiverse: software restricted by copyright or legal
issues
• restricted: proprietary device driver