command-history

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?

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 …

Total answers: 1

What is the '.tee_history' file?

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 –version tee (GNU coreutils) 9.3 I have no use for the history. Can this logging be easily …

Total answers: 1

Why doesn't my sqlite3 history work after I run a dotnet core web app?

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 pressing up arrow you get command history, …

Total answers: 1

Hide single argument from bash history

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. But, even if not a password, there is a use for selective arguments to be …

Total answers: 2

I can't get bash history to update instantly in all terminals

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 histappend PROMPT_COMMAND="history -a;$PROMPT_COMMAND" I then source ~/.bashrc. What I want is for the …

Total answers: 1

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 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 serve a different purpose altogether? Asked By: vfclists …

Total answers: 1

Clear shell history on shutdown/logout

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, this is not the intended behaviour. I am using zsh on manjaro with wayland and sway. I have …

Total answers: 2

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

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 prompt are deleted, editing does not occur at the cursor position, and …

Total answers: 1

Echoing "!" inside a string does some weird things

Echoing "!" inside a string does some weird things 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 that ! is a Special Variable …

Total answers: 2

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

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 but not saved; the command …

Total answers: 1

How to remove long commands from the bash history

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 excessively long commands to the history in the future.) Asked By: Kvothe || …

Total answers: 3

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

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 arguments, they’ll still be visible through ps – Benitok …

Total answers: 1

Cannot modify bash history inside command_not_found_handle function

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 suggestion then it should delete the last command (the wrong command) from the history and …

Total answers: 1

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

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 "HISTFILE: ‘${HISTFILE}’" history -d 1 } Then we run: history -c …

Total answers: 1

Can bash_history save evaluated commands output?

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) && history 2 echo /root && history VS $ echo $(pwd) && history /root …

Total answers: 1

How to increase the size of the .ed_history file

How to increase the size of the .ed_history file I am running GNU ed 1.18 on Fedora Linux 36. I run ed with rlwrap also installed which gives me access to my command history. My .ed_history file appears to have a size limit of 300 lines. I would like to increase that limit, perhaps to …

Total answers: 1

like history and fc but for a personalized list of useful commands

like history and fc but for a personalized list of useful commands I have spent a few hours trying to get an easy access to my most useful commands I have to use in a certain environment, I have the "incredible" idea of using history for that purpose, to summarize, I have a file named …

Total answers: 2

Exporting zsh history separated by ‘’ characters instead of ‘n’

Exporting zsh history separated by ‘’ characters instead of ‘n’ I want to access zsh history with entries separated out by instead of n. The built-in parser can clearly handle multiline entries, because fc 123 brings up an editor with newlines preserved. However, fc -l 123 (which prints to stdout instead of starting an editor) …

Total answers: 2