Skip to main content

Questions tagged [command-history]

Questions relating to the command history features of command-line shells like Windows' CMD and Bash on Unix-based systems - features that store and deal with previously-executed shell commands.

Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

Store output of command history

Is there some way to record not only the commands that I type in my terminal, but also their ouput? Is there maybe something that I can add to my .bashrc that could act similar to passing all commands ...
TheFibonacciEffect's user avatar
0 votes
0 answers
582 views

How can fzf's command history search always be shown, automatically and without CTRL-R?

With fzf you can press CTRL-R to have a command history search box shown below the prompt and fuzzy search. I want it shown automatically for each new prompt, without having to press CTRL-R.
Oneechan69's user avatar
0 votes
0 answers
40 views

How can I complete individual command line phrases / do partial completion with fzf?

With fzf I can press CTRL-R to search my command history but it completes the whole command. What I'd like is to just complete the current argument, the next phrase before the next space. Can this be ...
Oneechan69's user avatar
0 votes
2 answers
261 views

Echo the exact command used to start a Bash script

I'd like to give feedback to the user of a bash script along the lines of "You've run the following command <exact command the user entered>, better to run it like this <better command&...
Johannes Bauer's user avatar
0 votes
2 answers
576 views

How to configure the user's terminal history in Synology DSM?

