I made a script and moved it to /usr/bin, then i removed it, but now when i try to use apt to update or upgrade and install something, i get that message at the end "sh: 1: /usr/bin/test: not found"("test" was the name of the script), can someone help me, this is really annoying, Thanks.


/usr/bin/test is an important system utility, provided by the coreutils package. When you moved your script test to /usr/bin you overwrote it.

You should be able to reinstall it using

sudo apt install --reinstall coreutils

If the missing test binary is preventing apt from running at all, then you can probably replace it temporarily with a link to /bin/busybox just so that apt install --reinstall can complete

In the future, resist the urge to use /usr/bin for non-system scripts or programs - put personal scripts in ~/bin and site-wide ones in /usr/local/bin

| improve this answer | |
  • Omg, thanks man, you're awesome, it worked, and thanks for the tips – paparoxo360 Sep 13 '18 at 0:46
  • @paparoxo360 happy to help - in the interests of science, was it necessary to link /usr/bin/test to /bin/busybox or did apt install --reinstall work without it? – steeldriver Sep 13 '18 at 0:49
  • I just did the sudo apt install --reinstall coreutils. – paparoxo360 Sep 13 '18 at 1:32
  • @paparoxo360 OK thanks that's useful to know – steeldriver Sep 13 '18 at 1:42
  • I agree with steeldriver (as for location of your own utilities), but if I wanted to call a script test, I do a whereis test before I name the script; which responds /usr/bin/test /usr/share/man/man1/test.1.gz (ie. test is located in /usr/bin/ with man reference manual page (1) in /usr/share/man/man1/ . Thus I know it's used, so I'd pick a new name, eg. whereis blah & get no response, telling me I can call my script 'blah' far more safely (as there is no program/script that uses that name in my $PATH)... – guiverc Sep 13 '18 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.