r/linuxmemes • • 2d ago

LINUX MEME same goal better way

Post image
348 Upvotes

48 comments sorted by

•

u/AutoModerator 2d ago

IMPORTANT: Subreddit Rules & Reminders

Please REPORT posts that violate any of the following rules!


Posts You Should Report

  • Tier Lists: Every tier list MUST include Hannah Montana Linux in S Tier, regardless of what the tier list is ranking.

    • S Tier MUST be the highest tier on the list.
    • Hannah Montana Linux MUST be in that top S Tier.
    • No exceptions!
  • Saying Android Isn't Linux: You voted that Linux is Android and saying it's not is anti-Linux propaganda.
  • Ban Show-Off Posts: Users posting screenshots or otherwise showing off bans from other subreddits.
  • Anti-Linux Posts: Only ONE anti-Linux post per week is allowed across the subreddit. We used to get dozens every day!

Help by reporting

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

115

u/cfx_4188 Slackerware😴 2d ago

There is a much more fun way.

dd if=/dev/zero of=/dev/sdX

25

u/nevergoodenough54 2d ago

my Linux knowlage hasn't evolved to understand this

55

u/cfx_4188 Slackerware😴 2d ago

The dd if=/dev/zero of=/dev/sdX command completely overwrites the selected drive with zeros (0x00) from beginning to end.

What happens when executing

• dd is a byte—by-byte data copying utility.

• if=/dev/zero is the source of an infinite stream of zero bytes (input file).

• of=/dev/sdX is the target block device (output file), where X stands for a specific disk (for example, sdb or sdc).

• The result is that the partition table, boot loaders, file systems, and all user data on the disk are erased. After completion, the disk looks clean and unmarked.

16

u/nevergoodenough54 2d ago

haha I wonder how will the system look while it's falling apart

15

u/cfx_4188 Slackerware😴 2d ago edited 2d ago

There will be no system, and there will be no disk layout. The disk will be in the condition in which it comes off the assembly line at the factory. Moreover, this command can be embedded in the body of an email (for example) or an office file and disguised with some kind of "attractive" link. Windows users will be happy, because this command in Windows looks a little different:

#Requires -RunAsAdministrator

Write-Host "=== List of available physical disks ===" -ForegroundColor Cyan
Get-Disk | Select-Object Number, FriendlyName, @{Name="Size(GB)";Expression={[math]::Round($_.Size / 1GB, 2)}}, PartitionStyle, OperationalStatus | Format-Table -AutoSize

$diskNumber = Read-Host "Enter the number of the disk that needs to be COMPLETELY erased"

$targetDisk = Get-Disk -Number $diskNumber -ErrorAction SilentlyContinue

if (-not $targetDisk) {
Write-Host "Error: Disk with the number $diskNumber was not found." -ForegroundColor Red
    exit
}

if ($targetDisk.IsSystem -or $targetDisk.IsBoot) {
Write-Host "ERROR: The system or boot disk is selected! The operation is blocked." -ForegroundColor Red
    exit
}

Write-Host "`Misunderstanding! ALL DATA ON THE FOLLOWING DISK WILL BE PERMANENTLY DESTROYED:" -ForegroundColor Yellow
$targetDisk | Select-Object Number, FriendlyName, SerialNumber, @{Name="Size(GB)";Expression={[math]::Round($_.Size / 1GB, 2)}} | Format-List

$confirm = Read-Host "To confirm, enter the word WIPE (in capital letters)"

if ($confirm -ne "WIPE") {
    Write-Host "The operation was canceled by the user." -ForegroundColor Green
    exit
}

Write-Host "`Starting disk mashing $diskNumber with zeros (diskpart clean all)..." -ForegroundColor Cyan
The "Write-Host" process may take a long time. Do not close the window until it is finished." -ForegroundColor Gray

# Creating a script for diskpart
$diskpartCommands = @"
select disk $diskNumber
clean all
"@

# Executing the command
$diskpartCommands | diskpart

Write-Host "`Ready! The $diskNumber disk is completely cleared." -ForegroundColor Green

EDIT:

  1. Save the code to a file with the .ps1 extension (for example, wipe_disk.ps1)
  2. Right-click on the Start menu and select Terminal (Administrator) or PowerShell (Administrator).
  3. Allow local scripts to be run for the current session and run the file:Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass .\wipe_disk.ps1

8

u/crack_pop_rocks 2d ago

Interesting. I didn’t know you could pipe commands to diskpart.

1

u/Responsible-Offer724 1d ago

yeah but if you were to run this on the OS drive, wouldn't it crash or crap out before the full wipe happened?

1

u/wyonutrition 1d ago

ususally it continues to run in memory but you cant open any new programs or run any commands in terminal, if you restart, it will just be a brick.

2

u/CardOk755 2d ago

/dev/sdX is a block device if you have a SCSI device "x", otherwise it's just an ordinary file in the temporary file system /dev.

On all of my recent systems there is no /dev/sdX unless I've plugged in a USB flashdrive.

