/proc
and/sys
are pseudo filesystems; they're kept in memory by the computer the whole time/proc
contains info abt active processes, system hardware, and kernel configuration/dev
is how to access hardware devices/sys
contains info abt the hardware devices in/dev
pstree
: shows parent/child processes' relationshipps
: shows current processes running in the current shell--forest
: shows a tree viewaux/-ef
: shows all running processes-u
: show process by user (ps -u root
)
top
: show live system processes feedbackK
: terminate the process (9 == SIGKILL)R
: adjust priority of process (-20 to 19)
uptime
//proc/loadavg
: cpu load over past (1, 5, 15) minutes- load avgs are proportional to number of CPU cores --> 1.12 on a 4-core is 28% loaded
- kernel space: kernel code is stored and executed in a "protected" range of memory addresses and remains isolated from other processes with lower privileges
- user space: available to all users and programs and communicate with the kernel through "system call" API
- seperating these memory address like so provides protection, giving the Linux kernel stability -- hence the saying linux is "safer"
/var/log
: location of log filessyslog
: generic meaning whichever daemon is in place- daemons:
syslogd
w/klogd
,rsyslogd
, andjournald
/journalctl
- binary files
file
: describes the data type (text vs. data (binary))- binary files have their own tools to open:
journalctl
,lastb
, andlast
Filesystem Hierarchy Standard (FHS)
-
/
: base/root (first hierarchy) -
/bin
: essential binaries -
/boot
: files necessary to boot the system, such as kernel, etc. -
/dev
: files that represent hardware devices and other special files (/dev/null
or/dev/random
) -
/etc
: host config files -
/home
: user home directories -
/lib
: libraries for/bin
//sbin
-
/lib64
: essential libraries built for a specific architecture -
/media
: automatically mounted removable media -
/mnt
: manually mounted temporary filesystems -
/opt
: optional third party software install location -
/proc
: virtual filesystem for the kernel to report process information -
/root
: home directory of the root user -
/sbin
: essential binaries for the root user -
/sys
: virtual filesystem for information about connected hardware -
/srv
: location where site-specific services may be hosted -
/tmp
: temporary files that should be cleared at boot time (accessible by all users; often isnt actually cleared) -
/usr
: non-essential files for shared user use (second hierarchy) -
/usr/local
: files for software not originating from distribution (third hierarchy) (often contains user compiled source code) -
/var
: files that change over time (fourth hierachy) -
/var/cache
: files used for caching application data (fifth hierarchy) -
/var/log
: most log files -
/var/lock
: lock files for shared resources -
/var/spool
: spool files for printing and mail -
/var/tmp
: temporary files to be preserved between boots -
sub-hierarchies repeat the pattern of many of the key directories found under the first hierarchy