New linux command needed

MikeRocor

Well-Known Member
Joined
Jun 3, 2023
Messages
1,053
Reaction score
1,252
Credits
10,019
The user name of one of our users here on linux.org (you know who you are (*)) prompted me to think that maybe we need a new command for those of us who occasionally make dumb mistakes as root: sudoh to back out or otherwise try in vain to recover from what you just did. ( Think "switch-user_Doh!" )

*) not to imply any dumb moves on the part of said user, only that the name made me think of this
 


Not sure what you mean. Can you give an example of what you mean of what that would look like?
 
those of us who occasionally make dumb mistakes as root
need to restore their system with our great backup tool, called "Timeshift" !
:)

Cheers,
Eddy
 
I dunno... I'd lean towards what they call 'Suicide Linux'. In that, any mis-typed command will result in the rm -rf / command being run in the background.

DO NOT RUN THAT COMMAND!

Well, for most folks, that command won't really do anything. You're not root, and you didn't run it with sudo.

But, if you want to get REALLY good at double-checking your terminal inputs, that'll be the way to do it.

Hmm... Maybe we should have a challenge. Everybody needs to set this up, and the last person standing is declared the winner.

But not everyone uses the terminal all that extensively. We could all agree that opening any applications (beyond the start-up applications, like the DE or WM) must be done in the terminal. (And, yes, you can use tab completion.)

We all put $5 into the kitty, and the winner takes all. I suppose we'd have to rely on honesty. We'd have to rely on integrity, so we'd probably want to only let long-term site users participate.

I suppose we could use time stamps and check the ~/.bash_history file to do spot checks and verify the winner that way, but a clever person would still be able to cheat.

We can start next month and call it FAFO February.

I'd be down for that, but only on one computer. I'd likely do a drive image first, so restoring won't be a problem after I inevitably lose the challenge. Actually, I use the terminal a lot, so I'm bound to screw up fairly early. I'd try to be extra careful, but it's gonna happen. Mistakes will be made!
 
