Unix - Acsu Buffalo

Download Report

Transcript Unix - Acsu Buffalo

Introduction to Unix
1
What is UNIX?
 UNIX is an Operating System (OS).
 An operating system is a control program that
helps the user communicate with the computer
hardware.
 UNIX was developed long before Windows, about
30 years ago at AT&T Bell Labs in the US (95%
written in “C” programming language).
2
What is UNIX?
 Designed as an operating system for experts, used
on high-end workstations, servers and hosts.
 UNIX provides some powerful features:

Security, Multi-user support, Inter-process
communication, Extensive network support
 Windows NT was developed by Microsoft to try to
replace UNIX as the “OS for experts”.
3
Getting Started with UNIX
 You can access these computers with putty from other
computers via the vpn:
ubunix.cc.buffalo.edu
 You need to log in to a UNIX computer with a valid
account and password:
login: zelli
Password:
4
Basic UNIX File Utilities








ls
cat
more
rm
cp
mv
lpr
man
list files in current directory
display (concatenate) file
display one screen of file
remove (delete) a file
copy source file to target file
rename or move a file
print a file
online UNIX help manual
5
Utilities for Finding Info








who
who is logged on where and when
finger additional login information
date
print the date and time
cal
displays a calendar
head
display the first few lines of file
tail
display the last few lines of file
weather
current weather forecast
quota -v
displays user’s disk quota
6
Unix Filesystem
 The filesystem is a hierarchical system of
organizing files and directories.
 The top level in the hierarchy is called the "root"
and holds all files and directories.
 The name of the root directory is
/
7
Directory Shorthands
 “.” is the directory itself
 “..” is the parent directory
 “~” indicates your home directory
 ~user means user’s home directory, so:
> more ~zelli/.plan
 looks at the file .plan in /home/zelli, which
is zelli’s home directory.
8
Some things to try
ls
list files in current directory
ls /
list files in the root directory
ls .
list files in the current directory
ls ..list files in the parent directory
ls /usr
list files in the directory /usr
9
Directory Commands
 pwd
shows current directory
 cd
changes to another directory
 mkdir
creates a directory
 rmdir
removes a directory
 mv
move a file or directory elsewhere
 ls
list files in a directory
10
Security and Permissions
 Use ls -l to view file permissions
 There are four sets of items in the permissions:
-rw-r--r-

The type is:
“-” regular files, “d” directories , “l” symbolic links.
The next nine characters indicate if the file is readable,
writable, or executable for the file owner, the file
group, or other users, respectively.
11
Security and Permissions
 There are three types of users:



The owner of the file (user)
The group of the file (group)
Anyone else (other)
 There are three types of permission
(independent of each other):

Read, Write and Execute
12
Changing Permissions
 The chmod command is used to modify
permissions.
 chmod can only be used by the owner of a
file/dir (or the administrator root).
 The arguments are:
chmod [ugoa] [+-=] [rwxdd] [file/dir]
13
Changing Permissions
 Another way to change permission is to use
numbers representing the permissions.
Code table (3 bits)
--- 0
r--
4
--x 1
r-x
5
-w- 2
rw-
6
-wx 3
rwx
7
14
Other Useful Programs
 pine
program used to read email
 lynx
text based web browser
 ftp
FTP program
 nano
user friendly text editor
 vi
another text editor
 emacs
even another text editor
15