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

  • Auster@thebrainbin.org
    link
    fedilink
    arrow-up
    3
    ·
    9 days ago

    (Fixed the bolding issue)

    From a file I keep since I started using Linux near 5 years ago:

    Display the RAM usage:
    watch -n 5 free -m
    Useful if you open way too much stuff and/or you’re running on budget processing power, and don’t want your computer freezing from 3 hours.
    Also useful if you use KDE’s Konsole integrated into the Dolphin file manager and you must for some reason not close the Dolphin window. You’d just need to open Dolphin’s integrated Konsole (F4), run the command and without closing it, press F4 again to hide the Konsole.

    Terminal-based file browser that sorts by total size:
    ncdu
    why is the cache folder 50 GB big?

    Mass-check MD5 hashes for all files in the path, including subfolders:
    find -type f \( -not -name "md5sum.txt" \) -exec md5sum '{}' \; > md5sum.txt
    Change md5sum (and optionally the output file’s name) for your favorite/needed hash calculator command.

    For mounting ISOs and similar formats:
    sudo mount -o loop path/to/iso/file/YOUR_ISO_FILE.ISO /mnt/iso

    And unmounting the file:
    sudo umount /mnt/iso
    Beware there’s no N in the umount command

    For creating an ISO from a mounted disc:
    dd if=/dev/cdrom of=image_name.iso

    And for a folder and its files and subfolders:
    mkisofs -o /path/to/output/disc.iso /path/from/input/folder

    Compress and split files:
    7z -v100m a output_base_file.7z input_file_or_folder

    Changes the capslock key into shiftlock on Linux Mint (not tested in other distros):
    setxkbmap -option caps:shiftlock
    Was useful when the shift key from a previous computer broke and I didn’t have a spare keyboard.

    If you want to run Japanese programs on Wine, you can use:
    LC_ALL=ja_JP wine /path/to/the/executable.exe
    There are other options but this is one that worked the better for me so I kinda forgor to take note of them.

    List all files in a given path and its subfolders:
    find path_to_check -type f
    Tip: add > output.txt or >> output.txt if you’d rather have the list in a TXT file.

    Running a program in Wine in a virtual desktop:
    wine explorer /desktop=session_name,screen_size /path/to/the/executable.exe

    E.g.:
    wine explorer /desktop=MyDesktop,1920x1080 Game.exe

    Useful if you don’t want to use the whole screen, there are integration issues between Linux, Wine and the program, or the program itself has issues when alt-tabbing or similar (looking at you, 2000’s Windows games)

    Download package installers from with all their dependencies:
    apt download package_name
    Asks for sudo password even when not running as sudo. Downloaded files come with normal user permissions thankfully. Also comes with an installation script but if you want to run it offline, iirc you need to change apt install in the script for dpkg -i.

    If you use a program you’d rather not connect to the internet but without killing the whole system’s connection, try:
    firejail --net=none the_command_you_want_to_run

    Or if you want to run an appimage:
    firejail --net=none --appimage the_command_you_want_to_run

    If you want to make aliases (similar to commands from Windows’ PATH) and your system uses bash, edit the file $HOME/.bashrc (e.g. with Nano) and make the system use the updated file by either logging out and in, or running . ~/.bashrc

    Python/Pip have some nifty tools, like Cutlet (outputs Japanese text as Romaji), gogrepoc (for downloading stuff from your account using GOG’s API), itch-dl (same as gogrepoc but for Itch.io), etc. If you lack the coding skills and doesn’t mind using LLMs, you could even ask one to make some simpler Python scripts (key word though: simpler).

    If you want to run a video whose codec isn’t supported by your system (e.g. Raspberrian which only supports H.264, up to 1080p):
    ffmpeg -i input_video.mkv -map 0 -c:v libx264 -preset medium -crf 23 -vf scale=1920:1080 -c:a copy -c:s copy output_video.mkv