The Unix File System
What are the three parts of every file on a Unix filesystem? And where is each stored? Filename - stored in directories Inode - stored in an inode table Data – stored in data blocks on the storage media
What Unix command allows us to view the contents of directories? ls
What is kept in a Unix directory in addition to the names of files? What command is used to see this information? Inode numbers ls -i
Give four useful options to the ls command. ls -F- distinguishes directories from ordinary files ls -l- long listing, includes inode info. ls -a- shows hidden files as well ls -d- shows inode info. of a directory
What information about a file is kept in the inode that you can view in a long listing (ls –l)? Type of file (directory, ordinary, etc.) File Permissions Link count Owner of the file Group (gid) of the file Size of the file Modification date of the file (and other dates) Pointers to where the data of the file is located
What Unix command prints out your current working directory? What is the name of that directory when you log in? pwd Your home directory
What Unix command can change your current working directory? What does this command do if you give it no arguments? cd With no arguments, the cd command makes your home directory your current working directory.
What two files are in every Unix directory, and why don’t they normally show up with the ls command?. and..(dot - the current directory and dot-dot - the parent directory) they are hidden files
Give an example of an absolute pathname and a relative pathname. Absolute pathname: /home/CIS90/guest/letter Relative to: Home directory: letter The root directory: home/CIS90/guest/letter
What option to the ls command lets you see a long listing of a directory file? ls -ld
Unix filenames do not normally tell you whether a file is a program, directory, text, data, etc. What Unix command can you use to find a file’s type? file …
What are the three special characters used by the shell to collectively access groups of files? What are the pattern matching characteristics of each? 1.* - matches any number of characters, including none 2.? - matches one and only one character 3.[] - matches any one of the characters contained within the brackets
What are two reasons you may want to use these filename expansion characters? To access groups of files with common extensions or prefixes To save typing long file or directory pathnames; you need type only the characters that uniquely specify that file, followed by the *