[{"data":1,"prerenderedAt":954},["ShallowReactive",2],{"navigation_docs_en":3,"-en-nonsense-bash-rm-confirmation-":377,"-en-nonsense-bash-rm-confirmation--surround":949},[4,16,94,262,271,332],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":15},"About","i-noto-star","\u002Fen\u002Fabout","en\u002F1.about",[10],{"title":11,"path":12,"stem":13,"icon":14},"Welcome","\u002Fen\u002Fabout\u002Fwelcome","en\u002F1.about\u002F1.welcome","i-lucide-home",false,{"title":17,"icon":18,"path":19,"stem":20,"children":21,"page":15},"General","i-noto-open-book","\u002Fen\u002Fgeneral","en\u002F2.general",[22,26,44,58,76],{"title":17,"path":23,"stem":24,"icon":25},"\u002Fen\u002Fgeneral\u002Fsummary","en\u002F2.general\u002F1.summary","i-lucide-bookmark",{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":15},"Networking","i-lucide-network","\u002Fen\u002Fgeneral\u002Fnetworking","en\u002F2.general\u002F2.networking",[32,36,40],{"title":33,"path":34,"stem":35},"NAT & DHCP","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fnat","en\u002F2.general\u002F2.networking\u002F1.nat",{"title":37,"path":38,"stem":39},"DNS Zone","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fdns","en\u002F2.general\u002F2.networking\u002F2.dns",{"title":41,"path":42,"stem":43},"Samba","\u002Fen\u002Fgeneral\u002Fnetworking\u002Fsamba","en\u002F2.general\u002F2.networking\u002F3.samba",{"title":45,"icon":46,"path":47,"stem":48,"children":49,"page":15},"Storage","i-lucide-hard-drive","\u002Fen\u002Fgeneral\u002Fstorage","en\u002F2.general\u002F3.storage",[50,54],{"title":51,"path":52,"stem":53},"RAID","\u002Fen\u002Fgeneral\u002Fstorage\u002Fraid","en\u002F2.general\u002F3.storage\u002F1.raid",{"title":55,"path":56,"stem":57},"ZFS","\u002Fen\u002Fgeneral\u002Fstorage\u002Fzfs","en\u002F2.general\u002F3.storage\u002F2.zfs",{"title":59,"icon":60,"path":61,"stem":62,"children":63,"page":15},"Hardware","i-lucide-server","\u002Fen\u002Fgeneral\u002Fhardware","en\u002F2.general\u002F4.hardware",[64,68,72],{"title":65,"path":66,"stem":67},"The Basics","\u002Fen\u002Fgeneral\u002Fhardware\u002Fbasics","en\u002F2.general\u002F4.hardware\u002F1.basics",{"title":69,"path":70,"stem":71},"Network","\u002Fen\u002Fgeneral\u002Fhardware\u002Fnetwork","en\u002F2.general\u002F4.hardware\u002F2.network",{"title":73,"path":74,"stem":75},"The ProloNAS","\u002Fen\u002Fgeneral\u002Fhardware\u002Fprolonas","en\u002F2.general\u002F4.hardware\u002F3.prolonas",{"title":77,"icon":78,"path":79,"stem":80,"children":81,"page":15},"Linux tips for dummies","i-lucide-terminal","\u002Fen\u002Fgeneral\u002Flinux","en\u002F2.general\u002F5.linux",[82,86,90],{"title":83,"path":84,"stem":85},"Command line basics","\u002Fen\u002Fgeneral\u002Flinux\u002Fcli-basics","en\u002F2.general\u002F5.linux\u002F1.cli-basics",{"title":87,"path":88,"stem":89},"Folders and partitions","\u002Fen\u002Fgeneral\u002Flinux\u002Ffilesystem","en\u002F2.general\u002F5.linux\u002F2.filesystem",{"title":91,"path":92,"stem":93},"Handy CLI tools","\u002Fen\u002Fgeneral\u002Flinux\u002Fhandy-tools","en\u002F2.general\u002F5.linux\u002F3.handy-tools",{"title":95,"icon":96,"path":97,"stem":98,"children":99,"page":15},"Serveex","i-noto-microscope","\u002Fen\u002Fserveex","en\u002F3.serveex",[100,104,126,144,170,188,202,216,234,248],{"title":101,"path":102,"stem":103,"icon":25},"Introduction","\u002Fen\u002Fserveex\u002Fintroduction","en\u002F3.serveex\u002F1.introduction",{"title":105,"icon":106,"path":107,"stem":108,"children":109,"page":15},"Server core","i-lucide-server-cog","\u002Fen\u002Fserveex\u002Fcore","en\u002F3.serveex\u002F2.core",[110,114,118,122],{"title":111,"path":112,"stem":113},"Debian 13","\u002Fen\u002Fserveex\u002Fcore\u002Finstallation","en\u002F3.serveex\u002F2.core\u002F1.installation",{"title":115,"path":116,"stem":117},"Docker","\u002Fen\u002Fserveex\u002Fcore\u002Fdocker","en\u002F3.serveex\u002F2.core\u002F2.docker",{"title":119,"path":120,"stem":121},"Wireguard","\u002Fen\u002Fserveex\u002Fcore\u002Fwireguard","en\u002F3.serveex\u002F2.core\u002F3.wireguard",{"title":123,"path":124,"stem":125},"SWAG","\u002Fen\u002Fserveex\u002Fcore\u002Fswag","en\u002F3.serveex\u002F2.core\u002F4.swag",{"title":127,"icon":128,"path":129,"stem":130,"children":131,"page":15},"Security","i-lucide-shield","\u002Fen\u002Fserveex\u002Fsecurity","en\u002F3.serveex\u002F3.security",[132,136,140],{"title":133,"path":134,"stem":135},"Cloudflare Zero Trust","\u002Fen\u002Fserveex\u002Fsecurity\u002Fcloudflare","en\u002F3.serveex\u002F3.security\u002F2.cloudflare",{"title":137,"path":138,"stem":139},"TinyAuth","\u002Fen\u002Fserveex\u002Fsecurity\u002Ftinyauth","en\u002F3.serveex\u002F3.security\u002F3.tinyauth",{"title":141,"path":142,"stem":143},"Pocket ID","\u002Fen\u002Fserveex\u002Fsecurity\u002Fpocket-id","en\u002F3.serveex\u002F3.security\u002F4.pocket-id",{"title":145,"icon":146,"path":147,"stem":148,"children":149,"page":15},"Monitoring","i-lucide-chart-no-axes-column","\u002Fen\u002Fserveex\u002Fmonitoring","en\u002F3.serveex\u002F4.monitoring",[150,154,158,162,166],{"title":151,"path":152,"stem":153},"Uptime-Kuma","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fuptime-kuma","en\u002F3.serveex\u002F4.monitoring\u002F1.uptime-kuma",{"title":155,"path":156,"stem":157},"Dozzle","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fdozzle","en\u002F3.serveex\u002F4.monitoring\u002F2.dozzle",{"title":159,"path":160,"stem":161},"Speedtest Tracker","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fspeedtest-tracker","en\u002F3.serveex\u002F4.monitoring\u002F3.speedtest-tracker",{"title":163,"path":164,"stem":165},"Beszel","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fbeszel","en\u002F3.serveex\u002F4.monitoring\u002F4.beszel",{"title":167,"path":168,"stem":169},"UpSnap","\u002Fen\u002Fserveex\u002Fmonitoring\u002Fupsnap","en\u002F3.serveex\u002F4.monitoring\u002F5.upsnap",{"title":171,"icon":172,"path":173,"stem":174,"children":175,"page":15},"Media & Seedbox","i-lucide-list-video","\u002Fen\u002Fserveex\u002Fmedia","en\u002F3.serveex\u002F5.media",[176,180,184],{"title":177,"path":178,"stem":179},"Jellyfin","\u002Fen\u002Fserveex\u002Fmedia\u002Fjellyfin","en\u002F3.serveex\u002F5.media\u002F1.jellyfin",{"title":181,"path":182,"stem":183},"Qbittorrent","\u002Fen\u002Fserveex\u002Fmedia\u002Fqbittorrent","en\u002F3.serveex\u002F5.media\u002F2.qbittorrent",{"title":185,"path":186,"stem":187},"Automation","\u002Fen\u002Fserveex\u002Fmedia\u002Fservarr","en\u002F3.serveex\u002F5.media\u002F3.servarr",{"title":189,"icon":190,"path":191,"stem":192,"children":193,"page":15},"Cloud Drive & Photos","i-lucide-cloud-upload","\u002Fen\u002Fserveex\u002Fcloud","en\u002F3.serveex\u002F6.cloud",[194,198],{"title":195,"path":196,"stem":197},"Immich","\u002Fen\u002Fserveex\u002Fcloud\u002Fimmich","en\u002F3.serveex\u002F6.cloud\u002F1.immich",{"title":199,"path":200,"stem":201},"Nextcloud","\u002Fen\u002Fserveex\u002Fcloud\u002Fnextcloud","en\u002F3.serveex\u002F6.cloud\u002F2.nextcloud",{"title":203,"icon":204,"path":205,"stem":206,"children":207,"page":15},"File & share","i-lucide-folder-tree","\u002Fen\u002Fserveex\u002Ffiles","en\u002F3.serveex\u002F7.files",[208,212],{"title":209,"path":210,"stem":211},"File Browser Quantum","\u002Fen\u002Fserveex\u002Ffiles\u002Ffile-browser-quantum","en\u002F3.serveex\u002F7.files\u002F1.file-browser-quantum",{"title":213,"path":214,"stem":215},"Pingvin","\u002Fen\u002Fserveex\u002Ffiles\u002Fpingvin","en\u002F3.serveex\u002F7.files\u002F2.pingvin",{"title":217,"icon":218,"path":219,"stem":220,"children":221,"page":15},"Developpement","i-lucide-code-xml","\u002Fen\u002Fserveex\u002Fdevelopment","en\u002F3.serveex\u002F8.development",[222,226,230],{"title":223,"path":224,"stem":225},"Code-Server","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fcode-server","en\u002F3.serveex\u002F8.development\u002F1.code-server",{"title":227,"path":228,"stem":229},"Forgejo","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fforgejo","en\u002F3.serveex\u002F8.development\u002F2.forgejo",{"title":231,"path":232,"stem":233},"IT Tools","\u002Fen\u002Fserveex\u002Fdevelopment\u002Fit-tools","en\u002F3.serveex\u002F8.development\u002F3.it-tools",{"title":235,"icon":236,"path":237,"stem":238,"children":239,"page":15},"Useful Apps","i-lucide-award","\u002Fen\u002Fserveex\u002Fapps","en\u002F3.serveex\u002F9.apps",[240,244],{"title":241,"path":242,"stem":243},"Adguard Home","\u002Fen\u002Fserveex\u002Fapps\u002Fadguard","en\u002F3.serveex\u002F9.apps\u002F1.adguard",{"title":245,"path":246,"stem":247},"Vaultwarden","\u002Fen\u002Fserveex\u002Fapps\u002Fvaultwarden","en\u002F3.serveex\u002F9.apps\u002F2.vaultwarden",{"title":249,"icon":250,"path":251,"stem":252,"children":253,"page":15},"Advanced","i-lucide-flask-conical","\u002Fen\u002Fserveex\u002Fadvanced","en\u002F3.serveex\u002F91.advanced",[254,258],{"title":255,"path":256,"stem":257},"Authentik","\u002Fen\u002Fserveex\u002Fadvanced\u002Fauthentik","en\u002F3.serveex\u002F91.advanced\u002F1.authentik",{"title":259,"path":260,"stem":261},"Arcane","\u002Fen\u002Fserveex\u002Fadvanced\u002Farcane","en\u002F3.serveex\u002F91.advanced\u002F2.arcane",{"title":263,"icon":264,"path":265,"stem":266,"children":267,"page":15},"Stockeex","i-noto-computer-disk","\u002Fen\u002Fstockeex","en\u002F4.stockeex",[268],{"title":101,"path":269,"stem":270,"icon":25},"\u002Fen\u002Fstockeex\u002Fintroduction","en\u002F4.stockeex\u002F1.introduction",{"title":272,"icon":273,"path":274,"stem":275,"children":276,"page":15},"My nonsense","i-noto-test-tube","\u002Fen\u002Fnonsense","en\u002F5.nonsense",[277,280,302],{"title":272,"path":278,"stem":279,"icon":25},"\u002Fen\u002Fnonsense\u002Fsummary","en\u002F5.nonsense\u002F1.summary",{"title":281,"icon":282,"path":283,"stem":284,"children":285,"page":15},"Python","i-lucide-file-code-2","\u002Fen\u002Fnonsense\u002Fpython","en\u002F5.nonsense\u002F2.python",[286,290,294,298],{"title":287,"path":288,"stem":289},"Nvidia Stock Bot","\u002Fen\u002Fnonsense\u002Fpython\u002Fnvidia-stock-bot","en\u002F5.nonsense\u002F2.python\u002F1.nvidia-stock-bot",{"title":291,"path":292,"stem":293},"Adguard CIDRE","\u002Fen\u002Fnonsense\u002Fpython\u002Fadguard-cidre","en\u002F5.nonsense\u002F2.python\u002F2.adguard-cidre",{"title":295,"path":296,"stem":297},"Lumeex","\u002Fen\u002Fnonsense\u002Fpython\u002Flumeex","en\u002F5.nonsense\u002F2.python\u002F3.lumeex",{"title":299,"path":300,"stem":301},"Instameex","\u002Fen\u002Fnonsense\u002Fpython\u002Finstameex","en\u002F5.nonsense\u002F2.python\u002F4.instameex",{"title":303,"icon":304,"path":305,"stem":306,"children":307,"page":15},"Bash","i-lucide-file-terminal","\u002Fen\u002Fnonsense\u002Fbash","en\u002F5.nonsense\u002F3.bash",[308,312,316,320,324,328],{"title":309,"path":310,"stem":311},"Servarr corrector","\u002Fen\u002Fnonsense\u002Fbash\u002Fservarr-duplicates","en\u002F5.nonsense\u002F3.bash\u002F1.servarr-duplicates",{"title":313,"path":314,"stem":315},"LUKS Backup","\u002Fen\u002Fnonsense\u002Fbash\u002Fluks-backup","en\u002F5.nonsense\u002F3.bash\u002F2.luks-backup",{"title":317,"path":318,"stem":319},"Socat Proxy","\u002Fen\u002Fnonsense\u002Fbash\u002Fsocat-proxy","en\u002F5.nonsense\u002F3.bash\u002F3.socat-proxy",{"title":321,"path":322,"stem":323},"HotDisk","\u002Fen\u002Fnonsense\u002Fbash\u002Fhotdisk","en\u002F5.nonsense\u002F3.bash\u002F4.hotdisk",{"title":325,"path":326,"stem":327},"Backrest Docker Stop","\u002Fen\u002Fnonsense\u002Fbash\u002Fbackrest-docker-stop","en\u002F5.nonsense\u002F3.bash\u002F5.backrest-docker-stop",{"title":329,"path":330,"stem":331},"rm Confirmation Guard","\u002Fen\u002Fnonsense\u002Fbash\u002Frm-confirmation","en\u002F5.nonsense\u002F3.bash\u002F6.rm-confirmation",{"title":333,"icon":334,"path":335,"stem":336,"children":337,"page":15},"Recycled","i-noto-recycling-symbol","\u002Fen\u002Frecycled","en\u002F6.recycled",[338,341,355],{"title":333,"path":339,"stem":340,"icon":25},"\u002Fen\u002Frecycled\u002Fsummary","en\u002F6.recycled\u002F1.summary",{"title":342,"icon":343,"path":344,"stem":345,"children":346,"page":15},"Deprecated","i-lucide-trash-2","\u002Fen\u002Frecycled\u002Fdeprecated","en\u002F6.recycled\u002F2.deprecated",[347,351],{"title":348,"path":349,"stem":350},"Wireguard 14","\u002Fen\u002Frecycled\u002Fdeprecated\u002Fwireguard-14","en\u002F6.recycled\u002F2.deprecated\u002F1.wireguard-14",{"title":352,"path":353,"stem":354},"File Browser","\u002Fen\u002Frecycled\u002Fdeprecated\u002Ffile-browser","en\u002F6.recycled\u002F2.deprecated\u002F2.file-browser",{"title":356,"icon":357,"path":358,"stem":359,"children":360,"page":15},"Alternatives","i-lucide-arrow-left-right","\u002Fen\u002Frecycled\u002Falternatives","en\u002F6.recycled\u002F3.alternatives",[361,365,369,373],{"title":362,"path":363,"stem":364},"Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fplex","en\u002F6.recycled\u002F3.alternatives\u002F1.plex",{"title":366,"path":367,"stem":368},"Qbittorrent for Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fqbittorrent-for-plex","en\u002F6.recycled\u002F3.alternatives\u002F2.qbittorrent for plex",{"title":370,"path":371,"stem":372},"Servarr for Plex","\u002Fen\u002Frecycled\u002Falternatives\u002Fservarr-for-plex","en\u002F6.recycled\u002F3.alternatives\u002F3.servarr for plex",{"title":374,"path":375,"stem":376},"Gitea","\u002Fen\u002Frecycled\u002Falternatives\u002Fgitea","en\u002F6.recycled\u002F3.alternatives\u002F4.gitea",{"id":378,"title":329,"body":379,"contributors":940,"description":942,"extension":943,"hideCopyPage":15,"hideHeader":15,"hideToc":15,"links":944,"meta":945,"navigation":946,"path":330,"seo":947,"stem":331,"__hash__":948},"docs_en\u002Fen\u002F5.nonsense\u002F3.bash\u002F6.rm-confirmation.md",{"type":380,"value":381,"toc":929},"minimark",[382,390,406,418,629,634,731,735,830,842,846,858,905,925],[383,384],"ellipsis",{"blur":385,"left":386,"top":387,"width":388,"z-index":389},"140px","0px","10rem","40rem","60",[391,392,393,397,398,401,402,405],"p",{},[394,395,396],"code",{},"rm"," doesn't ask twice. No recycle bin, no \"are you sure\", especially not with ",[394,399,400],{},"sudo"," in front of it, where a stray space or the wrong variable can wipe something you own no permission to double-check. It's the single most destructive habit a terminal builds into you, and the fix doesn't need a new tool, just a few lines in ",[394,403,404],{},".bashrc",".",[391,407,408,409,411,412,414,415,417],{},"The idea is to shadow the ",[394,410,400],{}," command with a Bash function of the same name. Every other use of ",[394,413,400],{}," still goes straight through, but the moment the first argument is ",[394,416,396],{},", it stops and asks first.",[419,420,425],"pre",{"className":421,"code":422,"filename":404,"language":423,"meta":424,"style":424},"language-bash shiki shiki-themes github-dark material-theme github-dark","# rm confirmation\nsudo() {\n  if [ \"$1\" = \"rm\" ]; then\n    echo -n \"Are you sure you want to delete files\u002Ffolders with sudo? (y\u002Fn) \"\n    read ans\n    if [[ $ans == [Yy]* ]]; then\n      command sudo rm \"${@:2}\"\n    else\n      echo \"Deletion cancelled.\"\n    fi\n  else\n    command sudo \"$@\"\n  fi\n}\n","bash","",[394,426,427,436,449,487,506,515,547,571,577,590,596,602,617,623],{"__ignoreMap":424},[428,429,432],"span",{"class":430,"line":431},"line",1,[428,433,435],{"class":434},"sDvJj","# rm confirmation\n",[428,437,439,442,446],{"class":430,"line":438},2,[428,440,400],{"class":441},"sCTWK",[428,443,445],{"class":444},"s8jd1","()",[428,447,448],{"class":444}," {\n",[428,450,452,456,459,463,467,470,474,476,479,481,484],{"class":430,"line":451},3,[428,453,455],{"class":454},"sJLGa","  if",[428,457,458],{"class":444}," [",[428,460,462],{"class":461},"s8K8j"," \"",[428,464,466],{"class":465},"sDMaj","$1",[428,468,469],{"class":461},"\"",[428,471,473],{"class":472},"sJPTy"," =",[428,475,462],{"class":461},[428,477,396],{"class":478},"s11XM",[428,480,469],{"class":461},[428,482,483],{"class":444}," ];",[428,485,486],{"class":454}," then\n",[428,488,490,494,498,500,503],{"class":430,"line":489},4,[428,491,493],{"class":492},"sJGgK","    echo",[428,495,497],{"class":496},"sJWha"," -n",[428,499,462],{"class":461},[428,501,502],{"class":478},"Are you sure you want to delete files\u002Ffolders with sudo? (y\u002Fn) ",[428,504,505],{"class":461},"\"\n",[428,507,509,512],{"class":430,"line":508},5,[428,510,511],{"class":492},"    read",[428,513,514],{"class":478}," ans\n",[428,516,518,521,524,528,531,533,536,539,542,545],{"class":430,"line":517},6,[428,519,520],{"class":454},"    if",[428,522,523],{"class":444}," [[",[428,525,527],{"class":526},"slcoZ"," $ans ",[428,529,530],{"class":472},"==",[428,532,458],{"class":444},[428,534,535],{"class":526},"Yy",[428,537,538],{"class":444},"]",[428,540,541],{"class":472},"*",[428,543,544],{"class":444}," ]];",[428,546,486],{"class":454},[428,548,550,553,556,559,562,565,568],{"class":430,"line":549},7,[428,551,552],{"class":492},"      command",[428,554,555],{"class":478}," sudo",[428,557,558],{"class":478}," rm",[428,560,561],{"class":461}," \"${",[428,563,564],{"class":472},"@:",[428,566,567],{"class":526},"2",[428,569,570],{"class":461},"}\"\n",[428,572,574],{"class":430,"line":573},8,[428,575,576],{"class":454},"    else\n",[428,578,580,583,585,588],{"class":430,"line":579},9,[428,581,582],{"class":492},"      echo",[428,584,462],{"class":461},[428,586,587],{"class":478},"Deletion cancelled.",[428,589,505],{"class":461},[428,591,593],{"class":430,"line":592},10,[428,594,595],{"class":454},"    fi\n",[428,597,599],{"class":430,"line":598},11,[428,600,601],{"class":454},"  else\n",[428,603,605,608,610,612,615],{"class":430,"line":604},12,[428,606,607],{"class":492},"    command",[428,609,555],{"class":478},[428,611,462],{"class":461},[428,613,614],{"class":465},"$@",[428,616,505],{"class":461},[428,618,620],{"class":430,"line":619},13,[428,621,622],{"class":454},"  fi\n",[428,624,626],{"class":430,"line":625},14,[428,627,628],{"class":444},"}\n",[630,631,633],"h2",{"id":632},"how-it-works","How it works",[635,636,637,658,675,697,718],"ul",{},[638,639,640,643,644,646,647,650,651,653,654,657],"li",{},[394,641,642],{},"sudo() { ... }"," defines a function named ",[394,645,400],{},". Bash looks up functions before it looks up commands on the ",[394,648,649],{},"PATH",", so typing ",[394,652,400],{}," in a terminal now runs this instead of ",[394,655,656],{},"\u002Fusr\u002Fbin\u002Fsudo",", no alias trickery involved.",[638,659,660,663,664,666,667,670,671,674],{},[394,661,662],{},"if [ \"$1\" = \"rm\" ]"," only looks at the very first word after ",[394,665,400],{},". ",[394,668,669],{},"sudo rm -rf \u002Fsrv\u002Fdocker\u002Fold-stack"," matches, ",[394,672,673],{},"sudo apt update"," doesn't.",[638,676,677,678,681,682,685,686,689,690,689,693,696],{},"On a match, it prints the question, reads the answer into ",[394,679,680],{},"$ans",", and ",[394,683,684],{},"[[ $ans == [Yy]* ]]"," accepts ",[394,687,688],{},"y",", ",[394,691,692],{},"Y",[394,694,695],{},"yes",", anything starting with either case of Y.",[638,698,699,702,703,706,707,710,711,713,714,717],{},[394,700,701],{},"command sudo rm \"${@:2}\""," is the part that actually deletes. ",[394,704,705],{},"command"," steps around the function so it doesn't call itself, and ",[394,708,709],{},"${@:2}"," is every argument after ",[394,712,396],{},", so ",[394,715,716],{},"-rf \u002Fsrv\u002Fdocker\u002Fold-stack"," is passed through untouched.",[638,719,720,721,723,724,727,728,405],{},"Anything that isn't ",[394,722,396],{}," falls into the ",[394,725,726],{},"else"," and runs exactly as if the function didn't exist: ",[394,729,730],{},"command sudo \"$@\"",[630,732,734],{"id":733},"installing-it","Installing it",[736,737,739,744,759,763,766,770,782,786,812,826],"steps",{"level":738},"3",[740,741,743],"h3",{"id":742},"open-your-shell-config","Open your shell config",[419,745,748],{"className":421,"code":746,"filename":747,"language":423,"meta":424,"style":424},"nano ~\u002F.bashrc\n","Terminal",[394,749,750],{"__ignoreMap":424},[428,751,752,756],{"class":430,"line":431},[428,753,755],{"class":754},"sEgDM","nano",[428,757,758],{"class":478}," ~\u002F.bashrc\n",[740,760,762],{"id":761},"paste-the-function","Paste the function",[391,764,765],{},"Add the block above at the end of the file, then save and exit.",[740,767,769],{"id":768},"reload-it","Reload it",[419,771,773],{"className":421,"code":772,"filename":747,"language":423,"meta":424,"style":424},"source ~\u002F.bashrc\n",[394,774,775],{"__ignoreMap":424},[428,776,777,780],{"class":430,"line":431},[428,778,779],{"class":492},"source",[428,781,758],{"class":478},[740,783,785],{"id":784},"try-it","Try it",[419,787,791],{"className":788,"code":789,"filename":747,"language":790,"meta":424,"style":424},"language-console shiki shiki-themes github-dark material-theme github-dark","$ sudo rm -rf \u002Ftmp\u002Ftest\nAre you sure you want to delete files\u002Ffolders with sudo? (y\u002Fn) n\nDeletion cancelled.\n","console",[394,792,793,801,807],{"__ignoreMap":424},[428,794,795,798],{"class":430,"line":431},[428,796,797],{"class":444},"$",[428,799,800],{"class":526}," sudo rm -rf \u002Ftmp\u002Ftest\n",[428,802,803],{"class":430,"line":438},[428,804,806],{"class":805},"s8-mJ","Are you sure you want to delete files\u002Ffolders with sudo? (y\u002Fn) n\n",[428,808,809],{"class":430,"line":451},[428,810,811],{"class":805},"Deletion cancelled.\n",[391,813,814,815,817,818,689,820,689,822,825],{},"Answer ",[394,816,688],{}," and it runs for real. Anything that isn't ",[394,819,396],{},[394,821,673],{},[394,823,824],{},"sudo systemctl restart docker",", goes through without a prompt.",[740,827,829],{"id":828},"done","Done !",[831,832,833,834,837,838,841],"note",{},"This lives in ",[394,835,836],{},"~\u002F.bashrc",", so it only applies to your interactive shell, not to scripts, cron jobs, or another user's session. That's the point: it catches you, typing, not a program calling ",[394,839,840],{},"sudo rm"," on purpose.",[630,843,845],{"id":844},"what-it-wont-catch","What it won't catch",[391,847,848,849,851,852,854,855,857],{},"This is a habit-breaker, not a sandbox. It only fires when ",[394,850,396],{}," is the literal first word after ",[394,853,400],{},", so anything that reaches ",[394,856,396],{}," a different way skips it entirely:",[635,859,860,879,888,897],{},[638,861,862,865,866,869,870,865,873,876,877],{},[394,863,864],{},"sudo -i rm -rf \u002F"," or ",[394,867,868],{},"sudo su -c \"rm -rf \u002F\"",", the first argument is ",[394,871,872],{},"-i",[394,874,875],{},"su",", not ",[394,878,396],{},[638,880,881,884,885,887],{},[394,882,883],{},"sudo bash -c \"rm -rf \u002Fsrv\u002Fdocker\"",", same reason, ",[394,886,396],{}," is buried inside the string bash runs",[638,889,890,893,894,896],{},[394,891,892],{},"sudo find \u002Fsrv\u002Fdocker -delete",", deletes just as permanently, and never calls ",[394,895,396],{}," at all",[638,898,899,901,902,904],{},[394,900,396],{}," without ",[394,903,400],{}," on files you already own",[391,906,907,908,915,916,920,921,924],{},"Real protection against the last category is a proper backup, ",[909,910,914],"a",{"href":911,"rel":912},"https:\u002F\u002Fgithub.com\u002Fgarethgeorge\u002Fbackrest",[913],"nofollow","Backrest"," and the ",[909,917,919],{"href":918},"\u002Fnonsense\u002Fbash\u002Fbackrest-docker-stop","Docker stop script"," covered elsewhere in this section, or otherwise. This function is worth having anyway: the accidents it does catch are the ones that actually happen, a hurried ",[394,922,923],{},"sudo rm -rf"," with a typo in the path, not a deliberate attempt to work around it.",[926,927,928],"style",{},"html pre.shiki code .sDvJj, html code.shiki .sDvJj{--shiki-light:#6A737D;--shiki-light-font-style:inherit;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .sCTWK, html code.shiki .sCTWK{--shiki-light:#B392F0;--shiki-default:#82AAFF;--shiki-dark:#B392F0}html pre.shiki code .s8jd1, html code.shiki .s8jd1{--shiki-light:#E1E4E8;--shiki-default:#89DDFF;--shiki-dark:#E1E4E8}html pre.shiki code .sJLGa, html code.shiki .sJLGa{--shiki-light:#F97583;--shiki-light-font-style:inherit;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .s8K8j, html code.shiki .s8K8j{--shiki-light:#9ECBFF;--shiki-default:#89DDFF;--shiki-dark:#9ECBFF}html pre.shiki code .sDMaj, html code.shiki .sDMaj{--shiki-light:#79B8FF;--shiki-light-font-style:inherit;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#79B8FF;--shiki-dark-font-style:inherit}html pre.shiki code .sJPTy, html code.shiki .sJPTy{--shiki-light:#F97583;--shiki-default:#89DDFF;--shiki-dark:#F97583}html pre.shiki code .s11XM, html code.shiki .s11XM{--shiki-light:#9ECBFF;--shiki-default:#C3E88D;--shiki-dark:#9ECBFF}html pre.shiki code .sJGgK, html code.shiki .sJGgK{--shiki-light:#79B8FF;--shiki-default:#82AAFF;--shiki-dark:#79B8FF}html pre.shiki code .sJWha, html code.shiki .sJWha{--shiki-light:#79B8FF;--shiki-default:#C3E88D;--shiki-dark:#79B8FF}html pre.shiki code .slcoZ, html code.shiki .slcoZ{--shiki-light:#E1E4E8;--shiki-default:#EEFFFF;--shiki-dark:#E1E4E8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sEgDM, html code.shiki .sEgDM{--shiki-light:#B392F0;--shiki-default:#FFCB6B;--shiki-dark:#B392F0}html pre.shiki code .s8-mJ, html code.shiki .s8-mJ{--shiki-light:#79B8FF;--shiki-default:#EEFFFF;--shiki-dark:#79B8FF}",{"title":424,"searchDepth":438,"depth":438,"links":930},[931,932,939],{"id":632,"depth":438,"text":633},{"id":733,"depth":438,"text":734,"children":933},[934,935,936,937,938],{"id":742,"depth":451,"text":743},{"id":761,"depth":451,"text":762},{"id":768,"depth":451,"text":769},{"id":784,"depth":451,"text":785},{"id":828,"depth":451,"text":829},{"id":844,"depth":438,"text":845},[941],"Djeex","A small Bash function that wraps sudo and asks for confirmation before running rm, so a typo doesn't delete files owned by root.","md",null,{},true,{"title":329,"description":942},"LhBI78eUPV46kIAKC6UBpO2rBNu1B2nEWCUUoPisrw8",[950,952],{"title":325,"path":326,"stem":327,"description":951,"children":-1},"A bash script that stops Docker containers before a Backrest backup runs and restarts them after, ensuring safe database backups without complex dumps.",{"title":333,"path":339,"stem":340,"description":953,"icon":25,"children":-1},"Deprecated guides kept for reference, and alternative apps that were replaced elsewhere on the site but still work fine on their own.",1788645858087]