0

Every time I open Terminal this is on there like 50 times.

-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory
-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory
-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory
-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory
-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory
-bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory

I have no idea what I'm doing, I was just trying to get my Terminal to start with a folder and I found this online:

echo "cd "`pwd` >> ~/.bash_profile 

I used that when I was in the folder I wanted to start with on Terminal and it didn't work so being dumb I did it like 50 times so my Terminal always starts with a bunch of -bash: cd: /Users/Dakota/Documents/School/Spring: No such file or directory. It's ugly and I need it gone.

  • Never copy a command into your terminal if you don't know what it's doing. In this case, you are appending cd wherever_you_are to the end of your bash_profile, which controls your bash settings. Fix it easily with sudo nano ~/.bash_profile and delete that line and save. If you wanna make a folder by terminal use mkdir myfolder – Script Kitty Apr 5 '17 at 19:10
  • @Scipt Kitty No need to use sudo . – fd0 Apr 5 '17 at 19:13
0

First we'll look at what the command did. The echo part returned the value of the arguments to the standard output. In this case, it wrote cd plus the response of the command pwd which returns the current directory. The >> part of the command writes the output of the command before it (in this case, the result of echo) to a file. The file it wrote to was ~/.bash_profile, which is a file of commands to run when bash is invoked. In this case, when you start your terminal.

To fix it, you can simply remove the lines that the command added. To do so, you can use Nano, which comes with your computer. Run nano ~/.bash_profile in terminal, and then remove the lines that say cd /Users/Dakota/Documents/School/Spring. Save your changes by pressing ctrl + x, and then press enter. Now, when you open a terminal window, you shouldn't be seeing those lines of text :)

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged .