Linux Fundamentals

Useful to know (when you forget where new things get installed)

PathDescription
/The top-level directory is the root filesystem and contains all of the files required to boot the operating system before other filesystems are mounted, as well as the files required to boot the other filesystems. After boot, all of the other filesystems are mounted at standard mount points as subdirectories of the root.
/binContains essential command binaries.
/bootConsists of the static bootloader, kernel executable, and files required to boot the Linux OS.
/devContains device files to facilitate access to every hardware device attached to the system.
/etcLocal system configuration files. Configuration files for installed applications may be saved here as well.
/homeEach user on the system has a subdirectory here for storage.
/libShared library files that are required for system boot.
/mediaExternal removable media devices such as USB drives are mounted here.
/mntTemporary mount point for regular filesystems.
/optOptional files such as third-party tools can be saved here.
/rootThe home directory for the root user.
/sbinThis directory contains executables used for system administration (binary system files).
/tmpThe operating system and many programs use this directory to store temporary files. This directory is generally cleared upon system boot and may be deleted at other times without any warning.
/usrContains executables, libraries, man files, etc.
/varThis directory contains variable data files such as log files, email in-boxes, web application related files, cron files, and more.

Explainshell may be useful if something gets proper donked.

sudo apt update && sudo apt upgrade -y is your best pal

And sudo apt autoremove

Otherwise some combination of -h --help or just a bare command with no arguments churns out all kinds of info without delving into man pages.

EG: git --help

pwd is “where am I?”

apropos is probably gonna be super useful. Kinda finds all the instances of the search term in available commands (if I can’t recall the specific name of a command, but think it exists) EG: apropos usb will spit out:

bhp-config_usb_printer (1) - HP device config us… ipp-usb (8) - Daemon for IPP over USB … lsusb (8) - list USB devices sane-canon630u (5) - SANE backend for the Can… sane-canon_lide70 (5) - SANE backend for the Ca… sane-cardscan (5) - SANE backend for Corex C… sane-epjitsu (5) - SANE backend for Epson-b… sane-find-scanner (1) - find SCSI and USB scann… sane-genesys (5) - SANE backend for GL646, … sane-gt68xx (5) - SANE backend for GT-68XX… sane-kvs1025 (5) - SANE backend for Panason… sane-kvs20xx (5) - SANE backend for Panason… sane-kvs40xx (5) - SANE backend for Panason… sane-ma1509 (5) - SANE backend for Mustek … sane-mustek_usb (5) - SANE backend for Mustek … sane-mustek_usb2 (5) - SANE backend for SQ113 b… sane-pieusb (5) - SANE backend for USB-con… sane-plustek (5) - SANE backend for LM983[1… sane-sm3600 (5) - SANE backend for Microte… sane-sm3840 (5) - SANE backend for Microte… sane-u12 (5) - SANE backend for Plustek… sane-usb (5) - USB configuration tips f… usb-devices (1) - print USB device details usb_modeswitch (1) - control the mode of 'mul… usb_modeswitch_dispatcher (1) - Linux wrapper f… usb_printerid (1) - prints the ID of the pri… usbhid-dump (8) - dump USB HID device repo… usbip (8) - manage USB/IP devices usbipd (8) - USB/IP server daemon usbmuxd (8) - Expose a socket to multi… usbreset (1) - send a USB port reset to

Ok, hackthebox is a bit too particular on its quizzes. “bin/bash” and “bash” were incorrect. “/bin/bash” was the right answer. Frustrate.

Mused that Linux is a bit like lockpicking. You get things in just the right order and magic happens. Or you try what feel like the same thing over and over and eventually it works. I’m not sure what macOS/windows would be in this tortured analogy. I guess that’s much like anything when learning though. Expertise goes up, jiggling things around til they work goes down, one supposes.

dpkg vs apt.

dpkg is more “low level”

but that’s the .deb files (or.rpm) from downloading.

dpkg doesn’t pick up any dependencies automatically.

APT=advanced package tool

Will fix things that dpkg “broke”. Higher level.

Fetches dependencies automagically.

Wise to run apt update before installing anything.

That’s answered that then. update refreshes the list of stuff my install “knows” exists, upgrade etc actually installs/updates software.

sudo apt remove [package] to “delete” stuff. This won’t get rid of any user data.

sudo apt purge [package] will get rid of user data

Snap is another package manager. More like a store.

sudo snap install or sudo snap install --classic and name of package. EG I now have vs code courtesy of sudo snap install --classic code!

Pip is Python’s package manager. pip or pip3

Ruby has Gems. gem install

Aptitude is fancy

And our old pal git.

Git to download stuff, the actual installation might require running python or something from the cloned folder.