November 5, 2015CIS 118 Intro to UNIX What’s a Unix? Unix is an Operating System Designed for...
Transcript of November 5, 2015CIS 118 Intro to UNIX What’s a Unix? Unix is an Operating System Designed for...
April 20, 2023 CIS 118 Intro to UNIX
What’s a Unix?
• Unix is an Operating System
• Designed for high-traffic usage
• Many variants– Linux, BSD: free versions
• Spelled either Unix or UNIX
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
Multi-Computer, Multi-User
Servers
Clients
April 20, 2023 CIS 118 Intro to UNIX
The Shell
Person
Operating System
SHELL
User types commands into shell
Run progra
m
Shell translates commands to machine code
1100101
0110010
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
Interesting Commands
• Communication– write– mail– talk
• Useful– man– who– date– cal
• Printing– lpr– printer rm# file
• Network– ping– traceroute– nslookup– hostname
April 20, 2023 CIS 118 Intro to UNIX
E-mail Commands
• mail: read/send mail
• pine: read mail
• forwardmail: forward mail
• blockmail: block mail
• procmail: proc[ess] mail
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
What’s on your server?
• List users online– users– who– last [user]– finger [user]
• FAS-specific– ph [full name]– rwho [user]
• What are people doing?– w– ps [aux]
• Managing your own processes– fg/bg– kill [process #]
April 20, 2023 CIS 118 Intro to UNIX
Communicating on UNIX
• write user[@machine]: send a one-way message
• talk user[@machine]: have a conversation
• mesg [y | n]: let people talk to you
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
Hierarchical File System
b in
b in lo ca l
u sr e tc
a b
cd u an
d e
c
h o m e
/
/home/c/d/cduan
April 20, 2023 CIS 118 Intro to UNIX
Remote Home Directories
home05
home06
home07
is01
is02
smtp
webmail
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
File System Commands
• Browsing commands
• File Manipulation Commands
• File Viewing/Editing Commands
April 20, 2023 CIS 118 Intro to UNIX
File Browsing
pwd print working directory
% pwd/home15/c/d/cduan
cd change directory
cd .. up 1 directory
% cd /usr/bin% pwd/usr/bin
ls list files
ll “long” listing
% lsfile1 file2 file3file4 file5 file6
April 20, 2023 CIS 118 Intro to UNIX
File Manipulation
• mv: move file(s)– mv file1 file2 rename file1 to file2– mv [file…] dir move files to directory
• cp: copy file(s)
• rm: remove file(s)
• mkdir: create a directory
• rmdir: remove a directory
April 20, 2023 CIS 118 Intro to UNIX
File Viewing/Editing
• cat, more, less, head, tail: view (parts of) files
• grep word [file…]: find words in files
• vi: edit files (see tutorial)– Or use that pico program
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX
• Basic Concepts
• Common Commands
• Multi-User Functions
• File System– Structure– Commands– Security
UNIX>_
April 20, 2023 CIS 118 Intro to UNIX
File System Security
Problem: multiple users, one machine
1. How do we keep data private?
2. How do we make data public?
3. How do we make data partially public?
April 20, 2023 CIS 118 Intro to UNIX
File System Security
Solution: UNIX permissions scheme
• Three levels of people– Self, group, others
• Three levels of protection– read, write, execute
April 20, 2023 CIS 118 Intro to UNIX
File Permission Types
Level For Files For Directories
read Able to read file contents
Able to list files in
directory
write Able to modify file contents
Able to create/
remove files
execute
Able to run file as a program
Able to use files in
directory
April 20, 2023 CIS 118 Intro to UNIX
User Permission Levels
• Self: yourself
• Group: members of pre-defined system groups (student, ua, etc.)– Generally not treated specially
• World: every user on the system
• Root can read/write everything!
April 20, 2023 CIS 118 Intro to UNIX
Viewing File Permissions: ll
-rwxr-xr-x 1 cduan ua ...
self grou
p
world
owner
group
read
write execut
e
No write permission for world
April 20, 2023 CIS 118 Intro to UNIX
Changing Permissions: chmod
Level Self Group World
read 4 4 4
write 2 2 2
execute 1 1 1+
chmod 755 [file…]
April 20, 2023 CIS 118 Intro to UNIX
Common chmod Values
Private file
Private directory
Public file
Public directory
Public directory, no listing files
600
700
644
755
711
April 20, 2023 CIS 118 Intro to UNIX
Using UNIX: Final Remarks
• Where to get help– man pages– Internet– User Groups