The history is limited by 100 entries. In other Linux distros I can configure that in the ~/.bashrc of my user. But in DSM I found no such a file. So, how to set the $HISTSIZE and the $HISTFILESIZE (...
automatix's user avatar
  • 1,425
0 votes
0 answers
28 views

Modify inputrc/set readline to allow down arrow to remove unfinished command from history

On default Fedora and Debian and probably other distro installations one can type into bash and cycle previous history using up arrow and get back to the unfinished command using down arrow. Pressing ...
Yetoo's user avatar
  • 13
0 votes
0 answers
64 views

in bash: how to execute automatically a command when any commamd is invoked, like by PROMPT_COMMAND, but not awaitng next prompt?

Now I use the PROMPT_COMMAND to automatically execute "history -a" to append the history list to HISTFILE. As suggested in many internet articles. Additionally I have arranged that after ...
Anton Wessel's user avatar
0 votes
0 answers
137 views

How to check what is controlling/restarting a Windows Service or view its errors?

There are services which can be found in services.msc As example, WlanSvc the WLAN AutoConfig. How can I check which "thing" initiated a Stop or a Restart on a service? With "thing"...
karl-police's user avatar
0 votes
1 answer
230 views

In Bash, how can I read the value of readline variable named `history-size`?

My Bash version I have updated from v590 to version 5.2.15(1)-release (i686-pc-linux-gnu). I use Kubuntu 20.04 and KNOPPIX 9.1. The readline variable history-size can be set to on or off, can be bind ...
Anton Wessel's user avatar
2 votes
1 answer
1k views

Configure Visual Studio Code to share same terminal history from zsh?

I use both the built-in terminal of VScode + terminal (zsh) on Mac. I'm under the impression they used to share the same history but not anymore. Ideally a command I type in either would be ...
Fabiano Soriani's user avatar
0 votes
0 answers
482 views

How to log Linux commands ran from a script?

I am able to log commands executed on bash shell using export PROMPT_COMMAND='history -a > ..... , but this wont log commands executed from within a shell script. Is there any way to log command ...
Harish Reddy's user avatar
6 votes
2 answers
5k views

Powershell history isn't persistent anymore

Powershell stopped using its persistent history (Windows 11). When I start a new Powershell instance commands from previous sessions don't show up. Once I use commands in the new session for the first ...
Albin's user avatar
  • 10.8k
0 votes
1 answer
147 views

PowerShell falling short on performance when wildcard used multiple times for deleting files matching specific filename patterns

As I mentioned in Q-title, I have put together fairly well-built function for clearing history completely (not keeping any ugly junks or leftovers). But it seems that due to multiple occurrences of ...
Vicky Dev's user avatar
  • 472
0 votes
1 answer
356 views

zsh is not completing multiple commands with up arrow

Im using zsh with this plugin: zsh-history-substring-search When I type for example sudo pacman <UPArrow> It show some commands starting with sudo pacman, but it also show command starting only ...
T0maas's user avatar
  • 181
1 vote
1 answer
937 views

deleting history in server using history -cw

I have deleted my history in server as a user history -cw Will this delete history for all users including superuser and will he see that I used the history -cw ?
nolymp's user avatar
  • 13
3 votes
2 answers
18k views

Is there a way to view or store file history (like browser history) in Linux?

Is there any way to "view" (or) "store" file history (similar to browser history). For example if I have 10 files, and I open 2 of them, the following 2 details should get stored ...
kkk's user avatar
  • 33
8 votes
3 answers
3k views

How to delete history lines when browsing history with fzf

There are often items in the bash history which I don't need anymore and/or are so long that when used with fzf match pretty much any text entered, making fuzzy matching on the history a bit useless. ...
stijn's user avatar
  • 2,047
0 votes
0 answers
188 views

Count all called programs/commands from ~/.bash_history

I want to extract all the commands/programs in ~/.bash_history and count how many times each one was called. The arguments to the programs are irrelevant and should be ignored. I used this bash ...
12431234123412341234123's user avatar
5 votes
1 answer
5k views

Make zsh history search behave like bash reverse-i-search

In bash, pressing [CTRL]+[r] will open the reverse-i-search prompt. How can I search the zsh history in a similar way? Note: The search query will hit the middle of the full command only, instead of ...
Semnodime's user avatar
  • 402
3 votes
3 answers
2k views

How to setup zsh to append history to a file named dynamically by date

My biggest sticking point moving from bash to zsh is the history configuration. Using oh-my-zsh there is a history.zsh file in #ZSH/lib that I found (I think) can be disabled via unsetopt ...
rsmets's user avatar
  • 81
1 vote
1 answer
202 views

Get up-arrow key to only show unique commands? GHC Haskell

Haskell uses the GHC (Glasgow Haskell Compiler) which is basically a command line interface to compile and run Haskell. Like many popular CLI's, GHC allows you to use the up and down arrow keys to ...
Prithvi Boinpally's user avatar
0 votes
1 answer
664 views

centos history command delete flag throws how to use

When I try to delete a specific command from the history on centos Linux 3.10.0-693.21.1.e17.x86_64 #SMP on trying history -d 34 I get an error saying Usage: history [-chrSLMT] [# number of events].
Ciasto piekarz's user avatar
1 vote
0 answers
2k views

Powershell persistent history in the ISE

(EDIT 2: now including the output of Get-Module) In a Powershell prompt I have persistent history across sessions (see this related question). But when I launch the Powershell ISE, I do not have ...
sancho.s ReinstateMonicaCellio's user avatar
0 votes
0 answers
903 views

Command history lost

Is there a way to know if someone (including system administrators) has deleted the bash commands history on purpose? (the history -r doesn't seem to work) And is there any way to recover that history?...
noureddine-as's user avatar
1 vote
3 answers
135 views

Forget history position

Currently I using Bash with Cygwin. With Bash, I can enter these commands: $ date Thu, Apr 23, 2020 7:51:43 PM $ echo Sunday Sunday Then if I press Up twice, I get this, as expected: $ date If I ...
Zombo's user avatar
  • 1
1 vote
1 answer
137 views

How to search backwards in zsh/bash BUT relative to directory

Problem: In the terminal, when I press Ctrl+R to do a backward-search using the zsh/bash history, it searches all commands sorted by most recently used. Problem is some commands are completely ...
hbt's user avatar
  • 1,621
0 votes
1 answer
410 views

How many ways are there to trace a user`s login and used commands in Linux after they deleted it (somehow)?

I am looking for a way to prove that my colleague at work did some changes to a configuration file while working with me on this case and now there are consequences because of his actions. I checked ...
Tayriel's user avatar
0 votes
1 answer
236 views

History of the run command box in Ubuntu

Most Linux desktops have a dialog box that opens at the press of alt+F2 where you can run simple commands like suspend and shutdown. Where is the history of commands of this dialog box stored? I know ...
raghunandan rajkumar's user avatar
1 vote
2 answers
2k views

infinite history in bash, when using multiple terminals(terminator) without losing commands and messed up order

I want infinite history, because I type a lot of commands I can forget at the spot and would like to have it stored somewhere as a reference. But by just setting HISTSIZE and HISTFILESIZE it does not ...
Martin Mucha's user avatar
1 vote
1 answer
245 views

How much time has passed since first command in zsh

By executing this command, ❯ fc -l -1 | awk 'END{print $1}' 8845 I can see that I have 8845 commands in my history file. And I'm using zsh, so my history file looks like this: ❯ head $HISTFILE ...
Amir Shabani's user avatar
2 votes
3 answers
9k views

Show sudo history in history command?

I want to show which user turns to root in history command or in logs As we have multiple users which turn to root using sudo sudo -i and we are not able to track which users turns root and runs ...
coolvik's user avatar
  • 21
0 votes
1 answer
4k views

How to have a single history from all bash terminals?

I typically have multiple bash terminals open and I would like for the commands from all terminal sessions to go into a single history file, so I can see my command history chronological order across ...
James Adams's user avatar
3 votes
0 answers
421 views

Setting Bash history sizes to -1 clears the history

I want to save all my bash history so I set my Bash history sizes in ~/.bash_profile to negative values: export HISTSIZE=-1 export HISTFILESIZE=-1 According to the Bash reference manual, all my ...
emonigma's user avatar
  • 2,037
0 votes
1 answer
81 views

Command executed via ssh

On CentOS 6, how can I tell what commands were executed via someone that ssh'ed into as root? I looked in /root/.bash_history. I also ssh'ed into myself and did a history but the only commands I ...
user1018033's user avatar
1 vote
1 answer
191 views

Custom bash client history overlap

I am writing a client for doing various tasks on the zimbra server via ssh, and I've hit a bit of a snag. Here's the code: #!/bin/bash set -e export PATH=/usr/bin:/bin:/usr/sbin:/sbin export ...
gtxcpr's user avatar
  • 13
0 votes
1 answer
93 views

Calling back history in bash

I am a huge fan of this magic in my .inputrc which allow me to quickly autocomplete a command with the up arrow key. "\e[A": history-search-backward "\e[B": history-search-forward "\eOA": history-...
nowox's user avatar
  • 2,889
0 votes
4 answers
7k views

When I try to change the directory on Ubuntu, it won't let me

When I type in cd Desktop/Code and then press Enter, it says -bash: cd: DesktopCode: No such file or directory I do have that file in my desktop, but I'm not sure how to access it and I'm not sure ...
Gabriel L.'s user avatar
2 votes
1 answer
470 views

Why Bash does not scan all of its own history file

I use a common history for all sessions. It happens to me frequently, that a part of the history is lost, however. Therefore, I just swap different "common session" scripts in a hope that one will fix ...
scriptfoo's user avatar
  • 131
0 votes
0 answers
198 views

Is there a way to preload previous commands into a cmd window without running them?

So that I can just press up and get a list of commands I would potentially wish to run?
leeand00's user avatar
  • 22.6k
0 votes
3 answers
2k views

Why is the command history only saved on exit

I am trying to save a different history file per tab / terminal but I cannot manage to save it immediately after a command is run. The history is just saved when I run "exit". This is a problem as ...
Fidel's user avatar
  • 21
1 vote
0 answers
91 views

Wrap the history number - reset history number without losing history

I display the history number as part of my prompt, e.g., {!1123}(j:~)$ ls /some/long/and/hard/to/type/path so that I can do it later with !1123. My HISTSIZE and HISTFILESIZE are both 200, but this ...
jeremysprofile's user avatar
4 votes
0 answers
160 views

TAB completion with .bash_history

I usually use PageUp/PageDown to search through .bash_history given a prefix. However, I regularly catch me pressing TAB multiple times before realizing that I need to use PageUp/PageDown in this ...
Sven R. Kunze's user avatar
0 votes
1 answer
3k views

How to bring bash history to default in CentOS 7

$ set -o | grep history history on $ echo $HISTFILE /root/.bash_history $ echo $HISTSIZE 1000 $ echo $HISTFILESIZE 1000 I ran following command and ...
LifeSaver's user avatar
0 votes
0 answers
289 views

Bash - history search by ordered characters subset

I want to be able to write dockercomex and have, for example, a history match: docker-compose exec (...). Searching like this works in PyCharm and it's fantastic for productivity. In Firefox it's ...
Ctrl-C's user avatar
  • 131
0 votes
1 answer
588 views

Store SSH command history on local machine

I often use SSH to connect to ARM machine which reboots regularly and doesn't have any persistent memory to store sh command history. Is there a way to store such history on my local machine so it ...
Artalus's user avatar
  • 323
4 votes
1 answer
3k views

Why was ctrl+c chosen to kill a process? [closed]

I'm aware of why ctrl+c kills a program; I'm more interested in the history as to why "c" was chosen over other letters, given that it (apparently) has no semantic meaning. If anyone knows the ...
jhpratt's user avatar
  • 143
2 votes
1 answer
332 views

How do I make . execute the last shell command in zsh?

In bash, alias .= "fc -s" works for this purpose, it does exactly what I want. But in zsh, using fc -s just outputs fc: bad option: -s. How do I make . execute the last shell command in zsh?
Accumulator's user avatar
2 votes
3 answers
2k views

How to run encryption commands on linux without shell history logging

I want to encrypt something without logging any part of the shell command to bash history. I don't want the password or any filenames or the command to appear in the shell history. How to do it using ...
Guerlando OCs's user avatar
3 votes
0 answers
210 views

applying reverse-i-search to a file

The bash reverse-i-search (ctrl-R) is quite handy to find a command you typed a while ago. However, it only searches the history of the current terminal (which consists AFAIK of the history loaded at ...
Geminus's user avatar
  • 131
1 vote
0 answers
2k views

Bash history not working?

I'm using FreeBSD 11, and Bash as my shell. I've checked all the basics. History shows as "on" HISTFILE, HISTFILESIZE and HISTSIZE are all set with sensible values. $HISTFILE exists and has rw ...
Stilez's user avatar
  • 1,715