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’.

  • eli@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    15 hours ago

    There are a lot of great commands in here, so here are my favorites that I haven’t seen yet:

    • crontab -e
    • && and || operators
    • “>” and >> chevrons and input/output redirection
    • for loops, while/if/then/else
    • Basic scripts
    • Stdin vs stdout vs /dev/null

    Need to push a file out to a couple dozen workstations and then install it?

    for i in $(cat /tmp/wks.txt); do echo $i; rsync -azvP /tmp/file $i:/opt/dir/; ssh -qo Connect timeout=5 $i “touch /dev/pee/pee”; done

    Or script it using if else statements where you pull info from remote machines to see if an update is needed and then push the update if it’s out of date. And if it’s in a script file then you don’t have search through days of old history commands to find that one function.

    Or just throw that script into crontab and automate it entirely.