UNIX File Basics

  1. Files live on a filesystem
    1. ext4 -- The default Linux file system, very like other UNIX filesystems
    2. NFS -- The network file system, for sharing files across a net.
    3. ISO9960 -- The file system used on most CD-ROMS.
    4. VFAT (msdos or win95) -- The file system used by Microsoft
    5. NTFS (Windows NT) -- Still being developed.  Works read-only for sure.
    6. /proc -- Files that describe the state of the Linux kernel
      1. Reading tell the user the state
      2. Writing sometimes changes the state
      3. This is a Linux specific thing, most UNIX's don't have this.
      4. The numbers are processes
        1. Within each process are cmdline, cwd, exe, mem, status, and others
      5. The normal filenames are global trates (loadavg,  cpuinfo, etc)
    7. Filesystems have metadata
      1. Space available, space used, mount point
      2. Options like nosuid, noexec, read-only
  2. Files have a type
    1. Normal file
    2. Hard link -- two files with the same name
    3. Soft link - like a shortcut in Win95
    4. Directory
    5. Device special files
      1. Represent physical devices
      2. Have a major number (type of device) and a minor number (instance of device)
      3. The device file can exist without the device being present (maybe this will change in the future)
  3. Files have metadata
    1. Name
    2. Size
    3. ctime, atime
    4. Owner, group
    5. Permissions
      1. Based on a user/group/other scheme.
      2. Both files and dircs have a read/write/execute
      3. X for dirs means list  the directory
      4. Don't need 'r' for executables (execuatables you can run but not copy)
    6. There is no equivilent to 'system' or 'hidden'.
    7. SUID means run as the owner, not as the user typing the command
  4. Legal file names
    1. Legal is different from reasonable
    2. Legal is any char and up to 255 chars long
    3. Reasonable is avoid ' ', &, *, ?,; and the control chars.
    4. All filenames starting with '.' are not shown ina default directory listing
    5. Filenames like .\t\tpirate can be used to hide ftp sites from the ftp owner or his boss.
    6. The filename ".." means the directory above.