How to Run a Linux Command Without Saving It in History | Ubuntu 22.04 LTS
Channel: Abu o Techo
Date: 2022-07-30

How to Run a Linux Command Without Saving It in History ?

By default, every command that you execute on your terminal is stored by the shell (command interpreter) in a certain file called a history file or shell command history.

1. You can delete a command immediately from the shell history after running it on the command line by appending the ;history -d $(history 1) command to it.
Ex. echo "This command is not saved in history";history -d $(history 1)

2. Adding the Space in first
$ echo "This command is not prefixed with space, it will be saved in history!"
$  echo "This command is prefixed with space, it will not be saved in history!"

Thank You.

Please Subscribe to the channel