linux basics (part 1)
TRANSCRIPT
PowerPoint Presentation
Linux Basics
Part 1
OSU Picture Greg Keene
Introductions
Lance Albertson
Greg Lund-Chaix
source: http://shesawake.com/
Goals for this Talk
Linux Overview
Linux distributions
System overview
More detail: permissions, processes, package management, services
GREG
Ask audience about their experience level.
Linux Overview
Unix-like operating system
Free, open source software
Runs servers, desktops, phones, tablets, network equipment and more.
GREG
History of UNIXGNU/BSD
Linux Statistics
Supercomputers
More than 90% of thetop 500
Number of distributions
More than 350
Number of developers
1,000 developers contributed in 2010
Number of commits to linux kernel last year
195,579 commits in 2010
GREG
Supercomputers source: http://www.top500.org/overtime/list/32/osDistro count:http://futurist.se/gldt/Number of devs & commits:http://www.linuxfoundation.org/docs/lf_linux_kernel_development_2010.pdf
covers 2.6.11 though 2.6.35
1 commit every 3 minutes, 24/7/365
Linux Distributions
Packaging of applications around a Linux kernel
Different distributions have different target audiences
Distribution lifecycles vary
source: http://www.guilfordlug.org
LANCE
Common Linux Distributions
Fedora / RedHat Enterprise / CentOS
Debian / Ubuntu / Mint
Gentoo / Arch
source: http://www.guilfordlug.org
LANCE
Fedora RHEL rpm based. 18mo. Release cycle for fedora, X years of support for each major RHEL version
Debian Ubuntu deb based. Debian is community based, Ubuntu is based off of debian, targets ease of use for end-user. Has short and long-term supported releases
Gentoo ebuild based, much more customizable, but can be more difficult to deploy/maintain
Choosing a Distribution
Server/desktop/other
Existing infrastructure
Admin experience
Support contract
Release supported lifetime
LANCE
Fedora RHEL rpm based. 18mo. Release cycle for fedora, X years of support for each major RHEL version
Debian Ubuntu deb based. Debian is community based, Ubuntu is based off of debian, targets ease of use for end-user. Has short and long-term supported releases
Gentoo ebuild based, much more customizable, but can be more difficult to deploy/maintain
Linux System Overview
source:wikipedia
LANCE
bash: Bourne Again SHell
Default shell on Linux
Originally based off of the Bourne Shell (sh)
Learn it, live it, love it
GREG
Bash is the default shell on Linux machines
Explain architecture: built in commands vs. external binaries
Quick overview of filesystem, ie. Full vs. relative paths
Basic bash commands
ls *.txtfile1.txt file2.txt file3.txt
ls *.txt > list
for i in `cat list`; do cp "$i" "$i".bak ;done
ls *.txt*file2.txt file1.txt.bak file2.txt file2.txt.bak file3.txt file3.txt.bak
GREG
Demo commands:Directory movement and file manipulation: Cd, pwd, ls, rm, mv, touchUser info: id, whoami, w
Pipes, redirection (pipe.txt, redirect.txt)
Special variables: $?, $$ (pid.sh), !!, !*, !$
Documentation
Most packages include man pages for documentation
More extensive than the --help flag on CLI
Stored in different 'sections'
Picture Flickr user 'bobeirasa'
GREG
Users and Groups
Users and groups are stored in /etc/passwd and /etc/group
Each user name and group name is linked to a number (UID/GID)
UID 0 = root
0-99 typically used for system/service accounts
GREG
File Permissions
Three roles: user (file owner), group, other (world)
Three permissions: read, write, execute
Picture Flickr user 'amagil'
GREG
root user
root user = full access to everything on the system
sudo, su change user
Don't use root user unless you have to!
Comic: http://xkcd.com/149/
GREG
Components of a process
PID: Process ID number
PPID: Parent PID
UID & EUID: real & effective user ID
GID & EGID: real & effective group ID
Niceness
Control terminal
LANCE
Signals
Sent to procs as communication
Sent to terminal driver to kill, interrupt, or suspend
Sent by admin to kill
Sent by kernel
Picture Flickr user 'atomicshark'
LANCE
Signals: Types you should know
HUP, INT, QUIT, KILL, BUS, SIGV, TERM, STOP, TSTP, CONT, WINCH, USR1, USR2
Can catch, block, or dump core?
BUS & SEGV error signals
KILL & STOP cannot be blocked
WINCH term emulators
LANCE
ps: monitor processes
primary tool for monitoring processes
differ between UNIX's
show PID, UID, priority, control term, memory, status, etc
complex over the years, archaic
pstree
LANCE
top: monitor in real-time
big picture in real time
refreshes every 2-3 seconds
kill, renice, sort, memory, etc.
htop even better
color, prettier, more configurable
Picture United Artists from 'Hackers'
LANCE