0

I have a Windows Subsystem Linux installation (the distro is Ubuntu). I use it to build a Rails project and deploy branches to the server. Things worked OK for the last year.

Today I accidentally run this code:

history | script

After that it says something like "started script...typescript"

I did not know how to get out of that, so I just closed and restarted the Ubuntu terminal (inside Windows)

Now when I start the Ubuntu terminal it says Installing, this may take a few minutes... and that has gone on for 15 minutes now.

Can somebody help me? Did I accidentally mess up the distro by running that script? What does it do exactly?

And how can I get the distro back to before?

Thanks!

3
  • Script is not for scripting (read manual). Aug 18, 2019 at 15:45
  • 2
    depending on what commands you had in your history, the damage may be irreparable, and you'll have to install from scratch. It's true that history will usually prepend a number to each line, resulting in a lot of harmless 'command not found' filling up a typescript file, but depending on the syntax, some commands may be run, with catastrophic consequences. (eg. for any line like 3333 true || rm -fr * the rm -fr * will be run, even if in the original command it wasn't ;-)
    – user313992
    Aug 19, 2019 at 6:50
  • Just remove and reinstall WSL and see whether that helps.
    – Ned64
    Aug 22, 2019 at 9:52

1 Answer 1

1

history lists your resent commands, or all past commands, or all but some filtered ones such as cd (depending on setup). It is then passing them to script to execute and to log. However every history line will start with a number, so that will produce a not of command not found error messages.

If you are lucky then you just filled up the disk with a file called typescript. If you are unlucky then it re-run your history, but in the wrong context, and broke things.

Remove the file typescript, and re-test. Then consider re-installing.

But before re-install, what user were you running as. If root then it may be very broken, else it will be just user files. (Dose WSL have a concept of root?)

2
  • yes indeed it was root and things were very broken :((( i had to reinstall WSL. Btw is there a way to block certain command from running? history | script is EXTREMELY DANGEROUS and looks very similar to history | grep script (which is what I wanted to type...)
    – Freelensia
    Aug 19, 2019 at 13:09
  • If WSL has the concept of root, then don't run as root; use sudo (if WSL has it); Use different user accounts, to protect files; And use a revision control system (with a remote copy of the repository), for all user files, so that you can get your files back. (this should be a new question, but has probably been asked before) Aug 20, 2019 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .