recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

3
votes
1answer
440 views

Bash: Filter invalid commands from history, specifically passwords

Related Question, less specific: Automatic cleanup of Bash history This question focuses on a single problem. Over time, a user will eventually enter a password on the command line by accident, ...
4
votes
3answers
8k views

Can I search bash history across all users on a server?

I want to see all bash commands that have been run on a Linux server across multiple user accounts. The specific distribution I'm using is CentOS 5.7. Is there a way to globally search .bash_history ...
3
votes
1answer
483 views

Moving through history of commands on command line?

I used to use Up/Down to move through the history of commands. Then, a few days later it changed to Ctrl-p/Ctrl-n. Now this also doesn't work to move through the history of commands entered. How can ...
9
votes
1answer
2k views

How to enable reverse search in zsh?

I recently switched to zsh (finally) and am loving it! So far one thing that I am missing is Ctrl+R to do incremental history search. I have the history set up properly HISTSIZE=10000 SAVEHIST=10000 ...
3
votes
0answers
137 views

What do you use to manage your shell history? [duplicate]

Possible Duplicate: Preserve bash history in multiple terminal windows Can I easily search my history across many screen windows? I rely on my shell history a lot, I use Ctrlr and arrow ...
8
votes
1answer
858 views

Why is my bash prompt getting bugged when I browse the history?

Often when I start looking at history of commands some of the characters from a command displayed aren't erased, for example: What's happening: prompt$ some_command prompt$ some_commanother_command ...
3
votes
3answers
393 views

Automatic cleanup of Bash history

How can Bash history be automatically cleaned up? For example Remove detectable typos from history (ls-lh does not show up in which, so it is removed, I meant to type ls -lh) Clean excessive spaces ...
5
votes
6answers
737 views

Last command in ksh

In bash I can use !! to indicate the last command. In ksh I think you can use r to do something similar, but it seems to fail in one of my common patterns: typing sudo [last command]. > cp foo ...
3
votes
2answers
674 views

Convert a typescript file to a list of commands (history)

I wanted to record a linux session so I could use it as documentation for a "how to install" guide. I found something on the internet that suggested that the script command would be good for this, and ...
29
votes
12answers
1k views

How to quickly store and access often used commands?

I have a lot of commands I routinely need to execute, often with the slightest variation. Right now I'm storing them all in .bash_history and use CTRL-R to access them, but I wonder if there's a ...
1
vote
2answers
194 views

Auto correct path when running a command from history?

I perform a recursive search to find a command I executed few days back and I want to run it. However that command should run from the path from where I ran it previously from and not where I ...
4
votes
2answers
86 views

If ^a^b replaces “a” once in the last command, what do I use to replace all occurrences of “a”?

In bash, if I run this command: echo aaaaaaa I get aaaaaaa (duh) But then if I type in ^a^b I end up with baaaaaa What would I type to end up with bbbbbbb ?
4
votes
0answers
167 views

How to preserve bash history in multiple terminal windows [duplicate]

Possible Duplicate: Preserve bash history in multiple terminal windows While working, usually I have multiple terminal windows open (or tabs). I use konsole, but it could be few ssh sesions ...
22
votes
6answers
4k views

How do I close a terminal without saving the history?

More than once I've accidentally run a number of commands and polluted my bash history. How do I close my terminal without saving my bash history? I'm using Fedora.
13
votes
2answers
3k views

How to execute consecutive command from history?

Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do: $ !432; !433; !434; !435 I'm curious, is there a ...
2
votes
1answer
248 views

How to keep a line from being remembered in the history?

This is for a single line, not a command. I found the way to make it always prevent history for a single command. Thanks. EDIT: Sorry for the poor wording. Single line - For example, if I type, git ...
2
votes
1answer
120 views

History-search in zsh working only for commands?

Say I have the following entries in my command history: less documents/doc1.txt less documents/doc2.txt less files/file1.txt less files/file2.txt ls pwd and that I have the following keyboard ...
7
votes
2answers
907 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
677 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
150 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?
18
votes
4answers
6k 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
616 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
329 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
3k 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 ...
6
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
490 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
1k 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
280 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
328 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
303 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
242 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 ...
12
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
106 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
384 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
5k 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 ...
36
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
5k 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 ...
19
votes
4answers
7k 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 ...
17
votes
4answers
22k 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
503 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
953 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 ...