This One Linux Tip Could Save Your Life

Поділитися
Вставка
  • Опубліковано 14 січ 2025

КОМЕНТАРІ • 57

  • @TheLinuxCast
    @TheLinuxCast  2 роки тому +4

    This video was released early for Patrons. patreon.com/thelinuxcast

  • @MormonJesus69420
    @MormonJesus69420 2 роки тому +45

    It's not only important to know when to use sudo and when not to use it, but it's also useful to know that whenever you wanna edit a file use sudoedit instead of sudo vim. Sudoedit opens a file with root privileges, but with your preferred editor keeping your user config of vim, nvim, or whether editor you're using. It's neat as it opens vim that you're used to, not the standard vim without any config.

  • @flarone
    @flarone 2 роки тому +2

    There are great noob pointers on this video with clear explanations. Nice work.

  • @phonewithoutquestion80
    @phonewithoutquestion80 2 роки тому +8

    I doubly recommend using shell aliases (e.g; bashrc, fishrc, zshrc) to prevent catastrophic data loss: such as extending their instruction to include safeguard flags (the "hyphen-letter" that you see in manpages), like "rm -i --preserve-root" so NOTHING you remove by accident has a chance to destroy root files of any kind. The "cp -n" should replace the standard cp command via an alias of "cp", so catastrophically erroneous overwrites do not occur. Same applies to "mv -n" in place of just "mv".

    • @treyquattro
      @treyquattro 2 роки тому

      I thought that's what the "one weird linux tip" was gonna be

  • @nottheengineer4957
    @nottheengineer4957 2 роки тому +5

    As someone who is very guilty of pasting random stuff from the internet into my terminal, I think a better way to go about this is using a VM. Save a snapshot it every now and then so it doesn't matter when you break everything inside that VM.
    If you don't have the time to fully understand what you're doing, you can be free of worries. And if you do break something, it's a great opportunity to learn without going through the pain of setting things up again.

  • @charleshopper4638
    @charleshopper4638 2 роки тому +1

    Excellent video. Good information.

  • @eliseuvideira1319
    @eliseuvideira1319 2 роки тому +2

    when you said "if you never used sudo before", i thought you were going to say "remember that with great power comes great responsability", 😂

  • @elmariachi5133
    @elmariachi5133 2 роки тому +5

    Using sudo requires the user to know what he's doing, but using Linux requires the user to do changes as root all the time, because only 25% of tools are working out of the box xD

  • @mkrleza
    @mkrleza 2 роки тому +2

    Great video. Very informative and essential for beginners. Kudos!

  • @ashwith
    @ashwith 2 роки тому +2

    When I first used linux, I had to reinstall it thrice in the same week (Fedora 9). I blindly edited config files as root and broke things. I didn't know to to reverse things back the then. Fun times :-)

  • @yomboprime
    @yomboprime 2 роки тому +1

    When copying from a web it is also possible that the copied text contains escape sequences which make it not show on the terminal when pasted, but injected text is executed. It may easily install a trojan and you won't notice. It happened to me.

    • @riseabove3082
      @riseabove3082 2 роки тому

      a trojan!!!!! get real.

    • @yomboprime
      @yomboprime 2 роки тому +1

      @@riseabove3082 Yeah because you're entering the sudo password.

  • @007JayP007
    @007JayP007 2 роки тому +1

    Just last week a coworker ran the following command on a server without knowing what it does: "sudo find /. -mtime +30 -delete". Long story short he deleted the whole Root Directory and important files and we had reinstall the whole server. Took us a week to undo what 2 min of thinking could have prevented. So always be careful when working with Linux.

    • @007JayP007
      @007JayP007 2 роки тому

      @Terminalforlife I would have thought so too, but apparently "/." means the whole root directory. If your type "ls /." it totally list the whole root directory.
      He got an SSH ban on all systems.

  • @jan-Juta
    @jan-Juta 2 роки тому +2

    Surprised you didn't mention more restricted sudo alternatives like doas.

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +4

      I love doas, but I think it might confuse the issue.

  • @Godalming123
    @Godalming123 2 роки тому +1

    I've never broken system with sudo and don't mind about braking my system too much I can recover the data from a live iso and reinstall but what I do care about is losing data like accidentally moving a file and then deleting where I moved it to.

  • @garyarter7323
    @garyarter7323 2 роки тому +2

    An important reminder to us all.

  • @ericjohnson5990
    @ericjohnson5990 2 роки тому +1

    Why not install ‘doas’ and remove ‘sudo’?

  • @squidbeard492
    @squidbeard492 2 роки тому

    As a dum dum who's used Linux over a decade I still have no idea what I'm copying/pasting in the command terminal. I've simply learned to back up my system.

  • @thingsiplay
    @thingsiplay 2 роки тому +2

    `sudo -e FILE` will edit the file with your current Vim configuration. `sudo vim FILE` uses the config of your super users Vim config.

    • @MormonJesus69420
      @MormonJesus69420 2 роки тому

      Oh i didn't know that you could do sudo -e, I'm used to sudoedit. Good to know the other alternative

    • @thingsiplay
      @thingsiplay 2 роки тому

      @@MormonJesus69420 It probably only matters if you edit multiple files. sudo -e will use sudoedit. Or something like that, not 100% sure. Some of the options vary too.

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +1

      I know. I also know about sudoedit, but I never use them because I never remember when I'm supposed to

    • @MormonJesus69420
      @MormonJesus69420 2 роки тому

      @@TheLinuxCast yeah I'm guilty of that too, but it's nice to use it when I remember that i can

    • @thingsiplay
      @thingsiplay 2 роки тому

      @@TheLinuxCast It is easy to remember using sudo -e instead of sudo vim, because my plugins won't work otherwise.

  • @psravan
    @psravan 2 роки тому

    Can you tell me what fetch script you use? And also how do you get icons for ls?

  • @andylongbottom9350
    @andylongbottom9350 2 роки тому

    When I was new to Linux, I mistakenly break OS every week mainly because of using sudo. That's why having a backup of system or having a bootable pendrive is nessary.

  • @Skaper_
    @Skaper_ 2 роки тому

    Hey, I like your terminal setup. Is there a video you made on how to get this look and feel? If so I'm unable to find it and would appreciate if you could share me a link. If not, which terminal emulator is this and how can I get it to look like that?

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +1

      This video will get you close if you're talking about the shell itself. ua-cam.com/video/oR8v9uOCq0E/v-deo.html
      If you're talking about the terminal, that's alacritty. It's in i3 with picom for rounded corners.

  • @Hossimo
    @Hossimo 2 роки тому

    Everyone needs to learn 'sudo !!'

  • @donaldmickunas8552
    @donaldmickunas8552 2 роки тому +2

    We learn most from our mistakes. You know very well that “knowing precisely what your doing” doesn’t come from reading a man page or watching a video alone. It also requires one to actually work with the command or platform. In that process, mistakes are inevitable as are system breakages. If one wants to avoid those possibilities, stay away from Linux. Stay with Apple or Microsoft. They have locked away most of those possibilities. [edited]

    • @donaldmickunas8552
      @donaldmickunas8552 2 роки тому

      @Terminalforlife I sorry that my comment about man pages came across negatively. My point is that it takes BOTH reading/study AND practice/application to become proficient in any discipline. I have edited my comment to hopefully correct the impression.

  • @kychemclass5850
    @kychemclass5850 2 роки тому

    cd ... (triple dot)?

  • @raderator
    @raderator 2 роки тому

    I used sudo apt install nautilus-admin to get a right click option to open a file or folder as root. Makes things nicer for us 30 yr Windows users. Zorin Core, BTW.

  • @fullscale4me
    @fullscale4me 2 роки тому +1

    Over use of sudo without accompanying knowledge can/will make your system unbootable! Don't ask me how I know this :-)

    • @donaldmickunas8552
      @donaldmickunas8552 2 роки тому +2

      From personal experience like the rest of us. We learn the most from our mistakes. We break things to learn things. LOL

  • @echoptic775
    @echoptic775 2 роки тому

    Whats the terminal conf?

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +1

      That's alacritty with powerlevel10k

    • @echoptic775
      @echoptic775 2 роки тому

      @@TheLinuxCast cool tnx ill check it out

  • @seventhgreeter5416
    @seventhgreeter5416 2 роки тому

    tldr and cheat with man is best, that way you have some example uses right off the bat that you can then go more extensively with the man pages.

  • @shriram5494
    @shriram5494 2 роки тому

    lol the first tip is literally RTFM

  • @tralphstreet
    @tralphstreet 2 роки тому +1

    How will this save my life?

  • @deepfuchsia7204
    @deepfuchsia7204 2 роки тому

    I mean, you could show us some nice picture and speak in the background.

  • @wisnoskij
    @wisnoskij 2 роки тому +2

    I would recoment tldr or --help over man. If you have never even used the command before, man is just insanely excessive and can leave you more confused about what the command does than when you started

  • @defaultroute
    @defaultroute 2 роки тому

    Just came to poke anyone who cares. Most don’t. It’s not a big deal I guess. But in case you find yourself teaching in a room. sudo is short for ‘Super User Do’. ‘Sue Doo’. Not ‘Sue Dough’. Sorry for that. Don’t mean to be the douche of the comments section.

  • @Schlumpfpirat
    @Schlumpfpirat 2 роки тому +1

    "You have to know precisely what you're doing"
    "Hmmm, I don't actually know if it would delete pacman.conf - so I'm gonna cancel"
    lmfao - you do not have permissions to: remove write-protected regular file 'pacman.conf' - so it will warn you and even if you confirm say "Permission denied"
    How do you not know that? How do you not know how the basics of Linux permissions work? Get outta here trying to tell anyone they have to be an expert to use sudo if you don't even know that

    • @TheLinuxCast
      @TheLinuxCast  2 роки тому +10

      I didn't say expert one time in the video. And I made this video for someone who didn't know. So don't be an elitist asshole.

    • @007JayP007
      @007JayP007 2 роки тому +2

      He did a very important step which some people dont do: If you are unsure what a thing does, dont do it. He did everything right.