This is courtesy of https://stackoverflow.com/questions/9357464/how-to-start-a-shell-without-any-user-configuration, and is useful for working on Bash Prompts or any form of shell scripting where Bash's mysterious start-up process has got you stumped. Trying to trace the maze of Bash start-up files has driven better coders than me around the bend, and sometimes all you want is a shell with NO configuration. You'd think, from the Bash man page, that bash --noprofile --norc
would do it, but - as is pointed out in the second (unchecked but better) answer at stackoverflow, the shell will still inherit from its parent shell. To get a truly unconfigured Bash experience:
$ env -i bash --noprofile --norc
This lands me at a horrible old-school Bash prompt: bash-5.0$
. Which is actually exactly what I want, although I usually use this:
$ xterm -e env -i bash --noprofile --norc &
to start the new shell in a separate terminal window. This assumes you have xterm
installed: I recommend it, but it's too basic for many people. Your terminal program may support the -e
switch, most do. If not, you'll have to look up your terminal's command line parameters.