Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [history]

The history command can be used to retrieve commands you have previously typed in a shell.

242
votes
8answers
629k 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 ...
229
votes
10answers
18k 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 ...
216
votes
4answers
380k 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 ...
133
votes
5answers
74k 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 ...
116
votes
4answers
45k views

Is it possible to make writing to .bash_history immediate?

I often open lots and lots of Terminals [Right now I have 7 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 down the ...
113
votes
6answers
100k 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?
100
votes
6answers
46k 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.
100
votes
4answers
68k 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 ...
63
votes
4answers
202k 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.
58
votes
5answers
232k views

View history of commands ran in terminal

Is there a way to save all my typed terminal commands and view it like history in a log book?
35
votes
2answers
32k 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 ...
28
votes
3answers
59k 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 ...
28
votes
2answers
17k 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 ...
23
votes
2answers
90k 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 ...
22
votes
4answers
75k 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 ...
19
votes
4answers
4k views

How to get shared bashed 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: # ...
18
votes
3answers
16k 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 ...
17
votes
8answers
22k 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 ...
16
votes
1answer
3k 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
15
votes
4answers
734 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 ...
13
votes
4answers
23k 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 ...
13
votes
3answers
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 ...
12
votes
5answers
14k 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 ...
12
votes
8answers
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
1answer
352 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 ...
12
votes
5answers
36k 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 ...
11
votes
4answers
51k 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 ...
10
votes
2answers
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 ...
9
votes
1answer
312 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.
8
votes
2answers
4k 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 ...
8
votes
2answers
32k 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 ...
7
votes
3answers
16k 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.
6
votes
5answers
1k 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 ...
6
votes
2answers
118 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 ...
6
votes
3answers
6k 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 ?
6
votes
2answers
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 ...
6
votes
3answers
522 views

Blank line in my bash.history?

I was taking a look at my .bash_history, and I found a blank line. I thought that I could have pressed "enter" while I was taking a look in the file. Is that normal? Or maybe I really pressed enter ...
6
votes
1answer
2k views

Is there a centralized history file for all the commands run from various terminals?

I am aware that every terminal has it's separate history,which can be viewed by the history command. Commands issued on suppose terminal tty1 will be shown in the history of tty1 only and not in the ...
6
votes
0answers
2k 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/...
5
votes
1answer
623 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. ...
5
votes
1answer
2k 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 ...
5
votes
1answer
417 views

What does '*' mean in the output to 'history' command?

I was seeing my history when I found a line with a * whereas, in general, the history has an output without any * I noticed this for the first time. When does this * appear and why? EDIT: ...
5
votes
2answers
2k views

Deleting last few hours of zeitgeist history like in Firefox?

I want to open secret files on Ubuntu Natty and after my work delete the history of open files or any recorded activity during last: one hour three hours one day one week etc... how can I do this, ...
5
votes
3answers
4k 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 ...
5
votes
1answer
3k 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/...
4
votes
3answers
3k 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/...
4
votes
1answer
954 views

Can I get the commands from history executed in bash in the last 15 mins?

I want to put in place a cron job that sends me notification about a particular command executed in the last 15 mins. I can get the history along with timestamp using export HISTTIMEFORMAT='%F %T', ...
4
votes
3answers
817 views

Up arrow and .bash_history have different commands, so where does the up arrow get its data?

I seem to have discovered that the ~/.bash_history file doesn't contain what is displayed when you use the up arrow. I found this by doing a command like so smbclient -L 10.2.10.240 -umyuser -p"...
4
votes
2answers
14k views

How do I check if someone accessed my computer?

I need to check the list of files accessed in my computer (ex: yesterday on particular time). Is it possible? Or I need to check whether anybody accessed my computer (when I left it unlocked) or ...
4
votes
1answer
55 views

Thunderbird: History of seen Messages

Is there a way in thunderbird to step backward and forward in the history of last messages? Like in firefox: It has a history of the last visited pages. I would like to have a history of the last ...