Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: ls: command not found [duplicate]

Tags:

bash

macos

I have setup react-native in my system. I have mac OS X El Capitan.

After completing setup of react native, whenever i open my terminal and type command ls then, it shows "command not found".

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

After executing above two lines in my terminal, everything works fine. ls command is working after that. But once i close my terminal and again open it, ls command stops working and it shows "command not found".

I have also tried to add above two lines in .bash_profile file, but didn't get success. I don't know how to get rid of this issue.

like image 201
Kirti Parghi Avatar asked Apr 26 '17 11:04

Kirti Parghi


People also ask

Why is my ls command not working?

You can't use ls on cmd as it's not shipped with Windows , but you can use it on other terminal programs (such as GitBash). Note, ls might work on some FTP servers if the servers are linux based and the FTP is being used from cmd . dir on Windows is similar to ls .

What is alternative for ls in cmd?

Use the command dir to list all the directories and files in a directory; ls is a unix command. it is possible to make dir dsplay text horizontally ? this is helpful, just type dir in the cmd not the filename and dir. @Webwoman To show text horizontally, you can use dir /w .

What does ls WC do?

The wc command tells you how big a text document is. tells you the number of lines, words, and bytes in each file. This pipes the output of ls through wc.

Which is faster ls or find?

If you use ls -lR you have to then exclude content from the output, somehow, and then grep out what you want. find is probably quicker.


1 Answers

Add following line to you .bash_profile

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in

Simply you can do it by following command

echo "export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in" >> ~/.bash_profile

After that please restart your terminal

like image 192
Ebin Joy Avatar answered Sep 24 '22 19:09

Ebin Joy