diff options
author | Jasper Ras <jras@hostnet.nl> | 2025-01-08 10:48:09 +0100 |
---|---|---|
committer | Jasper Ras <jras@hostnet.nl> | 2025-01-08 10:48:09 +0100 |
commit | ed0753ad224f0c65133bd7a63180257eecd9f5e3 (patch) | |
tree | cc662868574fe17db58be9e0faadd452c84dc59c /.trash/3 resources/linux | |
parent | 493be30dc981eaf762a95a1218f96893b1976727 (diff) |
vault backup: 2025-01-08 10:48:09
Diffstat (limited to '.trash/3 resources/linux')
-rw-r--r-- | .trash/3 resources/linux/Watch.md | 1 | ||||
-rw-r--r-- | .trash/3 resources/linux/bootloader.md | 1 | ||||
-rw-r--r-- | .trash/3 resources/linux/filesystems/tmpfs.md | 13 | ||||
-rw-r--r-- | .trash/3 resources/linux/filesystems/virtual filesystem.md | 0 | ||||
-rw-r--r-- | .trash/3 resources/linux/glibc.md | 1 | ||||
-rw-r--r-- | .trash/3 resources/linux/lsof.md | 65 | ||||
-rw-r--r-- | .trash/3 resources/linux/man pages.md | 2 | ||||
-rw-r--r-- | .trash/3 resources/linux/networking/dhcp.md | 4 | ||||
-rw-r--r-- | .trash/3 resources/linux/networking/ip-masquerade-nat.md | 14 | ||||
-rw-r--r-- | .trash/3 resources/linux/networking/nbp.md | 3 | ||||
-rw-r--r-- | .trash/3 resources/linux/networking/pxe-boot.md | 15 | ||||
-rw-r--r-- | .trash/3 resources/linux/networking/udp.md | 0 | ||||
-rw-r--r-- | .trash/3 resources/linux/nic.md | 1 | ||||
-rw-r--r-- | .trash/3 resources/linux/shared anonymous memory mappings.md | 2 | ||||
-rw-r--r-- | .trash/3 resources/linux/system v shared memory.md | 2 | ||||
-rw-r--r-- | .trash/3 resources/linux/tftp.md | 2 |
16 files changed, 126 insertions, 0 deletions
diff --git a/.trash/3 resources/linux/Watch.md b/.trash/3 resources/linux/Watch.md new file mode 100644 index 0000000..dafeb80 --- /dev/null +++ b/.trash/3 resources/linux/Watch.md @@ -0,0 +1 @@ +`watch (1)` periodically executes the executable on argv. It can be used to reload the output of a command, like `sudo watch ovs-dpctl dump-flows` .
\ No newline at end of file diff --git a/.trash/3 resources/linux/bootloader.md b/.trash/3 resources/linux/bootloader.md new file mode 100644 index 0000000..e9c2fff --- /dev/null +++ b/.trash/3 resources/linux/bootloader.md @@ -0,0 +1 @@ +[[TODO]]
\ No newline at end of file diff --git a/.trash/3 resources/linux/filesystems/tmpfs.md b/.trash/3 resources/linux/filesystems/tmpfs.md new file mode 100644 index 0000000..624c835 --- /dev/null +++ b/.trash/3 resources/linux/filesystems/tmpfs.md @@ -0,0 +1,13 @@ +Is a [[virtual filesystem]] that is stored in memory; it uses both RAM and swap space. +> Kernel option: CONFIG_TMPFS + +`mount -t tmpfs source target` + +A tmpfs can only grow to 50% of RAM avail. unless overridden with size=nbytes mount option. +Only consumes RAM for actual usage. +Data is ephemeral/volatile. + +Mount stacking: mount over existing /tmp, to improve speed of apps using alot of tmp files, then unmount to delete data. + +Kernel uses tmpfs for [[system v shared memory]] and [[shared anonymous memory mappings]]. +`/dev/shm` or `/run/shm`: [[glibc]] of [[POSIX]] shared memory and [[POSIX]] semaphores.
\ No newline at end of file diff --git a/.trash/3 resources/linux/filesystems/virtual filesystem.md b/.trash/3 resources/linux/filesystems/virtual filesystem.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.trash/3 resources/linux/filesystems/virtual filesystem.md diff --git a/.trash/3 resources/linux/glibc.md b/.trash/3 resources/linux/glibc.md new file mode 100644 index 0000000..18d18e1 --- /dev/null +++ b/.trash/3 resources/linux/glibc.md @@ -0,0 +1 @@ +The GNU C standard library.
\ No newline at end of file diff --git a/.trash/3 resources/linux/lsof.md b/.trash/3 resources/linux/lsof.md new file mode 100644 index 0000000..e95b968 --- /dev/null +++ b/.trash/3 resources/linux/lsof.md @@ -0,0 +1,65 @@ +``` +lsof -p 1111 # show open files for this PID +lsof /path/to/file # show which process has this open +``` + +A usage in the wild; using lsof to find the qemu process for a specific base image and using that to get instance name and disk path: +``` +lsof -F p {{ item['path'] }} | cut -b 2- | head -1 | xargs ps | grep -oP '(instance\\-[a-z0-9]+)|(\\/var\\/lib\\/nova\\/instances\\/[a-z0-9\\-]+\\/disk)' | uniq +``` + +(man lsof: search "OUTPUT FOR OTHER PROGRAMS") +output for other programs +``` +specify -F +These are the fields that lsof will produce. The single character listed first is the field identifier. + a file access mode + c process command name (all characters from proc or + user structure) + C file structure share count + d file's device character code + D file's major/minor device number (0x<hexadecimal>) + f file descriptor (always selected) + F file structure address (0x<hexadecimal>) + G file flaGs (0x<hexadecimal>; names if +fg follows) + g process group ID + i file's inode number + K tasK ID + k link count + l file's lock status + L process login name + m marker between repeated output + M the task comMand name + n file name, comment, Internet address + N node identifier (ox<hexadecimal> + o file's offset (decimal) + p process ID (always selected) + P protocol name + r raw device number (0x<hexadecimal>) + R parent process ID + s file's size (decimal) + S file's stream identification + t file's type + T TCP/TPI information, identified by prefixes (the + `=' is part of the prefix): + QR=<read queue size> + QS=<send queue size> + SO=<socket options and values> (not all dialects) + SS=<socket states> (not all dialects) + ST=<connection state> + TF=<TCP flags and values> (not all dialects) + WR=<window read size> (not all dialects) + WW=<window write size> (not all dialects) + (TCP/TPI information isn't reported for all supported + UNIX dialects. The -h or -? help output for the + -T option will show what TCP/TPI reporting can be + requested.) + u process user ID + z Solaris 10 and higher zone name + Z SELinux security context (inhibited when SELinux is disabled) + 0 use NUL field terminator character in place of NL + 1-9 dialect-specific field identifiers (The output + of -F? identifies the information to be found + in dialect-specific fields.) + +```
\ No newline at end of file diff --git a/.trash/3 resources/linux/man pages.md b/.trash/3 resources/linux/man pages.md new file mode 100644 index 0000000..576d4b8 --- /dev/null +++ b/.trash/3 resources/linux/man pages.md @@ -0,0 +1,2 @@ +I need to more consistently read man pages. Example is `man task` to see how taskwarrior works, after reading it today I found that it is actually quite easy. +They often contain good information on how to use a certain tool.
\ No newline at end of file diff --git a/.trash/3 resources/linux/networking/dhcp.md b/.trash/3 resources/linux/networking/dhcp.md new file mode 100644 index 0000000..e426d6f --- /dev/null +++ b/.trash/3 resources/linux/networking/dhcp.md @@ -0,0 +1,4 @@ +Dynamic Host Configuration Protocol +Allows hosts dynamically receive an IP address. + +[[TODO]] learn exactly how it works
\ No newline at end of file diff --git a/.trash/3 resources/linux/networking/ip-masquerade-nat.md b/.trash/3 resources/linux/networking/ip-masquerade-nat.md new file mode 100644 index 0000000..8b722f4 --- /dev/null +++ b/.trash/3 resources/linux/networking/ip-masquerade-nat.md @@ -0,0 +1,14 @@ +A function in the kernel that allows guests with internal/private IPs to access the internet by using the hosts' public IP similar to 1 to many NAT. + +Differences with Proxy, IP Masq, NAT: + +**Proxy** +Requires special configuration on internal client side. Can be used for caching. + +**IP Masq** +A form of NAT used primarily in Linux devices. Translates IP address and uses the connection tracking table and ports to map responses back to the internal connection. + +**NAT** +Has different types with different use-cases. +Static NAT: 1-1 mapping of pub/private IP. Dynamic NAT: pool of pub ips to dynamically map private IPs to based on availability. +PAT (Port): similar to IP Masq; 1-many using ports.
\ No newline at end of file diff --git a/.trash/3 resources/linux/networking/nbp.md b/.trash/3 resources/linux/networking/nbp.md new file mode 100644 index 0000000..19676ea --- /dev/null +++ b/.trash/3 resources/linux/networking/nbp.md @@ -0,0 +1,3 @@ +Network Bootstrap Program + +Is a bootloader that is obtained via the network typically via [[TFTP]]. It handles setting up an environment in which an OS can run or install. For example, it displays a boot menu and downloads the kernel images. It sets up hardware, for example the [[NIC]]s.
\ No newline at end of file diff --git a/.trash/3 resources/linux/networking/pxe-boot.md b/.trash/3 resources/linux/networking/pxe-boot.md new file mode 100644 index 0000000..d532ac3 --- /dev/null +++ b/.trash/3 resources/linux/networking/pxe-boot.md @@ -0,0 +1,15 @@ +PXE = Preboot Execution Environment. + +PXE boot process: +1. Modified [[DHCP]] request: request to include boot information (PXE boot request). +2. Process DHCP response which includes an IP address of [[TFTP]] server and filename of [[NBP]]. +3. Download NBP over TFTP. +4. NBP executes + 1. Loads additional stuff over network, like kernel images. + 2. Handles the boot menu +5. Kernel takes over boot process and potentially downloads additional files required to complete booting. + +Popular NBP's: +- PXELINUX +- iPXE +- GRUB2 diff --git a/.trash/3 resources/linux/networking/udp.md b/.trash/3 resources/linux/networking/udp.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.trash/3 resources/linux/networking/udp.md diff --git a/.trash/3 resources/linux/nic.md b/.trash/3 resources/linux/nic.md new file mode 100644 index 0000000..592ad1c --- /dev/null +++ b/.trash/3 resources/linux/nic.md @@ -0,0 +1 @@ +Network Interface Card
\ No newline at end of file diff --git a/.trash/3 resources/linux/shared anonymous memory mappings.md b/.trash/3 resources/linux/shared anonymous memory mappings.md new file mode 100644 index 0000000..71d1cfc --- /dev/null +++ b/.trash/3 resources/linux/shared anonymous memory mappings.md @@ -0,0 +1,2 @@ +[[TODO]] +Linux API book: chapter 49
\ No newline at end of file diff --git a/.trash/3 resources/linux/system v shared memory.md b/.trash/3 resources/linux/system v shared memory.md new file mode 100644 index 0000000..d1f690d --- /dev/null +++ b/.trash/3 resources/linux/system v shared memory.md @@ -0,0 +1,2 @@ +[[TODO]] +Linux API book chapter 48
\ No newline at end of file diff --git a/.trash/3 resources/linux/tftp.md b/.trash/3 resources/linux/tftp.md new file mode 100644 index 0000000..259fdec --- /dev/null +++ b/.trash/3 resources/linux/tftp.md @@ -0,0 +1,2 @@ +Trivial File Transfer Protocol +[[TODO]]
\ No newline at end of file |