Questions tagged [command-history]
recall commands previously typed in a shell or other utility
767 questions
0
votes
0
answers
7
views
local zsh history on up-arrow, global zsh-history on ctrl-R
I am looking for a very specific behavior in my Zsh terminals.
I have multiple terminal windows open at the same time.
On each terminal window, if I hit the up arrow, I'd like for it to go up through ...
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
0
answers
42
views
"history-search-backward" but ignore sudo prefix in zsh?
According to this page: https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html
history-search-backward: "Search backward in the history for a line beginning with the first word in the buffer....
-1
votes
1
answer
62
views
"history -0" works in ksh, why doesn't "history -0" work in zsh?
Why does ksh history -0 (last command which is the history command itself) work, yet zsh it fails (only history -1 avail on my zsh). I tried zsh -f to use default options and it still fails.
I'm ...
1
vote
2
answers
56
views
Up-arrow does not complete the typed command in gdb, but instead iterates through all the history
I am having trouble with gdb. When I start pushing the Up Arrow key, it iterates backwards through the history. However, if I start typing a command, like b, instead of iterating only through history ...
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 ...
3
votes
2
answers
445
views
"history" command ordered by most common
Can I get the output of history sorted in order of most-used?
I know how to do it in a programming language, but not from the shell. In my case I'm on macOS with zsh.
I know I could use uniq and sort ...
3
votes
1
answer
426
views
Equivalent of PSReadLine for bash (or whatever linux shell) as you type
I'm aware of this question Equivalent of PSReadLine for bash
But sadly it is still not close enough for me, all of the suggestions requires to press either tab, or ctrl + r or whatever, while ...
0
votes
1
answer
271
views
Why Is OpenBSD History Not Persistent?
I installed OpenBSD and quickly realised that the history is not persistent. I'm guessing this is a security related feature. But I don't know why this is a good idea. Anyone?
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
34
views
Maintain position in terminal command history on macOS?
I enter many commands into the terminal. I enter command a, then b, then c, etc. I'm on command g now but I want to execute a, then b, then c, again.
I press up (g), up (f), up (e), up (d), up (c), ...
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, ...