Skip to main content

Questions tagged [command-history]

recall commands previously typed in a shell or other utility

Filter by
Sorted by
Tagged with
1 vote
1 answer
68 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 ...
Nour's user avatar
  • 115
0 votes
1 answer
73 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?
Xoteric's user avatar
0 votes
1 answer
52 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 ...
Mark's user avatar
  • 4,304
1 vote
1 answer
23 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), ...
Mario's user avatar
  • 163
1 vote
1 answer
32 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, ...
Compiled's user avatar
2 votes
1 answer
47 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 ...
dawid's user avatar
  • 201
8 votes
1 answer
1k views

What is the '.tee_history' file?

This is a plaintext file, apparently limited to 300 lines. I use tee frequently on my system. $ file .tee_history .tee_history: Unicode text, UTF-8 text $ wc -l .tee_history 300 .tee_history $ tee --...
user598527's user avatar
1 vote
1 answer
40 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 ...
raddevus's user avatar
  • 123
1 vote
2 answers
122 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. ...
Jesse's user avatar
  • 351
0 votes
0 answers
34 views

How do I execute a command but only add a *modified* version of it to the history?

I'm trying to create an analog of the command history, but for the output of the commands, so that I can do e.g. locate filename (which might display several files) and then vim %2 (or whatever) to ...
colinh's user avatar
  • 47
1 vote
1 answer
142 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 ...
Duncan Marshall's user avatar
0 votes
0 answers
47 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 ...
Dimitris Tsiaousidis's user avatar
0 votes
1 answer
33 views

Where to know what version of native Linux command got the specific feature?

I have lscpu Linux command with specific attribute -J allows to output in JSON format. I want to use the command at hundreds of hosts with different Linux distros to get the CPU information. I want to ...
Aleksey's user avatar
  • 25
1 vote
0 answers
81 views

zsh: access history from other zsh sessions, but only by a select method, not by default (i.e. reverse incremental search, history stack)

