In certain situations, you may need to run commands in the shell without having them saved in the shell history. If you are using Fish Shell, which happens to be my default shell, you can accomplish this quite easily. The following steps outline how to achieve this:
- Start a new shell instance with the following command:
fish --private
This will initiate a new shell session that will not record any commands to the history.
-
Execute the commands that you do not want to be stored in the history within this new shell session.
-
Once you have completed running the desired commands, you can exit the shell by typing “exit” or pressing Ctrl+D.
By following these steps, Fish Shell allows you to work with sensitive information or perform tasks without worrying about them being recorded in the shell history.
If you’re interested in learning more about Fish Shell and its fundamentals, I have written an article specifically on Fish Shell basics. I highly recommend Fish Shell due to its simplicity and its focus on providing a hassle-free experience.