151

I've been setting up a new Proxmox server and messing around with VMs, and wanted to know what kind of useful commands I'm missing out on. Bonus points for a little explainer.

Journalctl | grep -C 10 'foo' was useful for me when I needed to troubleshoot some fstab mount fuckery on boot. It pipes Journalctl (boot logs) into grep to find 'foo', and prints 10 lines before and after each instance of 'foo'.

you are viewing a single comment's thread
view the rest of the comments
[-] HiddenLayer555@lemmy.ml 9 points 1 day ago* (last edited 1 day ago)

parallel, easy multithreading right in the command line. This is what I wish was included in every programming language's standard library, a dead simple parallelization function that takes a collection, an operation to be performed on the members of that collection, and optionally the max number of threads (should be the number of hardware threads available on the system by default), and just does it without needing to manually set up threads and handlers.

inotifywait, for seeing what files are being accessed/modified.

tail -F, for a live feed of a log file.

script, for recording a terminal session complete with control and formatting characters and your inputs. You can then cat the generated file to get the exact output back in your terminal.

screen, starts a terminal session that keeps running after you close the window/SSH and can be re-accessed with screen -x.

Finally, a more complex command I often find myself repeatedly hitting the up arrow to get:

find . -type f -name '*' -print0 | parallel --null 'echo {}'

Recursively lists every file in the current directory and uses parallel to perform some operation on them. The {} in the parallel string will be replaced with the path to a given file. The '*' part can be replaced with a more specific filter for the file name, like '*.txt'.

[-] InFerNo@lemmy.ml 5 points 1 day ago

I can recommend tmux also as an alternative to screen

[-] ranzispa@mander.xyz 4 points 1 day ago

should be the number of hardware threads available on the system by default

No, not at all. That is a terrible default. I do work a lot on number churning and sometimes I have to test stuff on my own machine. Generally I tend to use a safe number such as 10, or if I need to do something very heavy I'll go to 1 less than the actual number of cores on the machine. I've been burned too many times by starting a calculation and then my machine stalls as that code is eating all CPU and all you can do is switch it off.

this post was submitted on 16 Dec 2025
151 points (98.1% liked)

Linux

57274 readers
692 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS