I was installing Tor and wanted to access it directly from the terminal, so I was trying to copy start-tor-browser
to /usr/bin
. But by mistake, I have replaced the /usr/bin/env
file with the start-tor-browser
file. What should I do now??
2 Answers
/usr/bin/env
is provided by the coreutils
package. karel's way using a single command will likely work, but I suggest replacing /usr/bin/env
with a symbolic link to /bin/busybox
first, in case a removal or installation script attempts to use env
(which is generally assumed to be present).
First move the wrong file you put there aside, or delete it if you know you don't need that file. This renames it from env
to env.old
:
sudo mv /usr/bin/env{,.old}
Then make /usr/bin/env
a symbolic link to /bin/busybox
. When run with the name env
, busybox
will behave as the env
command:
sudo ln -s /bin/busybox /usr/bin/env
Then perform the reinstallation. The symbolic link you have just created will be used if necessary, will have no ill effect if it wasn't needed, and will be replaced automatically with the proper env
executable installed from the coreutils
package:
sudo apt --reinstall install coreutils
In general, if you need to know what package provides a file, you can run dpkg -S /path/to/file
(in this case, dpkg -S /usr/bin/env
), which works so long as the package is installed even if the file itself has been damaged or deleted. Or you can use the Search the contents of packages section of Ubuntu Packages Search, which does not require that you use the full path; you would just select your Ubuntu release and type in env
.

- 117,780
The env file at /usr/bin/env
is provided by the coreutils package in all currently supported versions of Ubuntu. Open the terminal and type:
sudo apt-get install --reinstall coreutils
It is also apparent from your question that you did not install the Tor Browser bundle the easy way with apt as it is possible to do in Ubuntu 16.04 and later. To install the Tor Browser bundle in Ubuntu 16.04 and later open the terminal and type:
sudo apt install torbrowser-launcher
torbrowser-launcher handles downloading the most recent version of Tor Browser Bundle for you, in your language and for your architecture. After installing Tor Browser, it can be launched by searching for tor in the Dash and clicking the Tor Browser icon. The Tor Browser Launcher Settings app is also installed along with Tor Browser.
To start Tor Browser from the terminal run this command:
torbrowser-launcher
Sometimes torbrowser-launcher does not work after installing it. torbrowser-launcher failed to install Tor Browser when I tested it in both Ubuntu 20.04 and Ubuntu 22.04. If this happens please refer to the alternate instructions for installing Tor Browser in this answer which worked successfully in Ubuntu 18.04, 20.04 and 22.04.

- 114,770
env
symlink tobusybox
first, just reinstallingcoreutils
as shown here is reasonable: if it does fail, it is still possible to make the symlink and tellapt
to fix the half-completed transaction. Also, thetorbrowser-launcher
part is actually related to the core issue of replacing files in/usr/bin
and is a valuable addition. Actions like overwriting/usr/bin/env
usually happen when one attempts to install something with in a hard manual way that's better done in an easy automatic way. – Eliah Kagan Nov 14 '17 at 06:50