Questions tagged [history]
The history command can be used to manage commands you have previously typed in a shell.
198
questions
384
votes
9
answers
646k
views
How to see time stamps in bash history?
Is there any way I can see at what time the commands were executed from the bash history? We can see the order but is there any way I can get the time also?
Bottom-Line: Execution time in the Bash ...
370
votes
9
answers
915k
views
How to clear bash history completely?
I want to clear all previous commands from the history of my server. I used history -c and it seems all things are cleared but when I ssh to the server, all the commands are still there.
How can I ...
241
votes
10
answers
28k
views
Terminal 'incognito mode'?
I use Terminal a lot, and sometimes I am running commands, which aren't things I don't want others to see, but more commands that if I accidentally arrowed up to and accidentally executed would cause ...
229
votes
7
answers
149k
views
Bash history search, partial + up-arrow
I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal.
Way back when, I had a user on a debian system, and a friend set me up with a convenient ...
203
votes
4
answers
95k
views
Is it possible to make writing to .bash_history immediate?
I often open lots and lots of terminals (right now, I have seven open on this workspace) and I often search history with grep to find a command I've just written recently, but I don't want to hunt ...
158
votes
7
answers
130k
views
Bash history handling with multiple terminals
I use mainly Terminator, and it's usually opened with 3 split terminal windows. I also use Gnome terminal for various reasons.
I'm wondering how is bash history handled in this case as I sometimes ...
156
votes
5
answers
735k
views
View history of commands run in terminal
Is there a way to save all my typed terminal commands and view it like history in a log book?
156
votes
6
answers
81k
views
How to avoid duplicate entries in .bash_history
The same command is listed in my history again and again. How can I avoid this? I know it's possible via HISTCONTROL but I haven't found the right way.
146
votes
6
answers
172k
views
How do I show apt-get package management history via command line?
Is there a way to show the history of packages that were changed by apt-get via command line?
88
votes
8
answers
143k
views
Is there a default clipboard history in Ubuntu? If there is, how can I access it?
Is there a default clipboard history in Ubuntu 20.04 or later? If there is, how can I access it? I know there are lots of available applications for saving clipboard history in the default Ubuntu ...
85
votes
4
answers
359k
views
How to view the `.bash_history` file via command line?
I want to view the contents of my .bash_history file but don't know how to get there via the command line.
60
votes
3
answers
116k
views
How to save terminal history manually?
It's my understanding that the history file is updated when the terminal exits. But sometimes my computer crashes out, and the terminal doesn't exit cleanly, and then I lose those commands from my ...
58
votes
2
answers
225k
views
Save the terminal history to a file for print
My Ubuntu headless server is about to lose both hard drives(raid1). I already saved the most important stuff. Now I'm sitting in front of a Mac OS X client with the terminal open (ssh).
I need to ...
56
votes
2
answers
41k
views
How do you share history between terminals in zsh?
How can it be achieved so that every command that is entered, is visible in every open terminal's history?
When having multiple terminals open, the history isn't shared, i.e. what you entered in one ...
49
votes
2
answers
57k
views
Bash history not saved after closing terminal
I recently replaced my Ubuntu 14.04 installation with Ubuntu Gnome (which comes with Gnome DE). But I noticed that bash history is not saved once the terminal session is closed. Once I close a ...
39
votes
5
answers
48k
views
Select commands from bash history
Pressing the up button is tedious and I might miss the command I was looking for. So when typing history at the terminal gives me all the commands I have entered before, indexed to a number. Is there ...
29
votes
8
answers
41k
views
How to view history of apt-get install?
How can I view the history of apt-get install commands that I have manually executed?
It seems to me that all methods available show everything that has been installed right from the start of the ...
27
votes
5
answers
99k
views
bash shell output history file location
Where does the bash shell store the actual terminal session? I want to read the output of commands I used before. All I can find googling is how to store the output of a command.
Since output is ...
25
votes
4
answers
88k
views
How to find history of shell commands since machine was created?
I created an Ubuntu virtualbox machine a couple weeks ago and have been working on projects off and on in it since then.
Now I would like to find the syntax of some commands I typed in the terminal ...
21
votes
4
answers
97k
views
Where are ALL ubuntu logs/terminal history stored
In what folders are the logs and key histories stored so that I may make a script to purge them. Is there a specific folder for the hibernation partition or a file by which it keeps the RAM data on ...
20
votes
3
answers
22k
views
bash doesn't keep history
I run Ubuntu 12.04, and for some reason bash does not keep my command history. the ~/.bash_history file contains only 3 commands that I typed a few months ago.
How can I fix this?
EDIT:
here's the ...
20
votes
4
answers
6k
views
How to get shared Bash history among different tabs
I used the answer in https://unix.stackexchange.com/a/1292/41729 to enable real-time shared history among separate Bash terminals.
As explained in the answer above, this is achieved by adding the ...
19
votes
3
answers
66k
views
Finding an old command in the shell history [duplicate]
How can I find an old command I ran in my terminal?
I used an appengine command and wish to just find it in my local command history without researching it online again.
17
votes
1
answer
13k
views
How can I view history in terminal for specific date?
How can I view the terminal history for a specific date?
For example today is 4-apr and I want to view the history of 31-mar
16
votes
4
answers
42k
views
Bash command history not working
The command history between sessions is not getting saved. I'm using guake and the history for the session is working fine.
I noticed that .bash_history had some commands I executed in sudo -s mode ...
15
votes
4
answers
893
views
Run last command with all the letters transformed to lowercase
Many times I have run a command with all the letters in uppercase (maybe because CapsLock was on), and I pressed Enter before realising this.
How can I run the last command with all the letters ...
15
votes
3
answers
4k
views
How can I make a list with most used commands in terminal?
How can I make a list with most used commands in terminal?
I know that this question may be unuseful for any future proposals for some of us, but even like this, the list can be useful when we don't ...
14
votes
1
answer
3k
views
multiline command chunks in bash history into multiple lines
In Bash (as well as Bash in WSL), multiline written commands can call-back with up/down arrows correctly also built-in history command report them correctly (until I'm still logged-in in bash).
But ...
12
votes
8
answers
1k
views
Ubuntu Philosophy Question [closed]
I was just switching from Windows to Ubuntu and I started to read this.
And there were quite a few things I did not understand. One was:
"OpenOffice decided not to have a learning curve"
Another ...
12
votes
1
answer
568
views
Terminal replacing ! followed by a number with a command
I'm very confused about my ubuntu terminal session, it seems to replace sections in commands that start by ! followed by a number with seemingly random commands. It does that with !87 replacing it ...
11
votes
2
answers
53k
views
How do I SSH and remove all previous SSH activity history?
I want to remove any and all activity logs for SSH remotely. How do I get to it?
My account on the remote server doesn't have admin privilege, and as such I just want to remove user to user ...
11
votes
2
answers
2k
views
Get bash history to remember only the commands run with space prefixed!
The commands executed in the terminal prefixed with blank space(s) are not recorded in the command history file. But is there a way to get the reverse i.e. the history should only record those which ...
10
votes
1
answer
2k
views
Is there any way to check history only of current session?
I wanted to know if there is any command or any other way I can check my command history only in the current session.
10
votes
0
answers
8k
views
missing .bash_history [closed]
I cant find .bash_history file in my home directory. I do:
echo $HISTFILE
/home/myname/.bash_history
But if I try to list the file with ls, I get:
$ ls -l ~/.bash_history
ls: cannot access /home/...
9
votes
1
answer
7k
views
What's the difference between "history -w" and the action of closing a shell session?
I did some tests about history:
I ran history-c and then logged out. This cleared history for the current shell.
I ran history -c && history -w. This deleted everything.
I deleted the entire ...
9
votes
6
answers
10k
views
History list without timestamp and unique the results
Using bash, I save my history with the timestamp.
How do print the history omitting the timestamp?
alias h=history
alias g=grep -i
To find lines that I used for heroku, I type:
> h | g heroku
...
8
votes
5
answers
4k
views
How can I recall a command from history by number without executing it?
How can I grab a command from history by number to my command line without executing it?
This immediately executes command number 555 which I'm not looking for:
$ history 10
$ !555
This opens the ...
8
votes
2
answers
6k
views
How to see time in ~/.bash_history file
I added time to the ~/.bashrc file, so now it shows me time when I execute history command like this:
376 04/10/19 20:39:52 sudo cat ~/.bash_history
377 04/10/19 20:40:04 date
378 07/10/19 ...
8
votes
1
answer
5k
views
Increase or View all Stored History in Gedit
I would like to be able to see the last ~200 files opened in Gedit. I was able to increase the number it shows to 40 using this command:
gconftool-2 --type int --set /apps/gedit-2/preferences/ui/...
7
votes
2
answers
10k
views
How to save terminal history to a file from a bash file?
I am trying to create a bash script that will save the terminal history to a file called hist.txt. Using history > hist.txt doesn't seem to work in the bash script, but works fine when executed in ...
7
votes
5
answers
2k
views
Searchable Clipboard Manager, like ctrl-r in bash
I am looking for a clipboard manager with search functionality.
I love CtrlR in the bash shell and would like to have the same functionality like that in clipboard manager for my desktop.
Up to now I ...
7
votes
3
answers
14k
views
History command showing the directory and the date
Is there a way to have in the .bash_history file, listed: the directory where the command has been typed, the date, and the command ?
7
votes
2
answers
154
views
Using last part of command for next command
When using the command I know a friend of mine who used to re-use last part of previous command. He unfortunately moved far away and I can't get hold of him.
First:
cp -r folder ~/folder
Then he ...
7
votes
0
answers
816
views
How can I increase the viewing history (recent documents) in Okular?
I tried looking for an entry/number in ~/.kde/share/config/okularrc but there was nothing to edit there as to allow me to increase the number of saved addresses
6
votes
5
answers
5k
views
How do I make Bash history undeleteable?
The Bash history can get deleted just by deleting the file which contains. How can I protect the history from being cleared / deleted?
6
votes
4
answers
4k
views
Gedit 3.6.1, how to increase the number of recent files from its default of 5?
Ubuntu 12.10, gedit 3.6.1
This won't work:
gconftool-2 --type int --set /apps/gedit- /preferences/ui/recents/max_recents 30
Modifying this file as root won't work either:
cat /usr/share/glib-2.0/...
6
votes
1
answer
6k
views
Command history seems to be missing the first 75 lines
A couple of years ago, I did the automatic distribution update from 14.04 to 16.04. For the first time in my life, I was able to continue to use the computer after the automatic distribution update. ...
6
votes
2
answers
17k
views
Install history command package
I have Ubuntu 10.04.4 LTS running on a proxmox OpenVZ container.
I imagine it does not come with history because the up arrow on the command line gives me ^[[A
plus...
$ history
-sh: history: not ...
6
votes
2
answers
1k
views
reverse-i-search of history not finding expected commands
Today upon bringing up a bash terminal I tried finding a frequently-used command from my bash history via Ctrl-r. To my surprise, it wasn't found. Upon inspecting ~/.bash_history, I saw instances of ...
6
votes
2
answers
2k
views
How do I disable the command line history in the dash?
Using Unity, how to clear and disable the RUN (ALT+F2) history?
Not the dash history, not the search history --- the ALT+F2 "run" history.
The Privacy Settings Applet of System Settings doesn't seem ...