Not sure what you mean. Can you give an example of what you mean of what that would look like?
Well, after running something like
Rich (BB code):
sudo rm -rf /tmpdir /*
# note the extra space after "tmpdir"

you could type
Code:
sudoh rm -rf /tmpdir /*

(assuming you had anything left into which to type that) and the system would laugh heartily and respond with some suitably sarcastic failure message. Under the circumstances, I suppose sudoh could be something as simple as a symlink to cowsay - though that would be gone, too.
 
Well -r is recursive and -f is force, if you run that without -f it will ask you for every file or directory if you want to delete it.
Yeah - I grew up on systems where you were expected to know what you were doing or to accept the consequences if you didn't, so it never failed to piss me of when MS Windows was forever asking "Are you sure?". Now, I find that, in my system, there's a default alias alias rm='rm -i' and, in an uncharacteristic behavior, I -haven't- removed it... but I've developed the habit of always typing rm -f to counter it. It's weird being me, though I've become accustomed to it.
 
Also, I was curious...

You can add 2FA to terminal prompts. This includes time-sensitive one-time passwords, and stuff like that.

I've not dug into it at this time, but that piques my interest -- especially when it comes to something public-facing. From what I'm seeing, you can pick from Google Authenticator, Authy, or FreeOTP.

I know ZERO about this. It was just my curiosity that led me to search for this. Also, the information comes from the "AI" snippet at the top, which was surprisingly in-depth. Clicking a few of the 'FMI" links indicates that this is very much a possible tool for your security toolbox.

I don't have time immediately, but I'll hopefully be able to make time. This is something that very much piques my interest.

Hmm...

I've sanitized and minimized the following search URL. It may provide the same AI snippet that it shared with me:

 
suicide linux sounds like an amazing learning tool

A really stupid part of my brain wants to try it for a week.

If I prepare for it properly, I won't really lose any important data. I can just keep an image of the drive. Failure just means writing that image back to the drive. We're talking about a 20 to 30 minute process.

With enough time, you're going to likely end up being REALLY good at using the terminal.

If there are enough people who want to try it, it'd make a fun little exercise for us.
 
You must be kidding. :rolleyes:

Do you want to join us by using 'Suicide Linux' for a week? I'll do it on my second most-used computer, but only if we're allowed to take an image of the drive at the start of the week.

Well, I'll have to first make sure it works. I can do that in a VM.

It's harmless fun if you have an image of your drive AND you've tested it so that you know you can recover from it.

I think I'd prep a little differently. I'd make an image of my drive, and I'd then write it to a spare SSD. I'd remove the original drive and use the newly cloned drive. I'd back that newly cloned drive up and use the first cloned drive for the week. Then, no matter what happened, I could put the original drive back into the computer and keep going. So, I'd use a combination of three drives, with one being the very original drive used.

Well, I might use my most-used computer. There's not much risk involved.
 
Naw, I'll pass LOL.

I like peer-pressure! If enough other people want to do it, I'll probably join them.

Though now that I think about it, I'm going to possibly fail on the very first command.

I have an ingrained habit of keeping my ~/.bash_history cleared of cruft. I use it to store commands, and I do not want any cruft in there. This means I have a deeply ingrained habit of adding a space at the beginning of almost every command I enter into the terminal.

I'm not sure how it'd deal with a blank space. If it counts that as a typo, I'm so screwed. If it doesn't count as a typo, it wouldn't be in my history file, and I couldn't show the history file as evidence that I'd been doing the whole thing to begin with.

Adding that space is so ingrained that I'm going to forget and add it without thinking about it.

So, if I agree to do this, I might as well put my $5 into the pot, erase my drive immediately, and concede the victory to someone else. There's no way I'd make it a week without adding that space.
 
I like peer-pressure! If enough other people want to do it, I'll probably join them.
Of late, I've been bad enough at typing that I wouldn't last ten minutes with "suicide linux". I am forever frustrated when I remember the syntax of some arcane command sequence only to find that I started the line with "sudp" instead of "sudo". Up-arrow, ctrl-A, make the correction, hit enter... only to find that I did it -AGAIN- or there's some other typo as well!

So no, I don't think I'll play this game.
 
only to find that I started the line with "sudp" instead of "sudo".

The good news is that you'd be out of the competition early.

I'm happy with that :-) .

Nobody on the site seems to be dumb enough to try it with me. I can't really blame them, though the penalty wouldn't be too bad if you prepared properly. Sure, it'll take you 30 minutes (at most, probably) to restore a disk image, but that's not too bad.
 
Haha, I love the idea of sudoh like a built-in panic button for when root-me makes a “whoops” that’s more like a system-wide catastrophe.
Definitely feels like it should stand for: "Switch User... DOH!" then print out a message like:

Code:
echo "Rollback not found. Start over, champ."<br>

That said, if sudoh ever becomes real, I’d probably still ignore it out of sheer habit because I’m one of those people who doesn’t believe in backups either.

Real men don’t do backups...
Real men stare at a broken system for hours, trying to untangle the mess one config file at a time, googling grub rescue commands from a second device, and convincing themselves they’re close to fixing it.
Then, when that inner voice finally says, “You’re going in circles, mate,” we nuke it and reinstall.

It’s not the most efficient workflow, but hey it builds character.
 
Then, when that inner voice finally says, “You’re going in circles, mate,” we nuke it and reinstall.

It’s not the most efficient workflow, but hey it builds character.
Exactly.

But call me a sissy - I actually do make backups.
 
the penalty wouldn't be too bad if you prepared properly.
I have to confess, if I were going to do this, I nerf it by using a throw away setup on a spare machine. Its easy enough to build a new set up exactly like my daily driver - then maybe I could take my daily driver down for a week (or ten minutes!) and do some physical cleaning on it.
 


Follow Linux.org

Staff online


Top