recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

7
votes
2answers
800 views

sharing or synchronizing history between Zsh and Bash

I often find myself switching between Bash and Zsh, and using the history search functionality to recover a command. However, since Bash and Zsh have different history files, I often find that the ...
2
votes
1answer
2k views

How do I set an unlimited size to the history file for tcsh?

This is a follow-up question to Is there a maximum size to the bash history file?. Unfortunately, it doesn't work with the atmospheric science department computers, as they use tcsh rather than ...
4
votes
1answer
659 views

How to stop Bash appending history

I am having a lot of trouble setting up the terminal history of Bash the way I want. I would like to have no duplicate entries and if I enter a command I want it saved and the duplicates above ...
3
votes
2answers
2k views

Tab autocompletion and history in tcsh

I use tcsh, and I'd like to set up the following behaviour, which I've seen on some systems in the past. If I type !string TAB then: If the history contains a unique entry beginning with string, ...
4
votes
2answers
4k views

Why does the exclamation mark `!` sometimes upset bash?

I realize that ! has special significance on the commandline in the context of the commandline history, but aside from that, in a runing script the exclamation mark can sometimes cause a parsing ...
5
votes
1answer
148 views

Don't lose the current command when up is pressed in a terminal

How can I configure my Linux terminal so that the current command isn't lost when I press the up arrow key?
15
votes
4answers
5k views

Bash history: “ignoredups” and “erasedups” setting conflict with common history across sessions

First of all, this is not a duplicate of any existing threads on SE. I have read these two threads (1st, 2nd) on better bash history, but none of the answers work - - I am on Fedora 15 by the way. I ...
6
votes
3answers
550 views

Bash history number not starting at 1?

