Filesystem
Boiled down:
pathnames |
system directories |
links |
chmod |
touch |
pwd |
cd |
mkdir |
mv |
cp |
ls - l |
rmdir |
ln |
who am i |
setfacl |
getfacl |
Hierarchical File System
Directories vs. Files
Filenames
- Letters, digits, -, period, comma
- 255 characters was old limit
- Absolute path names
- Relative path names
- Hidden files, . and ..
- File Commands
- make a directory - mkdir
- Change to a directory - cd
- List files in a directory - ls
- Display working directory - pwd
- Remove a directory - rmdir
- mv, cp, ls revisited
- change file permissions - chmod
Typical Unix directories
- See pages 91 - 93
- /etc
- /var
- /usr
- /tmp
- /sys
Permissions for chmod
- u: user, g: group, o: other, a: all
- r: read, w: write, x: execute
- s: setuid permissions. When you run a setuid program, take on the permissions of the owner of the file.(u+s).
- Setgid: set group id (g+s), get permissions of the group.
- Directory permission
-
x: user can cd and ls a file if the name is known
-
r: can read the contents of the directory (ls all files)
-
w: can create new files in the directory and rm
Links
- Pointer to a file, not a copy (a nickname)
- Used to give others access. You give them read and execute access as necessary, they crete the link
- 2 different types of links
- Hard Links - not across file systems, super-user. Not used much
- Symbolic Links - indirect pointer, can link directories
Hard links
- ln existing-file new-link
- File exists as long as 1+ hard link exists
Symbolic Links
- ln -s
- rm file and symbolic link not usable, but still there
- When cd ing to symbolic link, ksh reports (via pwd) that your directory is the link; csh and bourne report the name of the original directory
- Built-in variable cwd contains the link directory when you cd to it
All work herein is subject to copyright. Original content to Dr. Deborah Whitfield, text content (Practical Guide to Linux) to Prentice Hall publishing.