Live data from Hacker News

Show HN: Oops I deleted my bin/ dir

oops.cmdchallenge.com

11–20 of 23 posts

Re: Show HN: Oops I deleted my bin/ dir

#11
post #9

Very 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 -- A mild irritant is that the usual ^W (delete word to the left) instead…

Thanks! 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 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.

Re: Show HN: Oops I deleted my bin/ dir

#12
post #8
post #2

Hello 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.

It'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.

If it helps you can click on 'view solutions' to see correct answers if you are stuck.

Re: Show HN: Oops I deleted my bin/ dir

#13
post #7
post #5

Very 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.

Ah, that is a bug the dotfile should not be there. Thanks!

So the dotfile is resolved but the solution:

  shopt -s dotglob; for i in *; do echo -n "$i "; done
still isn't valid unfortunately because of the extra space at the end, maybe it should be more forgiving about that.

Re: Show HN: Oops I deleted my bin/ dir

#15
Maybe 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.

Re: Show HN: Oops I deleted my bin/ dir

#16

Maybe 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.

I 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.

Re: Show HN: Oops I deleted my bin/ dir

#18
Really 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. 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.

Re: Show HN: Oops I deleted my bin/ dir

#19
post #18

Really 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 . 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…

The top of the image is unreadable due to excessive lossy image compression.
Post reply on HN