What causes "bash: /bin: Is a directory" every time a terminal is opened?

38,369

Apparently one of your modifications to .bashrc introduced an error that treats /bin like something other than a directory (for example, by trying to run it as an executable file, read data from or write data to it as a file, etc.). Because .bashrc runs when your interactive shell starts, the error message always appears.

You may be able to identify the error yourself by looking through your modifications to .bashrc.

(Otherwise, to identify the specific problem it will be necessary to see the contents of your .bashrc file. You can copy its entire contents to the clipboard and paste it into your question, select it in your question, and format it as code with Ctrl+K. If you've made this file, much, much longer than it usually is, it might be too long to put into your question in its entirety. In that case, you can post it at http://paste.ubuntu.com and edit your question to include a link to the posting.)

One possibility is that you may have introduced a space in a path starting with /bin. For example, near the beginning of the default .bashrc file is the code:

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

If you accidentally put a space after /bin (in SHELL=/bin/sh), this might produce such an error.

That is just one example, and not necessarily the most likely one.

Share:
38,369

Related videos on Youtube

PonAlagu
Author by

PonAlagu

Updated on September 18, 2022

Comments

  • PonAlagu
    PonAlagu over 1 year

    This is initial screen I am getting on Ubuntu 12.04, when I open a terminal (Ctrl+Alt+T):

    screenshot of terminal

    That is, the text on the terminal is:

    bash: /bin: Is a directory
    chase@chase-desktop:~$ gedit ~/.bashrc
    chase@chase-desktop:~$ source ~/.bashrc
    bash: /bin: Is a directory
    chase@chase-desktop:~$
    

    Why is it appearing like this?

    Before that I worked on terminals and edited .bashrc so many times, but i did not get those messages.

    • Rinzwind
      Rinzwind over 9 years
      you made a mistake editing ~./bashrc.
    • Alaa Ali
      Alaa Ali over 9 years
      Post the contents of your .bashrc file. You probably changed/added something to it that's executing something on /bin.
    • Radu Rădeanu
      Radu Rădeanu over 9 years
      You can try this answer.
    • goo
      goo over 9 years
      You could find the erroneous line via bash -x .bashrc, or maybe grep -n 'bin ' .bashrc
    • jvriesem
      jvriesem almost 3 years
      Besides ~/.bashrc, the problem might be in ~/.bash_profile or any other script called by ~/.bash_profile or ~/.bashrc. Other files (less used or less standard) could be ~/.profile, ~/.bash_aliases, or something similar. A nice description of these config files is here: serverfault.com/a/261807/248915.
  • MF.OX
    MF.OX about 7 years
    If you are coming from Windows then one of the easiest mistakes to make is to separate folders in PATH (or any other path) with semicolon instead of colon. Eg instead of /usr/dir/one:/usr/dir/two you wrote /usr/dir/one;/usr/dir/two
  • Alkarin
    Alkarin over 5 years
    For me the issue was I had an extraneous ~ character floating around in my .bash_aliases. Once deleted and reopening the terminal, all good.