12 ms·
Show HN: Oops I deleted my bin/ dir
- jarv 6y agoHello HN: This is a a modification to an old side-project that explores what is possible when you are left with a shell and no utilities on a Linux machine.
- Jaruzel 6y agoIt's not really that educational tbh. I am not a bash guru, nor do I wish to be one, so the second question left me cold with no desire to proceed any further. It's a fun game for those with the skills, but an instructional tool it is not.
- heavenlyblue 6y agoIt's an algebra game. Given a set of operations, can you get to state X? Usually requires a lot of searching and/or expertise, however the solutions will break pretty easily depending on which shell you're using, etc. So doesn't really teach you anything aside from iterating over a set of all possible operation combinations.
- weare138 6y agoIt's also a variation of the classic tech thought experiment/game 'If you only had X and how would you do Y?'. Like 'If all you had was telnet and had to send an email how would you do it?' or some variation of it, was a common one.
- jarv 6y agoIf it helps you can click on 'view solutions' to see correct answers if you are stuck.
- deleted 6y ago[deleted]
- cerberusss 6y agoGreat fun! As a non-native speaker, I was confused by the "Print its contents" exercise. I tried things involving /dev/lpr.
- jarv 6y agothanks for the feedback, maybe something like "display its contents" would be clearer.
- cerberusss 6y agoYeah that sounds clear. Awesome puzzle game, very educational.
- KMnO4 6y agoVery cool! I was a bit confused with the marking criteria. For example, my solution for "list all files on one line" appears to work correctly but is said to be incorrect. shopt -s dotglob; for i in *; do echo -n "$i "; done EDIT: I now see that the correct answer is simply "`echo *`". Despite having a dotfile in the directory, it should not be shown.
- dexen 6y agoVery amusing - and brings back memories of when a friend actually did remove the /bin (and IIRC the /lib64) a couple months ago :-) Getting stuck on #/oops_print_file_contents - the command times out. Not sure if I'm missing a better solution or perhaps the server is overloaded The command I tried was (here protected with rot13): zncsvyr sbbone < zl-qvffregngvba.gkg; rpub "${sbbone[@]}" -- A mild irritant is that the usual ^W (delete word to the left) instead closes tab in Firefox. Perhaps this could be prevented...?
- jarv 6y agoThanks! It looks like this is adding leading spaces on every line after the first one. The solutions can be viewed https://oops.cmdchallenge.com/#/oops_print_file_contents https://oops.cmdchallenge.com/#/oops_print_file_contents by clicking on "view solutions" if you want to compare. For the ^W thing I'm not sure if it's possible to avoid it, I'll check it out.
- krallja 6y agoI can’t type a space in this app on Mobile Safari. $ requires several key presses to register.
- thesh4d0w 6y agoMaybe I'm missing something obvious here but on the one that asks you to get the proc's cmdline, how do the examples know it's pid 42? Only way I can see to do this would be to echo /proc/* first to see what PID it is, guess it's 42, then go from there, but that violates the "do it in one command" rule at the beginning.
- Crespyl 6y agoI haven't dug into the puzzle very far and it didn't seem to like my experiments, but in bash and zsh `$$` will expand to the shells PID. Edit: Oh, I see what you mean now. I think it's just that you're expected to see that there's only a handful of PIDs in /proc and just try them each.
- jitendrac 6y agoReally fun game, finally finished it.
- moon2 6y agoReally fun, kind of trains you to when the situation happens IRL, whether you're thinking about how to escape a shell or if you really did it by mistake. I love showing this screenshot to people: https://imgur.com/a/ziHqJxB https://imgur.com/a/ziHqJxB. I was having problems trying to create a jailed shell, so I decided to bind mount /bin. That of course was a bad idea. I gave up and rm -rf'd the mountpoint without unmounting it. The screenshot has the serial logs from after that :P. I had a good time enjoying my stupidity.
- ThePowerOfFuet 6y agoThe top of the image is unreadable due to excessive lossy image compression.
- yesenadam 6y agoAfter clicking on it I can read it fine.
- imtringued 6y agoI do understand that this is meant to be a challenge but if this ever happened to me I'd just boot the archlinux iso and run pacstrap to reinstall pacman and then just reinstall all packages.