Issue running through 'Adding ~/bin to $PATH in Bash' when setting up cli on linux

So running through the tutorial I ran ‘echo ‘export PATH=~/bin:$PATH’ >> ~/.bash_profile’
and it wiped my $PATH environment, i restored it but just wanted to let someone know that this could mess up others terminals for those that don’t know too much about it or how to restore it.
I suggest to instead edit the files in a editor like gedit or nano.

I’d like to dig into this further. Some questions:

  • did you have a pre-existing ~/.bash_profile file?
  • did you have a pre-existing ~/.profile file?
  • in what file do you currently customize your PATH?
  • what is your PATH?

That command should only prepend to the PATH, not remove anything from it. It should be safe to run. Without further details it’s hard to know where things went wrong here.

All my files were default i believe, i personally never made changes to them. I used .bashrc file and this is whats in my PATH:
/home/zevian/bin:/home/zevian/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/zevian/.dotnet/tools

yeah i thought so too, but after running source on the file then trying nano to check the file and returned that nano was not in path, ls wasn’t working either. I ran echo $PATH and only had ~/bin instead of the default full list.

This is my system specs if that helps:

OS: Kali GNU/Linux Rolling x86_64
Kernel: 6.6.15-amd64
Shell: bash 5.2.21
DE: Plasma 5.27.10
CPU: 12th Gen Intel i7-12700K (20) @ 4.900GHz
GPU: NVIDIA GeForce RTX 3060 Ti Lite Hash Rate
Memory: 4729MiB / 31840MiB

I can’t find where this is written. Can you point me to this step?

Found it:

From https://exercism.org/cli-walkthrough, click these buttons

  • Linux
  • Using the source code
  • Continue
  • Yes

@Grandilex looking in your home directory, which of these files exist?

  • .bash_profile
  • .bash_login
  • .profile