All Questions
Tagged with bash command-history
446 questions
7
votes
3
answers
1k
views
How to properly protect .bash_history against truncation?
What can I do so that my .bash_history is only aver appended to?
I am working in a lot of environments, like singularity, apptainer, docker, podman and ssh with various settings and mounts. Each of ...
1
vote
1
answer
81
views
Ctrl-x Ctrl-e bash how to edit previous multiline command
In bash want to re-edit a multiline command (that I invoked previously) with Ctrl-x Ctrl-e. This will open vim (for me) and letting me type the command. Now with all the bells and whistles set (ref):
...
0
votes
1
answer
63
views
Using bash history expansion, how do I rerun the last command with a different last word?
NOTE: I plan on answering my own question.
This is the last command I ran on the command line:
git co head -- a/path/to/a/file.ts
I want to run this a few more times but with different file paths for ...
0
votes
1
answer
83
views
.bash_history retroactively recover timestamp for past commands [duplicate]
I have a question about the .bash_history file. First of all which one? Because there's one called .bash_history in my home, and then a bounch of other .bash_history-xxxxx.tmp where every x is a digit....
-1
votes
1
answer
84
views
Bash setting on duplicate history lines doesn't work
Why does the Bash setting on duplication affairs not work? In .bashrc:
export HISTCONTROL=erasedups:ignoredups
It keeps recording ie. writing every command typed in CLI into .bash_history
EDIT :
That ...
0
votes
1
answer
79
views
How can I exclude things from .bash_history? [duplicate]
Every time I run a program using the VSCode debugger, a line such as
/usr/bin/env /bin/sh /tmp/Microsoft-MIEngine-Cmd-agft2qoj.y5y
or
/usr/bin/env /bin/sh /tmp/Microsoft-MIEngine-Cmd-1ai4zqj4.nob
...
1
vote
1
answer
90
views
How to Set Up Individual Bash History Files for Each Container Alongside a Unified History File?
In my current setup, all of my bash histories are stored in a single file, which is pointed to HISTFILE.
This history includes a history of the host system and all containers.
Along with this history, ...
2
votes
1
answer
54
views
How to make bash save a command to history at the moment a time-intensive command is issued, instead of only after the command ends or is killed?
There are many questions with similar wording regarding how to save commands before exiting the session which answer something else (PROMPT_COMMAND='history -a', histopt etc.).
This question has a ...
1
vote
1
answer
88
views
Why doesn't my sqlite3 history work after I run a dotnet core web app?
Over the past year or two I've been using sqlite3 a lot for web development projects.
Invariably I would stumble upon a problem where suddenly, the history of commands would no longer work (when ...
1
vote
2
answers
181
views
Hide single argument from bash history
Is there a way to hide a single argument passed into the terminal, but still pass the argument to the command?
This question addresses the problem of passing a plain-text password through the shell.
...
1
vote
1
answer
498
views
I can't get bash history to update instantly in all terminals
I'm using a fresh install of Ubuntu 22.04.3, with gnome-terminal, and I haven't directly edited ~/.bashrc. Various sources say adding the following to it achieves what I'm looking for:
shopt -s ...
0
votes
0
answers
49
views
.bash_history stops at 10000 lines [duplicate]
I work in a cluster with mobaxterm. The typed commands are saved in the .bash_history .
But my problem is that .bash_history stops at 10000 lines. Then, the older commands in the beginning of the file ...
1
vote
0
answers
69
views
Why does bash only sometimes read #-commented commands from history
On my Arch Linux machine (5.2.15), history navigation with the arrow keys sees commands in ~/.bash_history that start with the # character.
On my Mac OS machine (bash 3.2.57), history navigation with ...
0
votes
2
answers
103
views
What is the hot key to show the next command of the previous command in history in Linux/bash?
In Windows cmd window, let's say I type and execute 40 commands like this:
echo 1[Enter]
echo 2[Enter]
echo 3[Enter]
...
echo 40[Enter]
If I decide to repeat the 40 commands again, in the same order, ...
1
vote
1
answer
495
views
How can multi-command lines be kept from being recorded in bash history?
There are certain products like vulnerability scanners that log into Linux hosts as a specified user and end up "polluting" the bash history of the account in question. Here is an example of ...