Download presentation
Presentation is loading. Please wait.
1
Tools of Web Development 1: Module C: Using Unix
2
Goals Understand the roles of an operating system.
Understand the difference between command-line and GUI. Understand some basic Unix commands.
3
What is an Operating System?
It is software. Controls the relationship between all applications and hardware. Controls the relationship among applications.
4
Command Line Operating Systems
Use letters with symbols, such as C:\>. Instructions must be typed. High rate of error – typos! Some examples of command line operating systems include DOS and Unix.
5
GUI Operating Systems GUI - Graphic User Interface
Include pictures with descriptive words (icons) Much easier to move the pointer with the mouse and click on a picture, than to remember commands. Examples of GUI operating systems include Windows and MAC OS.
6
So, What Does an OS Do? Controls the INPUT, OUTPUT, and PROCESSING activities for the computer High-quality O/S can make your computer more effective and efficient A good OS makes the computer easier to use.
7
The Roles of an OS A Traffic Cop A Communication System A Box of Tools
A Self-Starter
8
A Traffic Cop Controls the resources of the computer, including memory, file storage, and CPU. Multitasking (the ability for more than one application to “run” at once) is possible on new computers.
9
A Communications System
Helps all of the hardware components communicate with each other. Helps applications communicate with the hardware. Helps applications communicate with one another.
10
A Toolbox Several utility programs are included with an O/S including File Management, Memory Management, and Networking Tools.
11
A Self-Starter The OS takes over just after booting.
Checks to see all hardware is present. “Hard Boot” – turning off the computer and then back on “Soft Boot” – restarting the computer without turning it off first.
12
Unix Developed by Bell Labs in 1969 Command-Line OS
Offered File Sharing Offered Process-Sharing
13
Introducing Unix Commands
Issue commands from a command prompt: phoenix{jstudent}/: Unix is case sensitive! Commands are typed in lowercase: cp (copy) is NOT the same as Cp or CP
14
Unix Shells Unix has a number of shells which help the user interact with the Operating System Kernel (the main program that stays resident in memory and executes OS commands). Some shells include the Bourne shell, Korn, Bash, TCSH and Csh (“C-schell”, used on the CS Phoenix Server).
15
Command Syntax Case sensitive! All commands are lowercase
General Format: command [switches] arg1 arg2 Switch Command Arguments
16
Command Example Example: ls –l *.html Switch Command Argument
17
Correcting Typographical Errors
DEL key removes the character to the left (in some Telnet clients, BACKSPACE will also do this) To erase: C-w – Erases previous word C-u – Erases an entire line
18
Directory Structures Unix paths begin with a forward slash
The initial forward slash (/) represents the root directory Typically, only the system administer has full privileges to the root directory
19
Directory Paths An absolute path begins at the root: /home/jstudent/public_html/ A relative path indicates location relative to your present working directory: ../images/
20
More on Directories The command pwd will return the directory name in which you are currently working The directory that represents your personal section of the server is called your home directory
21
Directory Notation / - represents a directory
/. – represents the current directory /.. – represents the parent directory /~ - represents a user’s home directory
22
Creating Directories Don’t use spaces in directory names.
Use _ (underscore character) or camelCasing to name directories. Directory names are case sensitive (usually in lowercase, with camel casing).
23
Creating a Directory Use the mkdir command: mkdir campingImages
Name of the directory Command
24
File & Directory Permissions
ls –l command will show full details, including file name, owner name, modification date, size and permission sequence.
25
d rwx r-x r-x Unix Permissions
Permission sequence found at the beginning of a directory listing (first 10 characters): d rwx r-x r-x Owner’s Permissions Group’s Permissions World’s Permissions Directory?
26
d rwx r-x r-x Unix Permissions
The first character represents whether the listing is a directory. If it is a directory, a “d” will appear in the first character; otherwise, you should normally see a dash (-). d rwx r-x r-x
27
Unix Permissions The remaining nine characters are divided into three triplets. The first triplet represents the owner’s permissions. The second is the group’s permissions. The third triplet represents the World’s permissions.
28
Read Permission 1st position in a triplet: r stands for Read; grants permission to view the contents of a file or directory (Value is ‘r’ or ‘-’).
29
Write Permission 2nd position in a triplet: w stands for Write; grants permission to modify a file or the contents of a directory (Value is ‘w’ or ‘-’).
30
Execute Permission 3rd position in a triplet: x stands for eXecute; grants permission to run an application or open a directory (Value is ‘x’ or ‘-’).
31
Unix Permissions When changing permissions, we must first decide what number will represent the permissions for a triplet. We can do this by determining whether or not a permission is turned on or off. If turned on, a permission gets a value of 1; if turned off, it gets a value of 0.
32
Unix Permissions After deciding whether the three permissions in a triplet are on or off, we will have a binary number We can convert the binary number to its octal equivalent
33
Unix Permissions Permissions Binary Octal - - - 0 0 0 - - x 0 0 1 1
- - x 0 0 1 1 - w - 0 1 0 2 - w x 0 1 1 3
34
Unix Permissions Permissions Binary Octal r - - 1 0 0 4 r – x 1 0 1 5
r w - 1 1 0 6 r w x 1 1 1 7
35
The chmod Command Once you’ve established the octal number representing the permission for each triplet, you can then use the change mode (chmod) command to give a directory or file proper permissions
36
chmod Syntax & Example Syntax: chmod permissionMask file/dir
Example: chmod 755 public_html Typically, directories and executable files are given “755” permissions, while other files are given “644” permissions
37
Navigating Unix To move from directory to directory, we use the cd command Syntax: cd path/
38
Navigating Unix To move from a child to a parent directory: cd ..
39
Navigating Unix To move from a grandchild to a parent directory: cd ../..
40
Navigating Unix To move from one child to a sibling directory: cd ../child2
41
The List Command The list command (ls) shows the contents of a directory We can add switches to the list command to modify what the command can do To use more than one switch, concatenate them: ls -lt
42
List Command Switches ls –l shows files in long format, including permissions ls –a shows hidden files ls –c shows file listings in a column format ls –t sorts file listings by last modified date
43
Using Wildcards with ls
ls a* Wildcard, All files starting with 'a' ls *a* All filenames with 'a' in them ls *a*html All filenames with 'a' in them and ending with html ls ????? - All 5 character filenames
44
Using Wildcards with ls
ls [abc]* - All filenames starting with a, b, or c ls [a-c]* - Same as above but done as a range ls [^a-c]* - All filenames not starting with a, b, or c
45
The Unix Copy Command cp can be used to make a copy of a file, leaving the original file untouched Syntax: cp oldfile [path/]newfile
46
The Unix Copy Command To make a copy of a file while both the original and copy are in the same directory: cp index.html home.html
47
The Unix Copy Command To make a copy of a file that results in the copy retaining the original’s name, but is housed in a different directory: cp index.html ../academic/
48
The Unix Copy Command To make a copy of a file that results in the copy having a new name and is housed in a different directory: cp index.html ../academic/home.html
49
The Unix Move Command The mv command has two purposes:
To move files from one directory to another To rename files Syntax: mv oldfile newpath/[newfilename]
50
The Unix Move Command To move a file from one directory to another: mv index.html ../friends/
51
The Unix Move Command To rename a file (stays in the same directory): mv index.html home.html
52
The Unix Move Command To move a file and rename it at the same time: mv index.html ../friends/home.html
53
Deleting Files Use rm to delete files Syntax: rm filename
54
Deleting Files To delete a single file: rm index.html (answer Y to confirm delete) To delete multiple files using a wildcard: rm *.html (answer Y to confirm delete for each file)
55
Deleting Directories Use rmdir to delete directories
DIRECTORY MUST BE EMPTY!!!! Syntax: rmdir directoryname To delete a directory: rmdir images/ (answer Y to confirm delete)
56
Other Useful Commands passwd – Password utility that allows users to update their passwords exit – End your Unix session (you can also use bye on Phoenix)
57
Other Useful Commands clear – Gives you a blank screen (you can also use cls on Phoenix) who – Lists users currently logged in to the server
58
Other Useful Commands finger username – Retrieves information about a user cal – Displays a calendar of the current month date – Displays the current system date
59
Other Useful Commands !! – (pronounced “bang bang”) repeats the last command ![a..z] – Repeats the last command beginning with selected letter (a-z)
60
Other Useful Commands |more – Added to commands which display lists to force page stops (Ex: ls –lt |more) C-z – Temporarily stop a process
61
Other Useful Commands fg – Bring a process to the foreground after it has been stopped vacation – Turn on the autoreply for pine – Launch the Pine client emacs – Start the Emacs editor
62
Online Manual Eight Sections Commands System calls File formats
Library functions Devices and device drivers File formats Games Miscellaneous System maintenance
63
Using man man command To lookup help on the cp command: man cp
To lookup help on the ls command: man ls C-c exits the manual.
64
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.