Introduction to UNIX donna Bair-Mundy. What is UNIX? Applications OperatingSystem Hardware.
-
Upload
kenneth-armstrong -
Category
Documents
-
view
234 -
download
0
Transcript of Introduction to UNIX donna Bair-Mundy. What is UNIX? Applications OperatingSystem Hardware.
Operating system functions
Keeps track of types and
locations of hardware
Intermediary between applications and hardware
Maintains directory of files
Manages how data is stored
Allocates memory to programs
User instructions to operating system
When to run a program
Creating and naming directories
Copying files between directories or onto disks
Setting access permissions
Unix operating system% lsmyfile.txtyourfile.txt%
Command-line interface
Utilities—programs to list files, tell who is on the system, what processes are running, etc.
Editors—use to create HTML files for Web portals
1subdirectory
18subdirectory
24subdirectory
UHUNIX file structure
binsubdirectory
Rootdirectory
homesubdirectory
usrsubdirectory
johndHome directory
donnabHome directory
nahlHome directory
Basic UHUNIX commandspwdpwd print working directory
tells you where you are in the file hierarchy
lsls listlists files and subdirectories
cdcd change directoryMoves you up or down in the file hierarchy
chmodchmod change modeAssigns access rights to files and directories
More UHUNIX commandsmanman manual
man + command provides access to electronic help files
cpcp copycp sourcefile destinationfile copies the source file to a file with the destination file name
rmrm remove fileDeletes a file
mkdirmkdir make directoryCreates a new directory
What files and directories do I have: ls (list files)
aardvark.txtmailmyfile.txtpublic_htmlwhatsup.doc%
% ls
The "all files" option: ls -a
.
..
.addressbook
.cshrc
.inbox
.login
.logout
.pinerc
% ls.signature.ssh2aardvark.txtmailmyfile.txtpublic_htmlwhatsup.doc
%
-a
The "long' option: ls -l
% ls-rw------- 1 donnab 47616 May 8 11:59 aardvark.txtdrwx------ 2 donnab 3584 Apr 10 2002 mail-rw------- 1 donnab 45927 May 8 11:59 myfile.txtdrwxr-xr-x 5 donnab 1024 Mar 20 13:51 public_html%
-l
ls -la
Changing my working directory: cd (change directory)
cd change directory% cd public_html
% pwd
/home/18/donnab/public_html
% cd fun/images
% pwd/home/18/donnab/public_html/fun/images
%
Changing my working directory: cd
cd change directory% cd public_html
fun
donnab
public_html mail
images html files
Changing my working directory: cd
cd change directory% cd fun/images
fun
donnab
public_html mail
images html files
Changing to a higher-level subdirectory: cd ..
cd ..%pwd
/home/18/donnab/public_html/fun/images
%
/home/18/donnab/public_html/fun/
%
/home/18/donnab/public_html/
% cd /bincd /bin
cd ..%pwd
Note space preceding dots
Changing my working directory: cd
cd change directory% cd ..
fun
donnab
public_html mail
images html files
Changing access rights to a file or directory: chmod (change mode, part 1)
% ls -l-rwx------ 1 donnab 47616 May 8 11:59 myfile.txt
drwxr-xr-x 5 donnab 1024 Mar 20 13:51 public_html
%- r w x r w x - - - - - -
ownerowner groupgroup publicpublic
Changing access rights to a file or directory: chmod (change mode, part 2)
% ls -l-rwx------ 1 donnab 47616 May 8 11:59 myfile.txt
drwxr-xr-x 5 donnab 1024 Mar 20 13:51 public_html
%
r w x r - x r - xr w x r - x r - xowner group public
chmod 755 myfile.txt% ls -l-rwxr-xr-x 1 donnab 47616 May 8 11:59 myfile.txt
drwxr-xr-x 5 donnab 1024 Mar 20 13:51 public_html
Changing access rights to a file or directory: chmod (change mode, part 3)
%
-rwxr-xr-x 1 donnab 47616 May 8 11:59 myfile.txtdrwxr-xr-x 5 donnab 1024 Mar 20 13:51 public_html
%
rwx r-x r-x
owner group public
chmod 755 myfile.txt
111 101 1017 5 5
%
Getting help: man command
manUser Commands
chmod(1)NAME chmod - change the permissions
mode of a fileDESCRIPTION chmod changes or assigns the mode
of a file. The mode of a file specifies its permissions and other attributes. …
chmod
%
Getting help: man -k
manaccess access (3f) - return access mode (r,w,x) or
existence of a filecggglm cggglm (3p) - solve a general Gauss-Markov
linear model (GLM) problem chmod chmod (3f) - change mode of a filedggglm dggglm (3p) - solve a general Gauss-Markov
linear model (GLM) problem f77_ieee_environment f77_ieee_environment (3f) -
mode, status, and signal handling for IEEE arithmeticfegetprec fesetprec (3m) - control floating point
rounding precision modes
-k mode | more
%
Making back-ups: cp (copy)
cp
% lsmyfile.txtmyfilebk.txt
my file.txtmy_file.txt
myfile.txt myfilebk.txt
%
Deleting a file: rm (remove)
rmrm
% lslsmyfile.txtmyfilebk.txt
% lsmyfile.txt
myfilebk.txtmyfilebk.txtrm: remove myfilebk.txt (yes/no)? y
%
Creating a new subdirectory: mkdir (make directory)
mkdirmkdir
% ls -lls -ldrwx------ images-rwx------ myfile.txt
% chmod 755 imageschmod 755 images
imagesimages