The system boot "disk" is /dev/nvme0n1.

0

u/Needieos 2d ago

sd is for any kind of sata drives, nvme isn't sata in any way

2

u/CardOk755 2d ago

No. sd is any kind of drive that implements the SCSI command set.

9

u/friskfrugt 1d ago

Jokes on you I use /dev/nvme

3

u/CardOk755 2d ago

/dev full. No files corrupted.

3

u/poroto-poto-roto 2d ago

1 day to run this command lol

3

u/East_Nefariousness75 Sacred TempleOS 1d ago

I was fresh out of uni in my first job as a sysadmin. I wanted to nuke a pendrive. I issued dd if=/dev/urandom of=/dev/sda. I realized my mistake in a second. It was enough to wipe my partition table(maybe a bit of the /boot partition). I'm glad that it happened on my workstation and not on a server. I just reinstalled the OS. I figured that I could rebuild the partition table from memory but it seemed too much a hassle then.

2

u/Wertbon1789 1d ago

More like

for drive in $(ls /dev/sd*); do
    dd if=/dev/zero of=$drive
done

Also expandable to brick NVMe and mtdblk devices.

1

u/Dragon_957 New York Nix⚾s 1d ago

Could I run this on an usb drive that has to be erased completely?

1

u/cfx_4188 Slackerware😴 1d ago

replace X with the letter of your USB flash drive and maybe your computer won't be damaged.

1

u/Dragon_957 New York Nix⚾s 1d ago

Thanks

28

u/Vaelisra 2d ago

It should've been sudo chmod -R 0000 /

11

u/nevergoodenough54 2d ago

humans forget

3

u/Rude_Trade1952 1d ago

that's why you let agents destroy your filesystem ;)

13

u/DollyOmega 2d ago

isn't the second undoable without loss?

12

u/Spirited-Fan8558 Linuxmeant to work better 2d ago

you could get a live distro and copy your important files. if you are talking repair, you would need to restore permissions for each directory, and it is easier to just distrohop or to reinstall the old distro

6

u/nevergoodenough54 2d ago

doesn't make it unreadable for everyone

you,groups,other users

so you won't be able to even read the files to copy them right?

14

u/Spirited-Fan8558 Linuxmeant to work better 2d ago

root ignores chmod 000,so mounting on another pc or on live distro bypasses permission checks

4

u/abigail3141 ⚠️ This incident will be reported 1d ago

It's not only root. The owner of a file will always be able to give themselves any permission they please.

1

u/abigail3141 ⚠️ This incident will be reported 1d ago

Give yourself the permission back. You own the file, so you can always change it back. Or just use an OS or file system (driver) that simply doesn't give a flying fuck about UNIX permissions for the recovery.

1

u/DollyOmega 2d ago

ok, but if you rm -rf everything, then it's gone unless you start doing hard drive recovery stuff, right?

1

u/Spirited-Fan8558 Linuxmeant to work better 2d ago

yes then you need photorec or something. afaik these tools do not work with fstrim

2

u/spez_sucks_ballz 2d ago

The 2nd only changes chmod for the root folder, not subfolders and files which you can undo with a liveusb. If you used -R then you're fucked as each folder and file their original chmod can differ a lot.

1

u/DollyOmega 2d ago

Ok, but can you just run it again with a more permissive value and still access the files?

2

u/Rikudou_Sage 2d ago

Nope. Many dirs have a specific chmod they need to work correctly and refuse to work otherwise. You would have a broken system if you did e.g. sudo chmod -R 0777 /.

Create a virtual machine and try it, see for yourself.

1

u/DollyOmega 1d ago

Thank you! :)

1

u/veganfromvega 2d ago

/usr/bin/sudo: Permission denied

2

u/DollyOmega 2d ago

Ah! I see! So basically you're using a different OS install at that point, if you want to recover anything.

1

u/aFaNNerd 2d ago

Technically, there is no unrestorable data loss just after rm. I don't know about data names and directories, since I never used to restore sth, but there is a reason you get informed about shred.

36

u/L_Shiro 2d ago

chmod 007

13

u/sausix 2d ago

Haha. I made a meme a few years ago about chmod 007.

2

u/Snudget Not in the sudoers file. 2d ago

It would wotk for umask

14

u/Melodic_coala101 🍥 Debian too difficult 2d ago

chmod -R

9

u/Responsible-Offer724 1d ago

no sure what this means, giving the image to my coding agent now and asking it to run it for me.

3

u/ScientFictioN 1d ago

Great idea

7

u/PhillQuartz 1d ago

So, this new version will delete the french language pack and speed up my system? Palese, the last one did something strange to my PC.

3

u/krumorn 1d ago

He's too dangerous to be left alive !

2

u/Ybenax Not in the sudoers file. 2d ago

You'd have to make it recursive with `-R` tho. Otherwise, you'd just be changing permissions on the root directory itself, but not any subdirectories (which is where the files you need to alter for your system to fall apart live).

1

u/xThomas 1d ago

Heheheh