Questions tagged [command-history]
recall commands previously typed in a shell or other utility
774 questions
1 vote
0 answers
85 views
Running XFCE on Debian Trixie. Bash history is not saving any sudo commands
Bash history works OK for except for sudo commands. Code from .bashrc follows. How can I modify the behaviour to include anything starting with sudo? NOTE. This behaviour is the same with a brand new ...
1 vote
0 answers
73 views
When was command history feature first introduced?
I'm trying to find out when the first shell (unix or otherwise) was introduced with the feature "press up to edit the previous command". The earliest things I have definite dates for so far ...
0 votes
0 answers
105 views
How to use bash history on a mac?
I've got MacBook from work and try to make it work similar to Linux. This is my config for history in bash: # When the shell exits, append to the history file instead of overwriting it export ...
-2 votes
2 answers
114 views
HISTTIMEFORMAT not working as desired in RHEL 8 bash 4.4.20
so trying to capture history with date and readable timestamps AND the command should appear on same line. following is failing: Bash ver is: GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-...
4 votes
2 answers
306 views
history -cw does not overwrite ~/.bash_history file
I use Arch Linux and bash. I've identified the following and can't understand how it works. The first issue is: history -cw doesn't clear ~/.bash_history file but history -c ; history -w does. The ...
4 votes
0 answers
114 views
Why is `fc` output different through a pipe in a subshell?
Why does echo "$(fc -l -1)" show the previous command, but echo "$(fc -l -1 | cat)" show the current command? $ testfc () { > echo "$(fc -l -1)" > echo &...
0 votes
1 answer
81 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
1 answer
81 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
100 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
138 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
191 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
129 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
152 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....
-2 votes
1 answer
109 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 ...