ls command is not working in terminal

Dear Bro when i setup in terminal

vim ~/.zshrc

after i added

export PATH="$PATH:/Users/sindhi/Documents/flutterDev/sdk/flutter/bin"

so now my terminal is not working and not working ls command so plz guide here

MacBook Air 13″, macOS 12.6

Posted on Jun 29, 2023 2:21 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 2, 2023 7:30 PM

m-ehmad wrote:

simple go to home directory press command + shift + dot delete .zshrc file then press again command + shift + dot and check your terminal thanks.. if you want to add flutter path try to to add correct path thanks.

Better to rename the file so it is not accessed. There may be customizations in that file which may be critical for the user so deleting the file will cause the user to lose those customizations since most people won't know what these files contain even if the user has seen them and made the custom edits themselves. So the user will be unable to rebuild those customizations.

8 replies
Question marked as Top-ranking reply

Dec 2, 2023 7:30 PM in response to m-ehmad

m-ehmad wrote:

simple go to home directory press command + shift + dot delete .zshrc file then press again command + shift + dot and check your terminal thanks.. if you want to add flutter path try to to add correct path thanks.

Better to rename the file so it is not accessed. There may be customizations in that file which may be critical for the user so deleting the file will cause the user to lose those customizations since most people won't know what these files contain even if the user has seen them and made the custom edits themselves. So the user will be unable to rebuild those customizations.

Jun 29, 2023 9:04 AM in response to alisindhi

Your zsh command path / PATH is incorrect, as previous replies have correctly stated.


To get ls to work, you will need to specify the full path (until you get path / PATH fixed):

$ whereis ls
ls: /bin/ls /usr/share/man/man1/ls.1
$ whereis whereis
whereis: /usr/bin/whereis /usr/share/man/man1/whereis.1
$ /bin/ls xyzzy
ls: xyzzy: No such file or directory
$ 


In the above, I have a valid path / PATH in my session, meaning that I can get at ls and whereis without specifying the full path. But the last command of that sequence is is invoked with the full path. Which will work, even with a corrupted path / PATH setting. Since I have no xyzzy file in the local directory, the ls command shows an ls error, as expected here. whereis (located in /usr/bin/whereis, as shown in the output above) can be invoked the same way, and can help you find other paths to other commands. This full path specification of the shell commands will allow you to get back to a working path / PATH declaration, too.


What’s this path / PATH I’m referencing? A quick intro to the zsh path array and to PATH:

https://superuser.com/a/598924


There are various introductions to the command line:

https://academind.com/tutorials/terminal-zsh-basics


The manual (dense, entirely correct, but not a great intro) is posted in various places:

https://zsh.sourceforge.io/Doc/


I’ve found the following zsh reference card very handy:

https://www.bash2zsh.com/zsh_refcard/refcard.pdf

Jun 29, 2023 8:36 AM in response to alisindhi

Your PATH is totally corrupted

"$/Users/alisindhi/Documents/flutterDev/sdk/flutter/bin"


There is a leading $ in the flutter/bin path that is going make even the flutter/bin directory unaccessible.


You do not have the standard

  • /usr/bin
  • /bin
  • /usr/sbin
  • /sbin


That most users get.


This most likely means that somewhere along the way in your shell initialization files, PATH was messed up.


Look for any files in your $HOME directory that start with .z* and examine them for PATH modifications.


You can use full path names to access commands such as /usr/bin/vim, /usr/bin/grep, /bin/ls, /bin/mv, etc...

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 is not working in terminal

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