I was customizing my bash prompt (I'm on OS X 10.7) when I came across something strange. Within my prompt I included !, which should give me the history number. However the history number always ...
8
votes
3answers
2k views

Is there a maximum size to the bash history file?

Can I increase the size of the command history in bash? Note that I use a Red Hat Linux computer in the undergraduate astrophysics department here (so I don't get that many privileges).
3
votes
3answers
293 views

Search commands in history with discontinuous keywords

I was wondering how to search commands in history without knowing the first few letters of the command? When searching using Ctrl-R in bash, one has to give the first few letter of the command. ...
7
votes
3answers
2k views

ZSH: search history on up and down keys?

Currently, I have the following in my .zshrc: bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search However, this only seems to match the content of my current input before a space ...
5
votes
4answers
2k views

In UNIX, how to find the most commonly used commands in history of unix?

In UNIX, how to find the most commonly used commands in history?
6
votes
1answer
454 views

How to make bash history prefix-sensitive?

How can I make pressing up/down on bash bring up the last command that started with the prefix I already entered? E.g. $ ls foo $ echo hello $ ls <UP_ARROW> Clicking UP after entering ls ...
2
votes
3answers
1k views

How to exclude some commands from being stored in TCSH history?

I store my commandline history in TCSH, but I want to prevent certain frequent, simple commands like "exit", "cd" to be included in the history (the history holds only a fixed number of commands, so I ...
4
votes
1answer
958 views

Trouble adding date to tcsh history

I'm trying to add the date to my tcsh history information and I can't seem to figure out how to make it work. The tcsh man page reads like this for the history setting: The first word indicates ...
2
votes
1answer
272 views

zsh history - full path

Suppose I do the following in zsh cd ~ cd dir1 cd dir2 cd dir3 evince foo.pdf zsh writes exactly the same in its history file. Now my question is whether it is possible to have cd ~ cd ~/dir1 cd ...
6
votes
1answer
317 views

Can I have my shell history record how wildcards expanded?

If I run: $ ls * foo bar buzz $ history | tail -1 ls * You can see that in my shell history it remembers that I ran ls * rather than ls foo bar buzz. Ideally, I'd like to record both in separate ...
4
votes
3answers
302 views

Can I insert sudo via the ^ command?

Sorry if this is a yes/no question.. I am reading this unix tutorial and found the following: Repeating and Modifying the Previous Command [..] If you mistype leavenworth as leaveworth ...
1
vote
1answer
235 views

Pressing `up` to get the previous command in a tty on Ubuntu Server

I've installed Ubuntu Server 10.10, and when I press up in a terminal nothing happens. Using Ubuntu Desktop it gave me the previous command that I ran. How can I make it do this in Ubuntu Server as ...
11
votes
4answers
3k views

Temporarily suspend bash_history on a given shell?

Is there a way to temporarily suspend history tracking in bash, so as to enter a sort of "incognito" mode? I'm entering stuff into my terminal that I don't want recorded, sensitive financial info.
2
votes
2answers
104 views

How to get history search to start afresh?

When I do a search using CtrlR, the search gets limited to entries older than displayed hit. How do I reset this so that it starts from the beginning (i.e. from latest history entry) without leaving ...
5
votes
1answer
1k views

How to search the whole of bash history without needing to go forwards and backwards?

At times when I do CtrlR to search through command history, I find that I don't reach the entry I was looking for, even though I know it's in history. I think this is due to me having passed the ...
3
votes
2answers
373 views

Where is the setting that disallows duplicate command history?

Let's say I type the following sequence of commands: $ cd $ ls $ ls When I go back in history by pressing up twice, I end up with cd, instead of ls. I've noticed this isn't always the case, so it ...
8
votes
2answers
4k views

Why would anyone not set 'histappend' in bash?

After finding out what this shopt -s histappend means, it seems a very sane setting, and I'm surprised that it isn't default. Of course I may be shortsighted, so why would anyone not use such a ...
8
votes
4answers
1k views

Can I easily search my history across many screen windows?

My current screen session has 12 open windows on it. It's been running for weeks... I know I executed an ImageMagick convert command in one of these 12 screen windows sometime last week... is there ...
34
votes
4answers
4k views

Is there any way to keep a command from being added to your history?

Is there any way to keep a command from being added to your history? I have a command that I want to keep out of my history file, and I really don't care to have it there when I search the history ...
5
votes
3answers
4k views

History command inside bash script

I have been bashing my head to write a simple history script for the last two days. History is a shell-built in command I couldn't able to use that within a BASH script. So, Is there a way attain this ...
18
votes
4answers
5k views

Command-line completion from command history

So, I've looked at history and at Ctrl+R, but they are not what I thought I knew. Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some ...
9
votes
3answers
4k views

How to properly escape exclamation points in bash?

Today, I was caught redhanded while attempting to code golf a password generator for Twitter. import string as s,random;print ''.join(random.sample(s.letters+s.digits+s.punctuation,9)) 90 chars. ...
16
votes
6answers
2k views

put history command onto command line without executing it

I use !n where (n) is the line number for executing a line in the history file I want executed at the command prompt which I find via history|less. But there is a command line history event I wish ...
16
votes
4answers
19k views

Understanding the exclamation mark (!) in bash

I used history | less to get the lines of previous commands and from the numbers on the left hand side I found the line I wanted repeated (eg. 22) and did !22 at the command prompt and it ...
5
votes
5answers
487 views

Would it be possible to jump between prev/next command prompts?

I'm using zsh in OS X Terminal.app and for quite a while, I've been longing for a way to jump back and forth between prev/next prompts in the terminal's output. One convenience with this would be to ...
5
votes
1answer
892 views

How to get a persistent “history”-file even after a non-clean shutdown?

I am trying Ubuntu Server 10.10 in VirtualBox. I like that the commands I run is saved in a "history"-file that can be shown with the history command. But if I just turn off VirtualBox without the ...
6
votes
6answers
509 views

How can I reproduce commands run on one machine on another machine?

I would like to install some software on a linux-machine that I have run in VirtualBox. Then I would like to do the same thing on a linux-VPS. I think that I can save all commands that I run using ...
13
votes
3answers
459 views

Mangled history

In gui mode, when a user has more than one terminal open, how do the terminals rewrite the history file of that user? the reason I ask is because, it is quite possible that in each of the terminals ...
6
votes
1answer
919 views

What does the 'a' attribute in lsattr mean?

I was trying to remove some old history from my .bash_history file, but I was receiving this message: [john ~] /home/john $ mv .bash_history .bas mv: impossible to move `.bash_history' to `.bas': ...
0
votes
0answers
325 views

bash: recall command by typing some characters of it [duplicate]

Possible Duplicate: best way to search my shell's history In MSDOS I have the option to start typing some characters of a previous command and then pressing F8 it will search the ...
1
vote
2answers
961 views

Extending history search in zsh

How to extend Ctrl+R search in zsh? It cannot find entry despite it is in history file. Edit: My .zsh: setopt AUTO_CD setopt CORRECT_ALL setopt EXTENDED_GLOB # History SAVEHIST=10000 ...
109
votes
10answers
29k views

Preserve bash history in multiple terminal windows

I consistently have more than one terminal open. Anywhere from two to ten, doing various bits and bobs. Now let's say I restart and open up another set of terminals. Some remember certain things, some ...
11
votes
8answers
384 views

How to access the history on the fly in unix?

for example, if I do a mkdir thisismyfolder912 I remember there is some easier way to switch to thisismyfolder912 than having to do a cd thisismyfolder912 What is that way and how does it work? ...
39
votes
12answers
6k views

best way to search my shell's history

Is there a better way to search my history file for a command than grep? I do have some idea what the command starts as, but I don't know how far back in the history it is. update: was formerly zsh ...
5
votes
4answers
2k views

How to have separate command history for different sessions for the same user?

I face this issue on some of Unix servers. When I open different session for same user, command history is shared by all the session. This creates issues if by mistake I press Ctrl-P or up arrow and ...