Various Linux things
Table of Contents
- related linuxinfra
- docker linuxdocker
-
docker system pruneto cleanup linuxdocker - figuring out what takes disk space
docker images | awk '{print $3}' | xargs docker inspect | lesslinuxdocker - [C] Docker compose port mapping - Stack Overflow linuxdocker
- [B] apt-get clean and other strategies for keeping image size small? · Issue 35 · rocker-org/rocker linuxdocker
- [C] Attach and Detach from Docker Container | HowToProgram linuxdockerdrill
- STRT [C] ctop - cli utility similar to htop for docker containers resource use /r/selfhosted linuxdocker
-
- systemd linuxsystemd
- networking linuxnetwork
- apt linux
- cron linuxcron
- sandboxing linuxsandbox
- udev linuxudev
- [C] Gateway 0.0.0.0 means that the subnet is link-local i.e. there is no gateway involved, the packets are delivered directly to the target linuxnetwork
- ----------------------------------------- linux
- [C] Linux ignores the setuid bit on all interpreted executables (i.e. executables starting with a
#!line). linux - [C] linux - How to make htop sort by PID linux
- [C] logs - View stdout/stderr of systemd service linuxsystemd
- [C] How to read memory usage in htop? - Server Fault linuxdrill
- [D] linux - prevent system freeze/unresponsiveness due to swapping run away memory usage - Super User linux
- [D] guide to XKB linux
- ------------------------------------------- linux
- TODO [C] whereis command linuxhabit
- [C] ip - List ports a process PID is listening on (preferably using iproute2 tools)? - Unix & Linux Stack Exchange linux
¶related linuxinfra
¶docker linuxdocker
¶ docker system prune to cleanup linuxdocker
¶ figuring out what takes disk space docker images | awk '{print $3}' | xargs docker inspect | less linuxdocker
¶[C] Docker compose port mapping - Stack Overflow linuxdocker
If you want to bind to the redis port from your nodejs container you will have to expose that port in the redis container:
version: '2'
services:
nodejs:
build:
context: .
dockerfile: DockerFile
ports:
- "4000:4000"
links:
- redis
redis:
build:
context: .
dockerfile: Dockerfile-redis
expose:
- "6379"
The expose tag will let you expose ports without publishing them to the host machine, but they will be exposed to the containers networks.
¶[B] apt-get clean and other strategies for keeping image size small? · Issue 35 · rocker-org/rocker linuxdocker
ok, so for debian/ubuntu images don't really need autoclean – it's already run automatically
¶[C] Attach and Detach from Docker Container | HowToProgram linuxdockerdrill
In general, to detach from a Docker container and leave it running, we can use the CTRL-p CTRL-q key sequence.
¶STRT [C] ctop - cli utility similar to htop for docker containers resource use /r/selfhosted linuxdocker
¶systemd linuxsystemd
¶debugging: systemctl --failed, journalctl linuxsystemd
logs – for individual jobs you can see them via status (or sdj)
presistent is not showing anythin by default?
¶profiling: systemd-analyze blame linuxsystemd
¶use asserts in unit definitions linuxsystemd
- AssertPathExists fails if the pass is missing or symlink is broken
¶networking linuxnetwork
¶who uses local port linuxnetwork
sudo ss -tulpn | grep 5060 sudo ss -anpt | grep 8640
¶testing if port is open linuxnetwork
netcat -l 5559
one the other machine
echo "TEST" | netcat host 5559
¶ linux - Test if a port on a remote system is reachable (without telnet) - Super User linuxnetwork
Nice and verbose! From the man pages. Single port: nc -zv 127.0.0.1 80
testing if port is open
¶cron linuxcron
¶ if cron fails to start a job, it will send the output to local mail linuxcron
grep cron /var/log/syslog tail -f /var/log/syslog | grep cron
¶ mail subject – use bash comment operator linuxcron
*:* TestJob; cron command
mind the space after colon!
¶sandboxing linuxsandbox
¶docker is excellent for quick sandboxes (just use ubuntu:latest image or something) linuxsandboxdocker
¶firejail for network sandbox linuxsandboxnetworktesting
- doesn't require root!
firejail --noprofile --net=none
¶udev linuxudev
¶udevadm info /dev/sdc2 linuxudev
¶ when you update rules file sudo udevadm control --reload-rules linuxudev
¶ to trigger the target script sudo udevadm trigger linuxudev
¶[C] Gateway 0.0.0.0 means that the subnet is link-local i.e. there is no gateway involved, the packets are delivered directly to the target linuxnetwork
¶----------------------------------------- linux
¶[C] Linux ignores the setuid bit on all interpreted executables (i.e. executables starting with a #! line). linux
ok apparently setuid shell scripts are quite risky…
¶[C] linux - How to make htop sort by PID linux
press > and select RES
¶[C] logs - View stdout/stderr of systemd service linuxsystemd
Note that using the standard logging mechanism like this will not create persistent logs by default. To do that, you'll need to create /var/log/journal, and then run sudo systemctl restart systemd-journald
¶[C] How to read memory usage in htop? - Server Fault linuxdrill
https://serverfault.com/questions/517483/how-to-read-memory-usage-in-htop
Hide user threads (shift + H) and close the process tree view (F5), t
¶[D] linux - prevent system freeze/unresponsiveness due to swapping run away memory usage - Super User linux
If a process demands a lot of memory, the system moves all other process to the swap file. Including it seems, necessary processes like the X11 server or the terminal.
¶[D] guide to XKB linux
¶------------------------------------------- linux
¶TODO [C] whereis command linuxhabit
CREATED: [2021-04-26]
¶[C] ip - List ports a process PID is listening on (preferably using iproute2 tools)? - Unix & Linux Stack Exchange linux
sudo netstat -plnt