This question already has an answer here:

I'm currently exploring and experimenting with my linux just for fun and educational purposes.

I have deleted the content of the /etc/bash.bashrc and /etc/profile and I don't have any configuration in the home directory for both root and local users, I also perform a reboot.

However when i run printenv PATH the values of the path was still there which is:


what might be defining the $PATH?


I forgot to mention that I'm using Kali linux.

I've found one of the culprit is in the /etc/profile.d/kali.sh as mentioned by a guy named flyingdrifter in the comment section of this thread -> Complete view of where the PATH variable is set in bash (although his distribution is LinuxMint).

Now the $PATH variable has been reduced to


which means that there are probably one last file that setting the PATH variable.

marked as duplicate by Wildcard, schily, msp9011, Jeff Schaller, G-Man Aug 17 '18 at 2:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I missed the part where you didn't find any shell init files in the users homes but there are many other ways where the PATH environment variable can be set. I strongly suggest that you do more research into this to develop a better understanding before you delete files in /etc and shell init files in user's homes. A good place to start is the question in Wildcard's comment above. – Nasir Riley Aug 16 '18 at 13:50
  • @NasirRiley yeah, I found one of the culprit.. but I think there's one last file – cevhyruz Aug 16 '18 at 14:03
  • If this is a vm, be sure to take snapshots before altering things in /etc. – Nasir Riley Aug 16 '18 at 16:33

Check the /etc/login.defs and the /etc/environment as well.

More here: Complete view of where the PATH variable is set in bash

  • my /etc/environment doensn't have anything in it.. the /etc/login.def has some text.. I tried commenting out/deleting this line ``` ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games ``` but it still have the path value – cevhyruz Aug 16 '18 at 12:42
  1. On most distributions there is something like (check your /etc/bash.bashrc and /etc/profile for code like this)

    for file in /etc/profile.d/*.sh ; do . $file ; done
  2. There is PAM module called pam_env (man page), which by default sets the environment variables given in /etc/environment.

  • 1
    Those are specifically the files that the OP said that they cleared out. – Jeff Schaller Aug 16 '18 at 12:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.