Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start a shell without any user configuration?

I need to use a "clean" shell (e.g. bash) under Linux/OSX terminal without any user configuration, but it reads config info from some files (e.g ~/.bashrc) every time it starts. I can modify the file every time I need a "clean" shell, and revert it back when I finished, but is there any easier ways to do this, for example a command?

like image 923
lil Avatar asked Feb 20 '12 07:02

lil


People also ask

What are the login shell configuration files?

Interactive Login Shell The shell is invoked after a user successfully login into the system, using /bin/login, after reading credentials stored in the /etc/passwd file. When the shell is started as an interactive login shell, it reads the /etc/profile and its user-specific equivalent ~/. bash_profile.

How do I start bash shell?

Press Windows key + X then click Command prompt, at the command prompt, type: bash then hit Enter. If you want to be able to access the local file system, press Windows key + X, Command Prompt (Admin) then type bash at the prompt.


2 Answers

Running bash --noprofile --norc still inherited from parent process. Based on a similar question I found that the way I interpreted this question env -i bash --norc --noprofile was what I would want.

like image 134
nnutter Avatar answered Sep 25 '22 06:09

nnutter


You can pass the --noprofile and --norc command-line options:

$ bash --noprofile --norc 

You will find documentation about these options in the man page.

like image 36
Frédéric Hamidi Avatar answered Sep 24 '22 06:09

Frédéric Hamidi