Upload
alnamron
View
250
Download
0
Embed Size (px)
Citation preview
7/30/2019 Lecture 1 - Linux Refresher
1/15
Linux RefresherFall 2013
1
7/30/2019 Lecture 1 - Linux Refresher
2/15
Topics
Linux Overview
Linux distributions
System overview
More detail: permissions, processes, package management,
services
2
7/30/2019 Lecture 1 - Linux Refresher
3/15
Linux Overview
Unix-like operating system
Free, open source software
Runs servers, desktops, phones, tablets, network equipment
and more.
3
7/30/2019 Lecture 1 - Linux Refresher
4/15
Linux Distributions
Packaging of applications around aLinux kernel
Different distributions havedifferent target audiences
Distribution lifecycles
Suse, Fedora, RedHat Enterprise,CentOS, Debian, Ubuntu, Mint,Gentoo, Arch
Quick Stat:
~ 94% ofthe worlds top 500supercomputers run some variant ofLinux (including the 10 fastest)
4
7/30/2019 Lecture 1 - Linux Refresher
5/15
Choosing a Distribution
Server/desktop/other
Existing infrastructure
Admin experience
Support contract
Release supported lifetime
5
7/30/2019 Lecture 1 - Linux Refresher
6/15
The Kernel
Computer program that manages
input/output requests from
software
Translates requests into data
processing instructions for thecentral processing unit and other
electronic components
Fundamental aspect of all modern
OSs
6
http://localhost/var/www/apps/conversion/tmp/scratch_4//upload.wikimedia.org/wikipedia/commons/8/8f/Kernel_Layout.svg7/30/2019 Lecture 1 - Linux Refresher
7/15
Users and Groups
Users and groups are stored in /etc/passwd and /etc/group
User passwords are stored in /etc/shadow
Each user name and group name is linked to a number
(UID/GID)
UID 0 = root
0-99 typically used for system/service accounts
root user = full access to everything on the system
sudo , su switch user
Don't use root user unless you have to!
Common commands:
useradd, usermod, userdel, passwd, chage, groupadd
7
7/30/2019 Lecture 1 - Linux Refresher
8/15
Linux Directory Structure
Filesystem Hierarchy Standard (FHS)
Shareable vs. Unshareable
Static vs. Variable
Common commands:
cd
ls
pwd
touch
rmdir
rm
cp
ln (hard and soft links)8
7/30/2019 Lecture 1 - Linux Refresher
9/15
File Permissions
Every file
Is owned by someone
Belongs to a group
Has certain access permissions for owner, group, and others
The long version of a file listing (ls -l) will display the file
permissions:
9
-rwxrwxr-x 1 rvdheij rvdheij 5224 Dec 30 03:22 hello
-rw-rw-r-- 1 rvdheij rvdheij 221 Dec 30 03:59 hello.c
-rw-rw-r-- 1 rvdheij rvdheij 1514 Dec 30 03:59 hello.s
drwxrwxr-x 7 rvdheij rvdheij 1024 Dec 31 14:52 posixuft
Permissions
Owner
Group
7/30/2019 Lecture 1 - Linux Refresher
10/15
Changing File Permissions
Use the chmod command to change file permissions
The permissions are encoded as an octal number
Three roles: user (file owner), group, other (world)
Three permissions: read, write, execute
10
chmod 755 file # Owner=rwx Group=r-x Other=r-x
chmod 500 file2 # Owner=r-x Group=--- Other=---
chmod 644 file3 # Owner=rw- Group=r-- Other=r--
chmod +x file # Add execute permission to file for all
chmod o-r file # Remove read permission for others
chmod a+w file # Add write permission for everyone
http://linux.com.hk/man/showman.cgi?manpath=/man/man1/chmod.1.inchttp://linux.com.hk/man/showman.cgi?manpath=/man/man1/chmod.1.inc7/30/2019 Lecture 1 - Linux Refresher
11/15
Linux Device Handling
11
Devices are the way linux talks to the world
Devices are special files in the /dev directory (try ls /dev)
/dev/hdb IDE hard drive
/dev/hdb1 Partition 1 on the IDE hard drive
/dev/mnda VM Minidisk
/dev/dda Channel Attached DASD
/dev/dda1 Partition 1 on DASD
/dev/null The null device (hole)
/dev/zero An endless stream of zeroes
/dev/mouse Link to mouse (not /390)
7/30/2019 Lecture 1 - Linux Refresher
12/15
Editors / Shell Scripting
Vim Three modes (Command/Insert/Extended)
Environment variables ( e.g. PATH)
Variables Direct assignment, prompt, positional
Exit status codes (success -> 0)
Conditional statements
Case statements
Looping
Displaying contents of files
12
7/30/2019 Lecture 1 - Linux Refresher
13/15
Backup and Recovery
System backups are important! (e.g. /etc, /home)
Tar utility
Cpio
Compression (e.g. Gzip)
Scheduling (Cron)
13
7/30/2019 Lecture 1 - Linux Refresher
14/15
Installing and Managing Software
YaST
RPMs
Many advantages:
Dependency checks
preinstalltion tasks
Conflicts
Unpacking
postinstallation
14
7/30/2019 Lecture 1 - Linux Refresher
15/15
Documentation
Most packages include man pages for documentation
More extensive than the --help flag on CLI
Stored in different 'sections'
15