Reset Your Terminal in Linux

Reset The Linux Terminal

Want to know how to reset your terminal in Linux? Sometimes you may accidentally redirect binary output to your terminal and would need to reset it so that all the text clears out and you have your scrollbar back.

Other times you might have messed up your .bashrc configs and simply want to reset it. In this article, we will look into all of these possibilities and ways to reset the terminal.

Clear Out the Screen and Bring Back the Scrollbar!

So, our first scenario is that we have somehow run through a lot of commands and filled up the screen of the terminal. The scrollbar is barely visible and you are unable to move it around.

You may notice that using the clear command only works partially in this case, as it doesn’t clear out the screen in the true sense, it just positions the cursor to the top of the page.

The scrollbar is still left as small as it was in the first place. In this scenario, the reset command is at our rescue. Simply type in “reset” and voila! You’re terminal will be “reset” in its truest form!

Reset .bashrc

If you find yourself in such a position, we are here to rescue you. Before resetting the .bashrc though, you want to backup the affected one. We’ll rename the .bashrc so the file doesn’t get overwritten by the system.

mv .bashrc .bashrc_old

Now copy the system bashrc skeleton file into your home directory, reboot the system and you’re done! Run the following command to do so:

cp /etc/skel/.bashrc ./ && reboot

Clear all the terminal history

There might be times when you had to run several commands and do not want your peers to know about it. You will simply have to redirect dev/null to the bash_history file and no one will know the difference.

 cat /dev/null > ~/.bash_history && history -c && reset

GUI Solution to reset the Linux terminal

If you are one of the rare GUI enthusiasts out there, you might be able to find a reset and clear option on the GUI interface very similar to the ones we have been working with up until now.

There also might be some keybinds to get the job done quickly and easily. Ctrl+C in default Ubuntu will clear out the terminal of any text it might have. Similarly, the “reset and clear” option under the “edit” flag on the GUI of the Gnome-terminal will clear out and reset the terminal efficiently.

Conclusion

Whatever might your need be to clear or reset the Linux terminal, we hope you have found the best way that fits your needs. These simple know-how of commands, GUI Interfaces and keybinds will definitely add to your developer skills. We hope you have learned something new from this article and as always, thanks for reading.