Just a note - I don't believe this will work without modification if you've changed your default shell to fish. Easy enough, however, to step into bash very quickly to run the commands (just run bash, run the commands, then do exit to get back into fish).
(written for bash shell)