Commands to clear or disable Bash history, stop logging to history files, truncate auth logs, terminate the current shell, and redirect history output to /dev/null. Includes corrected syntax and a few related essentials for controlling traces and sessions.
-
: > /var/log/auth.log
Truncates
/var/log/auth.logto zero bytes (clears contents without deleting the file).
(echo "" /var/log/auth.logcorrected; that would only print to stdout unless redirected.) -
echo "" > /var/log/auth.log
Overwrites the log with a single blank line (also effectively clears). Requires root.
-
echo '' > ~/.bash_history
Overwrites the current user’s history file with empty content (clears saved history file).
(Yourecho '''' -/.bash historycorrected to a working path and redirection.) -
rm -rf ~/.bash_historyDeletes the user’s
.bash_historyfile.
(Yourrm -/.bash history/ -rfcorrected.) -
history -cClears the in-memory history list for the current shell session.
-
export HISTFILESIZE=0Sets maximum number of lines stored in the history file to 0 (prevents writing history lines to file in many setups).
-
export HISTSIZE=0Sets maximum number of commands kept in memory history to 0 (limits/blocks session history).
-
unset HISTFILEUnsets the variable that points to the history file; the shell won’t write history to a file. Often takes effect fully after starting a new shell/login.
-
Immediately kills the current shell process (
kill -9 $$
$$is current shell PID). This terminates your current session.
(Your “Delete the current meeting” interpreted as ending the current session.)
-
Replaces
ln -sf /dev/null ~/.bash_history~/.bash_historywith a symlink to/dev/null, so attempts to write history are discarded.
(Yourln /dev/null -/.bash_historj -sfcorrected.)
-
history -wForces the current session history to be written to the history file (useful to know because it can re-populate the file if you cleared it but didn’t stop writes).
-
history -aAppends session history to the history file (commonly used in multi-terminal setups).
-
history -rReloads history file into the current shell (can bring back lines you thought were gone).
-
export HISTCONTROL=ignorespaceCommands starting with a leading space are not saved to history (if the shell is configured to honor this).
-
export HISTCONTROL=ignorebothIgnores duplicate commands and commands starting with a space.
-
export HISTTIMEFORMAT=""
Removes timestamps from
historyoutput (if previously enabled). -
: > ~/.bash_history && history -c
Common pair: clears the on-disk history file and the in-memory history list.