Where Is Everything Notes

Filesystem Hierarchy:

 * root filesystem:
 * Refers to '/', the top level of the directory structure (aka base). Use family tree as metaphor.


 * home/:
 * Where individuals store their personal files and settings.


 * root/:
 * Where the root user stores its personal files and settings. Explain some about what the root user is.


 * boot/:
 * A folder containing the kernel, its related files, and the bootloader's related files -- this is what is essential to begin the bootstrap


 * etc/:
 * Where all system level config files and setting should go (passwd, network/interfaces, X11 stuff), as well as the system startup scripts (init.d, rc?.d).


 * dev/:
 * Contains files that coorespond to physical or virtual hardware that the kernel is aware of or of the potential of (like hda for the primary master drive, or ttyS0 for the COM1 serial port (as well as a bunch more tty*s for virtual terminals), as well as resonably named aliases (like modem and cdrom).


 * mnt/:
 * Where temporary filesystem mountings should happen, such as over nfs, or drives you just put in. Often takes the role of media. History of physically mounting tape reels.


 * floppy/:
 * Where debian mounts the floppy drive.


 * cdrom/:
 * Where debian mounts the cdrom drive.


 * bin/:
 * A folder that holds all the vitally necessary executable programs for users on running a linux system (like 'ls' and 'rm').


 * sbin/:
 * A folder that holds programs vitally necessary for running linux, but which should only be run by the super user and system tools (like 'ifconfig').


 * lib/:
 * Where all the vital commands keep their needed libraries. (like dlls)


 * lib/modules/:
 * Where kernel modules go.


 * usr/:
 * This has a deep structure which to some part mirrors the root filesystem, and is meant to be the install location for programs and libraries which are not vitally necessary for the system to minimally boot up (like X/gui progs, aumix, &c.).


 * usr/local/:
 * This mirrors the root filesystem yet again, and is used for when the system administrator installs something from scratch as opposed to installing via the package management system.


 * tmp/:
 * A folder for holding temporary files that will be deleted after they've been there for too long.


 * var/:
 * A folder for extra files, like log files, databases, web pages or undelivered mail. Throw in history of files with unknown size.


 * opt/:
 * A folder some applications use to store files, but without as much structure as to what to keep here or how.


 * proc/:
 * A folder with pretend files for all the running processes, providing information about what is currently happening, as well as a few files for information about the running hardware (cpuinfo, pci, interupts). proc does not exist on all unices -- the files are dependent on the mounting of proc, a special device. This will be its own class on a later day.

Searching:

 * locate/updatedb:
 * `locate word` will find all places where 'word' is, but it takes having run `updatedb` recently, usually once a day as a cron job. "updatedb" can only be run as root.


 * find:
 * Find is really powerful and complicated, but doing `find / -iname \*word\*` is the same as `locate word`, only it takes a lot longer. better is to do `find /a/sub/directory -iname word`, as that will take less time.


 * which/whereis:
 * `which command` will tell me where the command is (so like `which ls`)
 * `whereis command` will tell me the same, as well as where all of the command's man pages are.


 * cd:
 * There are special directory names that are always around. '.' is whatever directory you're in right now (so `cd .` does absolutely nothing). '..' is one directory above your current location (and '../../..' is three higher). '~' means the home directory of whoever you currently are. The 'cd' command also has some special behavior: `cd` by itself is like `cd ~`. `cd -` will take you to the last place you were before the last time you changed directories.


 * $PATH:
 * This is a list of directories (so '/bin:/usr/bin' is '/bin' and '/usr/bin') that the command line and which and whereis (and tab competion) look to find programs i can run without filling in their whole name (so i can run `ls` instead of `/bin/ls`). To see this, you have to type echo $PATH

Help:

 * man:
 * `man command` usually gives a manual page for a command on how to use it and who wrote it and stuff.There should be a class on how to read man pages.


 * help options:
 * `command --help` usually give a little description of how to use the command. Also, -H and -h sometimes. --help is the standard for all GNU commands, which are frequently not used on BSD systems so commands like tar will frequently not give you much info when you run tar --help on a bsd system.


 * help:
 * `help command` will give little description of how to use the builtin shell functions (for, alias, &c.).


 * info:
 * Some commands use info instead of man. It's weird to use, but has the same basic information.


 * apropos:
 * `apropos word` searches through all the man pages' one line descriptions for 'word'. Useful if i know what i want to do, but forget exactly how to do it.


 * /usr/share/doc:
 * Some programs put extra documentation and manuals in this directory.On debian, all packages are required to have documentation here.

howtos:

 * http://linuxdoc.org has a huge manual on how to do things in linux (so like "how do i use a modem" or "how do i compile a kernel"), also known as 'the linux documentation project' or 'the howtos'.

Software:

 * apt-cache search:
 * `apt-cache search word` searches through the on disk database of software packages i can install onto my system with 'word' in its name or description.


 * packages.debian.org:
 * This website searches through an online database of all possible packages to be installed (useful for knowing which debian system to use to get a certain package).


 * freshmeat.net:
 * For software that isn't in a debian package, this is a good place to look, as searches are ordered in terms of recent updates.


 * sourceforge.net:
 * For a more thorough compilation, sourceforge.net has most open source projects.


 * Other distros:
 * Most other linux distributions offer similar ways to search for software. Check with each one to find out how.

Other:

 * dpkg -L/-S:
 * `dpkg -L package` will list out all the files that were installed when the package was installed. `dpkg -S /absolute/path/to/filename` searches for the package that installed that particular file.


 * w/finger/who:
 * `who` shows who's logged in. Many servers do not have this installed.
 * `finger` is another useful command where it is installed, and is remote-capable. The remote version of finger is considered a security hole because it allows an attacker to determine who uses a computer.
 * `w` show who's logged in and what they're doing.


 * lsof:
 * This gives a list of all 'open files' - files that somebody or program has opened and is either reading from or writing to it.`lsof -i` lists only those 'files' that are related to the IP network.


 * lsmod:
 * This lists all modules loaded by the kernel (like device drivers).


 * lspci:
 * This lists all the known pci cards and devices. Use `lspci -v` to learn more than i want to know.


 * dmesg:
 * This lists all the messages that happened at boot. Grep'ing this for isa is useful.