Is it possible that I have deleted some commands in my terminal? - terminal

I have been trying to install flutter on my Mac. At some point I must have changed the path of a couple of commands in the terminal.
For example, I can't use vim, git, curl etc. ... It says "zsh: command not found:"
What can I do?

Related

zsh: command not found on MacOS Monterey

I wanted to create a react project and when I executed the command it said zsh: command not found: npx
Then I tried the ls command and it said zsh: command not found: ls.
After setting the export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command both the ls and npx create-react-app command worked fine and when close the terminal and reopen again, the same command not found error shows.
Is there any permenent fix without setting export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command
For adding the variables to the path you need to add it to zshrc file for making that variable available locally.
The way you have used will only work until you use it in the same terminal window path only.
To solve the problem, follow these steps:
Goto you home directory
Simultaneously press cmd + shift + (.) Note:the last key is the key of dot
On following step 2, new hidden files will appear in home directory, look for (.zshrc) file and open it using any text editor.
Add your path variable in it, save and then close it.
Example: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Open terminal and run the command: "echo $PATH" and see if your added variable is present in the output shown by terminal.
If yes, You are now ready to go to use it from anywhere in terminal now.
This is what worked for me on macOS Monterey,
Although I added the path to ./zshrc and sourced the file, after reopening the terminal the PATH was not exported
I followed these steps to solve this
Created .zprofile with touch .zprofile at the home directory. If the file already exists use that.
Add the required path to this file using vim or nano
eg: export PATH=${PATH}:/Users/Development/HashBaze/flutter/bin
If the above two steps don't work try sourcing both the .zprofile and .zshrc after following the above two steps.
This solution worked for me on macOS Monterey version 12.5

Is it possible to use fzf (command line fuzzy finder) with windows 10 git-bash?

I downloaded the .exe file and placed it into my PATH variable. fzf seems to work in command prompt. But I would like to use it in git-bash. When i use fzf in git-bash it seems to start but nothing happens.
Any advice would be helpful. I'm trying to save myself some keystrokes.
Yes it is.
I just downloaded fzf.exe from fzf-bin, launched bash.exe, and typed ./fzf.exe
But for that, I use a simplified PATH first:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
With that PATH, fzf just works.
I know this question was a while ago, but hopefully I can be of some use for any new readers trying to get fuzzy finder working, in git-bash
For whatever reason, I had tried the package from the GitHub repo #VonC shared and the new repo linked thereof and neither package executed in terminal as expected - Only thing could do was fzf --help
As you know git-bash is based on MSYS2, and they have pacman to install packages and a package list can also be found here https://packages.msys2.org/package/ including a fuzzy finder, however not fzf, but fzy
To get the Windows compatible file, go straight to 'File', not the upstream URL and within the downloaded compressed file you will find the .exe
Move that .exe to your git-bash /usr/bin and either rename fzy.exe to fzf.exe or bash alias fzf to execute fzy

no such file or directory at share folder

When I start bash, the following description appears:
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
-bash: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh: No such file or directory
i'm using Microsoft-Windows-Subsystem-Linux, with ubuntu distro.
I already tried uninstalling by powershell pip uninstall virtualenvwrapper or in bash sudo pip uninstall virtualenvwrapper.
I also entered the share directory to delete the virtualenvwrapper folder, but it does not appear. I'm pressing LS and the folder does not appear.
I am also trying "which virtualenvwrapper" or "which virtualenvwrapper_lazy.sh" but this simply returns the same folder as I am.
i just need help to remove that message of bash
Most likely, there is a reference (potentially with source or .) to virtualenvwrapper_lazy.sh in one of bash startup files. Look at the usual suspects: ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bash.rc, /etc/.bash_login
To help with debugging, consider getting by adding set -x to ~/.bashrc, or by running interactive session
bash -ix /dev/null
UPDATE, based on log:
Per https://superuser.com/questions/893448/bash-shell-error-no-such-file-or-directory/1049989
I just had the same problem on Linux Mint.
The following file was causing the issue:
/etc/bash_completion.d/virtualenvwrapper
I made a backup (just in case) and deleted it, and everything seems to
be working fine now.

Error on terminal open: -bash: /nvm.sh: No such file or directory

Every time I open my terminal the first line says: -bash: /nvm.sh: No such file or directory.
I just installed nvm on this laptop and obviously I did something wrong.
Does anyone know what commands I can use to fix this?
I tried the following command to remove nvm from my laptop:
$ rm -rf ~/.nvm
Sadly, this did not fix my problem.
Check your .bashrc file (usually in the home folder). See answers to this question. There's probably a line reading /nvm.sh somewhere in there -- if so, just delete it.
As Gasper Stukelj awnsered:
There was a line reading /nvm.sh.
The correct path to the file was for me using macOS Mojave:
$ open ~/.bash_profile
In my case I fixed this problem, just putting in terminal, after installing nvm: export NVM_DIR="$HOME/.nvm" and [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
and after that I installed node normally
How did I find this solution?
Simple, I read the terminal, and it gave two ways to solve. The first option was for me to restart the computer, to see if the changes (installation) took effect, and the second option was for me to put these two commands in the terminal and only : )
Ready to use in my case :)
I used Google Translate
For me the issue was coming from the .bash_profile file. The line was:
source ~/.nvm/nvm.shexport PATH="/usr/local/opt/php#7.0/bin:$PATH"
I removed everything after nvm.she and the error isn't showing in the terminal anymore. This happened while trying to install xdebug on Mac Big Sur.
I failed to find a solution in Google searches, so I just installed nvm again to resolve the issue. I guess some files were not installed.
brew install nvm

sudo: ./install.sh: command not found is not working on Lion

I've been following this tutorial in order to get SimpleOpenNI installed on my mac but I keep getting stuck at installing the OpenNI and NITE components because it requires me to navigate to the folders in Terminal and then run "sudo ./install.sh". I do this and I get this error:
sudo: ./install.sh: command not found
I've installed Command Line Tools in Xcode and everything.
Thanks
The reason why that happens is because the script you are trying to execute needs the right permissions.
Type:
sudo chmod a+x install.sh
and then try again.
In directory of install.sh
prompt$ sh install.sh
first open Terminal, type cd and than drag the map into Terminal and press enter. Now type sudo ./install.sh and it will work. Took me very long to find out. Hope it helps.
.sh scripts should have "\n" line breaks.
"Command not found" also occurs if "\r\n" line breaks are used.
Well at least this is the case on FreeBSD.
You need to run VBoxLinuxAdditions.run as root, not autorun.sh
Once you've inserted the Guest Additions ISO, open Files and open the disc from the sidebar. Then, right-click in the background of the window where autorun.sh is and select
Open in > Terminal
Now you can run the following command to install the Guest Additions:
sudo ./VboxLinuxAdditions.run
I'm a newbie but here is an answer that may help with the sh problem...I am running Armbian on an orange pi prime H5 SBC and I had downloaded and unzipped arduino ide well after 2 hours of searching and trying I hit it ....open the directory where the file you want to open or install is ...now at the top of the directory open a terminal(under file it will say open a terminal here).now the sh filename.sh will work.

Resources