If you have any suggestions or criticisms, feel free to comment them.

Being plain text, it’s much easier to read on a wide screen, or on something without line wrapping.

  • BaumGeist@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    Alt + . inserts the last argument from the last command run into the current line. I find it helpful all the time.

    less can be invoked directly, without having to be piped from cat: less is mostly equivalent to cat | less
    I have considered making an alias/function that automatically determines if the file is longer than the terminal, using something like wc -l and stty -a | grep -oP "rows \d" and then either uses cat or less depending on that… but I already use sharkdp’s bat, which has that baked in as well as many other conveniences

    Don’t forget tail -f which is kind of like watch tail

    If you’re going to have du, I would also have a section for df, I use the latter more often (but probably because I have like 5 mounts for my OS). Using them in combination is basically what all the gui disk usage analyzers do; something like df -h “oh, /var’s almost full” (as previously mentioned, I have different folders on different partitions), then du -ah /var and so on to find problem areas

    The “installing from source” section works maybe 50% of the time. It assumes a configure script, which isn’t always the case. I’ve had a lot of source that comes bundled the way a .deb does: basically a compressed filesystem that assumes the $CWD is / (basically, if you uncompressed it in /, all the files would go where they needed to be). Sometimes they use language-specific build systems, so you might need go and rust and… Maybe it’s best to just keep it your way and look up the rest, but do keep in mind the thing I said about compressed filesystems

    find is great if you want to reindex everything from square 0; or if you only need to do small directory/tree. If you have the extra space to spare, install locate: it indexes the files beforehand (as a cron job) and yields results more quickly for searches that span entire filesystems; the only downside is that you have to manually reindex (sudo updatedb) to locate files installed the same day

    In the Extracting, Sorting, and Filtering Data section, you might consider adding in sort -u and uniq which fill their own (overlapping) niches. sed and awk may be a bit more than beginner, but they are endlessly helpful. tr can be a useful shorthand for when cut and sed don’t quite cut it, but you don’t want to build a full in-line awk script.

    Finally:

    2>&1 | Output and errors from are redirected and appended to

    Should read "Output and errors from are redirected to " because the single > overwrites the existing file, as opposed to >> which, as you noted, appends to the end of the file

  • jjjalljs@ttrpg.network
    link
    fedilink
    arrow-up
    0
    ·
    10 months ago

    Nice work.

    My tiny nitpick is that “touch” will create the file you specify if it doesn’t exist. I’ve seen this usage a lot, so your example may benefit from mentioning it.

    • asciiandarch@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      10 months ago

      Done? I’ve never uploaded to GitHub before, and I was just doing what I thought I should do. I’ll do my best to keep it updated with the version on my website.

      https://github.com/ordinarybyte/linux_cheat_sheet

      Is there a way to make GitHub automatically detect changes to the file at cerium.cc and update the repo? Or do they not allow that? I know a scheduled script would be able to work but I don’t really want to have to run it myself.