ls command not working from terminal

Hello Team,

I am not sure why but my 'ls' command seems to have stopped working. Everytime from terminal I have to run 'export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin' command and then everything seems to run fine. Can someone please help me here...


my .bash_profile file:



# Setting PATH for Python 3.7

# The original version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"

export PATH

export PATH="/usr/local/opt/gettext/bin:$PATH"

export PATH="/usr/local/opt/openssl/bin:$PATH"

export PATH=/opt/apache-maven-3.5.4/bin:$PATH

export PATH=/usr/local/apache-maven-3.5.4/bin:$PATH

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home"

export HADOOP_HOME="/Users/username/hadoop-2.9.1"

export PATH="/usr/local/opt/icu4c/bin:$PATH"

export PATH="/usr/local/opt/icu4c/sbin:$PATH"

export PATH="/usr/local/opt/sqlite/bin:$PATH"

export PATH="/usr/local/bin:$PATH"

export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop

export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

MacBook Pro (Retina, 15-inch, Mid 2015), iOS 11.4.1

Posted on Sep 20, 2018 5:53 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 20, 2018 7:01 AM

You have so much cruft shoved in front of the default PATH that it is hard to say why it cannot find /bin/ls. Paths to executable locations, for which there is no system searchable executable duplicate, should follow the default $PATH, not precede it.


The Python 3.7 installation process places all of its binaries from its Library into /usr/local/bin as links, so there really is no explicit need to force the Python framework path into the PATH statement. These binaries are perfectly capable of finding what they need in Python framework because of this link relationship.

Similar questions

1 reply
Question marked as Top-ranking reply

Sep 20, 2018 7:01 AM in response to mayuri18kadam

You have so much cruft shoved in front of the default PATH that it is hard to say why it cannot find /bin/ls. Paths to executable locations, for which there is no system searchable executable duplicate, should follow the default $PATH, not precede it.


The Python 3.7 installation process places all of its binaries from its Library into /usr/local/bin as links, so there really is no explicit need to force the Python framework path into the PATH statement. These binaries are perfectly capable of finding what they need in Python framework because of this link relationship.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

ls command not working from terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.