file systems sources and resources: 1. a students guide to unix, by hahn 2. paula davidson’s...

22
File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIX

Upload: rebecca-arnold

Post on 26-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

File Systems

Sources and Resources: 1. A Students Guide to UNIX, by

Hahn2. Paula Davidson’s

Handout on UNIX

Page 2: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Internet Applications:telnet For Remote Login telnet remote_host_name

Internet application Used to login to a remote computer Allows your expensive PC to look like a

dumb glass tty or asynchronous terminal

At UNCA, you will use telnet to login to the servers:

bulldog.unca.edu candler.cs.unca.edu or busbee.cs.unca.edu

Page 3: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Internet Applications:ftp For Moving Files ftp remote_host_name

Internet application Used to move files to or get files from

a remote computer At UNCA, you will use ftp to move files

to and from the servers bulldog.unca.edu candler.cs.unca.edu or

busbee.cs.unca.edu

Page 4: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

UNIX File System Hierarchical Contains files

Text files Special files

Standard I/O – Keyboard, Display Device files

Directories

Page 5: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

File Structure - Hierarchical

Page 6: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Paths Relative

newDirectory

newDirectory/myFiles/homework1.doc

Absolute/HOMEDIR/faculty/bruce/newDirectory

/HOMEDIR/faculty/bruce/newDirectory/myFiles/homework1.doc

What directory are you in?The command: pwd

Page 7: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands mkdir Make a directory

mkdir newDirectory Makes a new directory named newDirectory as a child of the current directory

Page 8: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands rmdir Remove a directory

rmdir newDirectory Removes a directory named newDirectory.

If specified as a relative path (not beginning with a /) the directory to be removed must be in the current working directory.

Page 9: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands ls List contents of a directory

ls newDirectory Lists the contents of newDirectory

ls Lists the contents of the current working

directory ls –a

Lists all the contents of the current working directory, even the hidden files

Page 10: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands ls List contents of a directory

ls –l Lists all the contents of the current

working directory in a long listing which displays the file permissions as well as the owner, group, size in bytes, modification date

Page 11: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands cd Change directory

cd // sets current working directory// to your home directory

cd otherDirectory

// sets current working directory

// to otherDirectory

Page 12: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands cd Change directory

cd .. // sets current working directory// to the parent directory or

moves // one level up the hierarchy

cd ../..

// sets current working directory

// to 2 levels up the hierarchy

Page 13: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Commands mv Move or rename a file

mv file1.txt file1.html // renames file1.txt to file1.html

mv file1.txt newDirectory/file1.html// moves file1.txt to

newDirectory/file1.html

Page 14: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

To do1. telnet into your account using SSH2. List the contents of your home

directory. What directories exist in your home directory?

3. Change directories into your public_html directory.

4. Change back to your home directory.5. Change to the root directory.

Page 15: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

To do

6. Change to the root directory.7. Change back to your home

directory.8. Create a subdirectory called junk9. Change into junk and create two

subdirectories: j1 and j2.10. Remove j1, j2 and junk.

Page 16: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

File Permissions The various flavors of UNIX including

LINUX and OS/X store permissions for every file.

There are three independent permissions Read Write Execute

You can change permissions for your files.

Page 17: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

File Permissions for Directories The various flavors of UNIX including LINUX

and OS/X store permissions for every directory.

There are three independent permissions Read - read names in a directory Write - make changes (create, move, copy, remove) Execute - search the directory (cd into it)

You can change permissions for your directories.

Page 18: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Permissions: an octal representation

chmod permissions file Read: 4 100 Read + Write: 6 110 Read + Execute: 5 101 Read + Write + Execute: 7 111

Write: 2 010 Write + Execute: 3 011 Execute: 1 001

Page 19: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

chmod permissions file Each file has three sets of permissions Permission modes exist for you your_group world

rwx rwx rwx

n chmod 777 myWideOpenFilen chmod 744 myOtherFilen chmod 700 mySecretFile

Page 20: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

Displaying File Permissions ls -l-rw-r--r-- 1 mmasuser staff 20788 15 Dec 14:14 Adobe SVG

3.0 Installer Log

drwx------ 19 mmasuser staff 646 21 Jan 14:53 Desktop

drwx------ 21 mmasuser staff 714 16 Jan 15:13 Documents

drwx------ 29 mmasuser staff 986 11 Nov 14:09 Library

drwx------ 17 mmasuser staff 578 27 Nov 19:55 Movies

drwx------ 4 mmasuser staff 136 9 Oct 13:52 Music

drwx------ 5 mmasuser staff 170 19 Dec 19:27 Pictures

drwxr-xr-x 4 mmasuser staff 136 9 Oct 13:30 Public

drwxr-xr-x 5 mmasuser staff 170 9 Oct 13:30 Sites

Page 21: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

In class What are the file permissions for

public_html? Change directories into your

public_html directory. Create a new directory named 179.

4. Create 3 subdirectories of 179: project1, project2, and homework.

Page 22: File Systems Sources and Resources: 1. A Students Guide to UNIX, by Hahn 2. Paula Davidson’s Handout on UNIXHandout on UNIX

In class Move index.html,your style file,

and any other files referenced by index.html into your 179 directory.

Go to the student work page linked from the class syllabus. Make sure the link to your class page works!