Giddy, excited, curious and nervous all at the same time.

Let’s loosen that grip of adobe, microsoft and soon I hope apple too. :-)

Edit: Just hope I’m doing this right…

  • u/lukmly013 💾 (lemmy.sdf.org)
    link
    fedilink
    English
    arrow-up
    7
    ·
    24 hours ago

    Welcome.

    Don’t blindly copy-paste commands from the web (on any OS).

    If someone gives you commands check the man page to figure what it actually does.
    Let’s say some prankster gives you a command to “free up wasted disk space”: sudo rm -rf --no-preserve-root /

    sudo let’s you execute commands as root (similar to “run as Administrator” on Windows), so let’s skip to rm

    man rm let’s you view the manual, though you can also use the internet. There’s also info pages, but I always just get confused by those.

    To quit press q. Now let’s see what the stuff does. -rf are 2 short options which could also be written as -r and -f. Though confusingly some commands use single hyphen for long options too…

    Anyway, let’s search for it. Slash searches forward, question mark backwards. n goes to next find, N to previous.
    On top you see

    NAME
           rm - remove files or directories
    
    SYNOPSIS
           rm [OPTION]... [FILE]...
    

    So you know rm removes stuff. There’s also a description below I haven’t copied which also states directories (folders) aren’t deleted by default.
    Let’s search for -r using / -r (3 spaces before option so it doesn’t match “-r” elsewhere in text)

    -r, -R, --recursive
                  remove directories and their contents recursively
    

    Well, if we had -R or --recursive the 3 spaces would break it, but anyway… So now you know this option let’s you delete directories and their contents including sub-directories.
    Next let’s try / -f

    Pattern not found  (press RETURN)
    

    So either it’s not indented with 3 spaces like the -R, OR it’s somewhere above. ? -f finds it above

    -f, --force
                  ignore nonexistent files and arguments, never prompt
    

    So this will just keep going regardless of errors. / --no-preserve-root

    --no-preserve-root
                  do not treat '/' specially
    

    Because /, the target file/directory in the above example, is the root of the filesystem, there’s probably no good reason to attempt removing it. This wasn’t always the case, but it was added later, in 2006 it seems.

    I specifically chose this command because it’s an often-used joke, but it could be worse, like executing some malware, etc…
    Basically, by blindly copy-pasting commands, you let someone, most likely a stranger, use your computer for you. And they may not always have good intentions.

    Same goes for running random scripts/programs, but I guess those already look scary enough by default.