General Info
Things that I find neat or wish I'd known earlier
pwd -Pto avoid symlinks from obscuring the true full path of the current working directory.diff -u file1 file2for unified diff - great for patchesheadshows the first 10 lines of a file.- Shell variables are not passed to programs that the shell runs. However, Environment variables are. Example:
FOO=bar # shell variable
export FOO # makes it an environment variable
- The order of adding directories to
$PATHactually matters. The shell looks through the directories in order. This means that, adding your new directory to the beginning of the path makes the shell look in it first. man -k <keyword>lets you search for a manpage by keyword.- manpages have sections.
ping(8)<-8is from the sectionSystem commands and servers. I finally know what the numbers mean :) - Redirect standard output and error using
command > file 2>&1 - Useful
psflags:
ps u # more info
ps w # show full command, no truncation
ps x # all of my running processes
ps ax # all running processes, not just mine
kill -lshows mapping of signal numbers to names.jobscommand shows any suspended processes.nohupallows processes to live when the terminal gets killed.- Useful absolute permission modes:
| Mode | Used for | User | Group | Other |
|---|---|---|---|---|
| 644 | files | rw | r | r |
| 600 | files | rw | - | - |
| 755 | directories, programs | rwx | rx | rx |
| 700 | directories, programs | rwx | - | - |
| 711 | directories | rwx | x | x |
-
Note how the directories are being given execute permissions. This is because you can list the contents of the file, if it is readable, but you can only access a file in a directory, if the directory is executable.
-
The kernel is generally a binary file
/vmlinuzor/boot/vmlinuz. The boot-loader loads this during system boot. However,/lib/modulescontain modules calledloadable kernel modulesthat the kernel loads and unloads on demand.