Skip to main content

All Questions

0 votes
0 answers
42 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
  • 173
3 votes
1 answer
1k views

Command line history from a certain time period?

How do I get command line history from a certain time frame, for example, a list for December 2021? Using bash shell.
Danijel's user avatar
  • 186
-1 votes
1 answer
2k views

How to enable use of cursors to navigate commands in Linux Shell

I'm running a Docker container on Windows to enable me to work with Linux for some projects where that's required. When using the CLI I'm unable to use the cursor keys to navigate the commands / the ...
JohnLBevan's user avatar
0 votes
2 answers
121 views

What are the best tricks to narrow down to the required command among similar looking commands during the reverse search of history

I have lines of codes all of which look similar. Giving some examples below gmx trjconv -s md_0_10.tpr -f md_0_10.xtc -o md_0_10_center.xtc -center -pbc mol -ur compact gmx trjconv -s md_0_10.tpr -f ...
Praveen Kumar-M's user avatar
2 votes
1 answer
172 views

Bash for loop - can the commands in the loop be added to the shell's history?

On the bash terminal if I execute the following for loop: for i in {1..5}; do echo $i; done The echo commands are not added to the history of the current shell. Is it because the commands in for (...
Lavya's user avatar
  • 1,683
0 votes
1 answer
246 views

!! bash command

When we run !! in a shell session, it prints and run last executed command I was wonder if it is an alias for another long-written bash built-in command and would like to know where it is defined I ...
artu-hnrq's user avatar
  • 327
3 votes
3 answers
2k views

How to remove all entries containing particular string from history command in BASH?

Is there any command or way to remove all entries from history of bash shell containing a particular string? this will be useful to remove commands in history containing password. I know we can remove ...
Amol Patil's user avatar
1 vote
2 answers
462 views

Create a wrapper around bash using a bash function

I am kinda wary of messing with bash history settings and I just want to write my own custom bash history. I thought about using a bash function like this: bash(){ # write to a custom history file ...
Alexander Mills's user avatar
2 votes
1 answer
2k views

Is there a way to save all bash commands from all terminals to a single file? [duplicate]

Is there a way to save all bash commands from all terminals to a single file? By default, different terminals have different history and that gets confusing. I'd like to save all history to a single ...
Alexander Mills's user avatar
1 vote
1 answer
612 views

Prevent dangerous commands from going into bash history [duplicate]

What's the easiest way to prevent dangerous commands matching a pattern (like rm) from going into the Bash command history? I'd like to keep them away from the history of the current session, not just ...
Lassi's user avatar
  • 871
4 votes
1 answer
822 views

History expansion in scripts [duplicate]

I have the following Bash script case $- in (*H*) echo enabled ;; (*) echo disabled ;; esac set -H case $- in (*H*) echo enabled ;; (*) echo disabled ;; esac pwd last_command="!!" echo $last_command ...
History_expansion's user avatar
2 votes
3 answers
2k views

Is $PROMPT_COMMAND a colon-separated list?

I want to enable my command history across all terminal tabs and windows to be recorded in .bash_history by setting PROMPT_COMMAND in .profile: export PROMPT_COMMAND="history -a; history -c; ...
bit's user avatar
  • 1,166
0 votes
1 answer
234 views

strange history command with tput

I have this line which keeps appearing in my shell history even when I am not internet connected : cd some_directory && tput cuu1 && tput el Does anyone knows what it does and where ...
John Doe's user avatar
  • 1,011
4 votes
2 answers
2k views

Share shell history across sessions without interleaving it

There is a similar question here, but I want to achieve something different: I would like to share history between sessions, but without mixing the commands that were executed in different sessions ...
Jan Warchoł's user avatar
  • 3,351
0 votes
1 answer
542 views

HISTTIMEFORMAT and deleting matching history entries

I would like to delete all history entries matching a certain string. I found this method: grep -v searchstring "$HISTFILE" > /tmp/history mv /tmp/history "$HISTFILE" but it does not account for ...
Zombo's user avatar
  • 1

15 30 50 per page