From the course: Linux: Shells and Processes

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Configure shell history

Configure shell history - Linux Tutorial

From the course: Linux: Shells and Processes

Configure shell history

- [Instructor] There may be times that you do not want commands recorded in your command history. For instance, if you type ls or pwd a lot, your history will become polluted with these two commands, making it harder to see the commands you really want to recall. In this case, you can set a shell variable called HISTCONTROL. To change the value of this variable, type into a terminal, HISTCONTROL="ignorespace" and hit Enter. Now, when you want to run a command and do not want it to be recorded in the command history, prepend the command with a space. Let's test this by placing a space before the history command and see if it gets recorded. Type in " history" and hit Enter. And we can see that it did not. This is a simple way of keeping your history clean if you can remember to type the space. Another value for this option is ignoredups. Ignoredups option does not allow recording duplicate entries. Bring a line…

Contents