Please bear with me, this is not just another question about basic history control options, and I think it has a solid use case. Use case I have many instances of zsh running (tmux with tmux continuum ...
Life5ign's user avatar
  • 113
1 vote
0 answers
59 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 ...
Croad Langshan's user avatar
1 vote
1 answer
69 views

Why is the duration column in .zsh_history usually 0, although the "history -D" command displays it?

Why is the duration column in .zsh_history usually 0, although the "history -D" command displays it? After testing this answer to What is the purpose of the column with the '0' after ...
vfclists's user avatar
  • 7,619
2 votes
1 answer
138 views

What is the purpose of the column with the '0' after the numeric timestamp in .zsh_history?

What is the purpose of the column with 0 after the numeric timestamp in .zsh_history? : 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/.zshrc : 1568128381:0;exit Is it part of the timestamp or does it ...
vfclists's user avatar
  • 7,619
0 votes
2 answers
75 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, ...
zwhconst's user avatar
  • 125
1 vote
1 answer
328 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 ...
Marc C's user avatar
  • 11
0 votes
2 answers
252 views

Clear shell history on shutdown/logout

I want to clear my shell history on every shutdown/logout. I know how to clear the history manually, I know how to clear the history automatically, when closing the session/terminal emulator. However, ...
grbll's user avatar
  • 35
0 votes
0 answers
77 views

In the AWS linux terminal every time I run the history command the numbering changes

This makes it impossible to reference previous commands by number. $ history | tail -3 6691 git push -f 6692 history 6693 history | tail -3 s4dad\patrant@a-48265ltymm4y:~/eyp-source/d8 (feature/...
Tony Patrinos's user avatar
2 votes
1 answer
119 views

Bash/zsh insert history / ctrl-R inline?

Ctrl-R in bash and zsh is very useful. So is the !! alias - which expands to the last command. I often find myself doing things like: cat file | !!, before pressing tab to tweak the command. I would ...
Att Righ's user avatar
  • 1,226
2 votes
1 answer
73 views

How to edit and execute a couple of commands from shell history?

Every now and then I want to recycle a command sequence I recently used, after I adapted it. Let's imagine, yesterday I executed foo 42 bar with some strange arguments baz /my/most/beloved/folder Now ...
Philippos's user avatar
  • 13.5k
6 votes
1 answer
170 views

How can I force zsh to write automatically complete path to history?

Suppose I did some time ago cd /path/to/foo/bar and then evince file.pdf. Now if I want to open file.pdf again I have also to do both steps again (using history). However I would do it in a single ...
student's user avatar
  • 18.5k
0 votes
1 answer
208 views

Command line / prompt is broken, cannot edit (WSL2)

I'm using Windows 10 with WSL2. In all the terminals I have tried so far, I quickly encounter a broken command line. After pressing ENTER, the actual command appears differently, parts of the command ...
Alexander Nenashev's user avatar
7 votes
2 answers
1k views

Echoing "!" inside a string does some weird things [duplicate]

If I type in this: echo "Hello, World!" I don't know the name of it, but it prompts me for the next line. You know the PS2 thing. Or if you type echo \ and press Enter. Why? Well I know ...
Bog's user avatar
  • 1,034
1 vote
1 answer
59 views

How to search for strings in the output of previously run commands

Say, for example that after running a number of commands: $ cd /opt/something $ find . -name *aa | grep 11 $ clear $ <more commands go here> there was a part of the output that was needed ...
Sebi's user avatar
  • 1,029
1 vote
0 answers
665 views

How do I change an oh-my-zsh bindkey that a plug-in set?

You can find most of the context on this github comment. I installed the zsh-autocomplete plugin and it adds a feature I don't want: pressing up fills the page with a menu of previous commands I've ...
Daniel Kaplan's user avatar
3 votes
3 answers
350 views

How to remove long commands from the bash history

Is there an easy way (i.e. bash command) to remove commands that are excessively long from my bash history? Some long commands are basically making CTRL-R unusable. (Ideally I would also not save ...
Kvothe's user avatar
  • 433
0 votes
0 answers
146 views

set histchars not working in zsh

Consider the following commands for overriding the history expansion characters (which I got from Learning Shell Scripting with ZSH book): % set histchars='@^#' % ls *.txt file1.txt file2.txt % @@ ...
Attilio's user avatar
  • 365
3 votes
2 answers
8k views

How do I get terminal to print command history with timestamps for all commands

I'm trying to get my terminal (macOS) to print the previous commands that I've used, as well as the timestamps to go with them. I know that if I use history man, it will give me a list of the past ...
AlekNaomie BurtPilon's user avatar
4 votes
1 answer
269 views

Fish equivalent of Bash / readline's Ctrl-O "operate-and-get-next"

Readline and therefore Bash have a very useful command called operate-and-get-next, bound by default to Ctrl-O, that executes the current line, after selecting it from the history, and advances the ...
Tobia's user avatar
  • 689
0 votes
0 answers
40 views

What does !^ (exclamation mark caret) do in bash? [duplicate]

Does anyone know what the command !^ does in the bash shell? I know ! relates to history expansion and ^ relates to command substitution (when it's not being used in a regular expression when it ...
geckels1's user avatar
  • 163
-1 votes
1 answer
197 views

Remove trailing whitespace before saving into the command history

When I paste a command to the terminal, sometimes it ends with some newline or space characters depending on where I copied from. The trailing whitespace characters are typically useless (they don’t ...
Franklin Yu's user avatar
  • 1,239
0 votes
1 answer
281 views

How to exit from root to user in the recovery menu?

A newcomer to linux here, I was trying to set a custom display resolution and make the changes permanent but looks like I've forgotten something and the login screen won't come up (the only thing I'm ...
user668687's user avatar
2 votes
1 answer
567 views

Why does `erasedups` not work as expected?

The Stage sam@x230:~$ grep -E '^VERSION=|^NAME=' /etc/os-release NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" sam@x230:~$ echo ${BASH_VERSINFO[@]} 5 0 17 1 release x86_64-pc-...
Samveen's user avatar
  • 165
0 votes
2 answers
173 views

Does any shell dynamically append history?

Does any shell dynamically append history, such that the history survives a crash?
gregrwm's user avatar
  • 71
4 votes
0 answers
267 views

How to add the expanded version of commands involving fzf to history?

Say I would like to edit a file ./long/path/to/my/file/test.py with Vim, but I do not remember the path to the file. In this case, I would run vim `fzf` to use fuzzy search to find and edit the file. ...
Matt's user avatar
  • 181
0 votes
1 answer
190 views

How may I uninstall the "ps" (process status) utility on a *nix system?

I have heard that ps (process status) can store users' commands history, like what shell history does. Source: comment on StackOverflow, Note that if the goal is to hide passwords in command line ...
rm -rf's user avatar
  • 3
4 votes
1 answer
236 views

Cannot modify bash history inside command_not_found_handle function

I'm trying to make my own command_not_found_handle function, which on given a wrong command, asks the user with the most identical command if that was what he meant. If the user accepts that ...
Sunlight's user avatar
1 vote
2 answers
440 views

How to get a Terminator Layout Command to show up in history?

I've discovered the joy saving Terminator layouts and adding commands to ~/.config/terminator/config that are run when it starts up. I've also discovered that hitting Ctrl+c to stop a watch command ...
candied_orange's user avatar
1 vote
1 answer
124 views

bash: function with history -d won't remove history entry

After reading some posts, could not figure out how comes history -d 1 in a function does not delete the entry. The function below goes directly to the command line: function test () { echo "...
rellampec's user avatar
  • 123
0 votes
1 answer
100 views

Search in whole .bash_history list with full-featured regex engine

When I have to search backwards in the .bash_history list I want to see the timestamps as were created by HISTTIMEFORMAT. And the results have to end up in a pager, where regex can be used for ...
Anton Wessel's user avatar
1 vote
1 answer
30 views

Can bash_history save evaluated commands output?

Is there a way for bash or other shells' history to save the output of evaluated commands when it's a parameter? $ echo $(pwd) && history /root 0 I want something like: 1 echo $(pwd) &...
Jesse Taube's user avatar
-2 votes
1 answer
93 views

How to timeout firefox kali linux

I want to timeout Firefox on Kali linux with a command. Can you help me? I tried sleep 10 and kill firefox 10.nothing happend after i done this
Türkeitürkei's user avatar
3 votes
0 answers
368 views

Command line history in the fish shell suffering from short term memory issues

Over the last few months, I've been trying out the fish shell as my interactive shell. One issue that somewhat irritates me is that the shell occasionally forgets recent commands from its command ...
Kusalananda's user avatar
  • 339k
1 vote
1 answer
3k views

Reverse Search (CTRL + R) no longer searching in .zsh_history

Until recently I used Ctrl+R to search for recent commands in my terminal which uses the zsh shell. The search included commands from previous sessions which were saved in my ~/.zsh_history file. Now ...
mark's user avatar
  • 113
2 votes
1 answer
68 views

How to automatically clear the terminal before reverse search?

I was wondering if it is possible to run the clear command automatically when I initiate a reverse search with CTRLR. I am familiar with the precmd function in zsh, but do not know how to limit it to ...
Matt's user avatar
  • 181
1 vote
1 answer
51 views

Bash meta-history: recall bash history modification to prompt?

With !!:gs/foo/bar/ I can modify a previous bash command. Is there any way I can recall the history modification command to the prompt (rather than the result of the modification) in order to be ...
loris's user avatar
  • 195
3 votes
1 answer
472 views

How to do smart backups of terminal history

Trying to implement smart backups of my zsh terminal history (~/.zsh_history). Same goes for bash no difference just the file is called .bash_history. So far I have decided to create a private git ...
dobro's user avatar
  • 31

1
2 3 4 5
16