110 likes | 287 Views
CS311 – Lecture 02 Outline. Common Unix/Linux utilities File/Directory Permissions Unix/Linux Features Note: These lecture notes are not intended to replace your notes. This is what I expect your notes to look like, but with more explanation as needed. 1. How the shell "finds" the command.
E N D
CS311 – Lecture 02 Outline Common Unix/Linux utilities File/Directory Permissions Unix/Linux Features Note: These lecture notes are not intended to replace your notes. This is what I expect your notes to look like, but with more explanation as needed. CS311 – Operating Systems 1 1
How the shell "finds" the command 3 steps: Step 1: check builtins Step 2: did user enter a path? Step 3: use PATH CS311 – Operating Systems 1 2
Utility: ls list directory content -a: do not ignore entries starting with . -l: use a long listing format CS311 – Operating Systems 1 3
More Utilities pwd: print name of current/working directory which: shows the full path of (shell) commands. cat: takes its input from standard input or from files, then displays them to standard output. echo: display a line of text mkdir: make directories cd: change directory chmod: change file access permissions CS311 – Operating Systems 1 4
Side-note: File and Directory Lecture 02 • Directories are files, too • Directories named . and .. • . current directory • .. parent directory CS311 – Operating Systems 1 5 5
Even More Utilities mv: move (rename) files cp: copy files and directories rm: remove files or directories rmdir: remove empty directories wc: print the number of newlines, words, and bytes in files groups: print the groups a user is in newgrp: log in to a new group chgrp: change group ownership CS311 – Operating Systems 1 6
File Permissions • Octal numbers • 741 -> 111 100 001 -> rwx for owner, r for group, x for world • 654 -> 110 101 100 -> rw for owner, rx for group, r for world • chmod 751 myDir • owner can ls, add files, and search the directory for a file • group can ls and search the directory for a file • world can search the directory (but cannot ls to see what else is there) CS311 – Operating Systems 1 7
File Permissions (cont.) • Unix/Linux filesystem security is achieved via 2 mechanisms: • file ownership • file permissions CS311 – Operating Systems 1 8
Filename wildcards * matches 0 or more characters in a filename* can be used alone. E.g.: chmod 700 * ls ?????will list all files that have 5 character filenames. CS311 – Operating Systems 1 9
Output redirection > Sends output to the file listed after the > instead of to stdout (usually the monitor). If the file listed after the > does not exist, it is created. If it does exist, it is overwritten. CS311 – Operating Systems 1 10
Other features up arrow – history tab completion CS311 – Operating Systems 1 11