recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

1
vote
2answers
538 views

Why “reverse-i-search” does not work on my centos sytem?

When i press CTRL+r, the "reaverse-i-search" works well: but then when i press "arrow up" key, none history commands show, just nothing happens! Any configuration not compare?
1
vote
0answers
366 views

How to use history commands with readonly PROMPT_COMMAND?

I'm sometimes logged in on a host which I do not control and where PROMPT_COMMAND is readonly. Is there some way to work around this to run history commands anyway, for example using PS1? I've tried ...
1
vote
4answers
368 views

How can I do the `history` command and not have line numbers so I can copy multiple line commands?

Sometimes I do the history command so I can see 4 commands in a row. I want to copy those commands so I can run them again. I usually select them with the mouse and shift-ctrl-c which works ok, but ...
16
votes
4answers
924 views

Finding command execution time in hindsight

I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off. Is there any way of getting this information ...
13
votes
1answer
3k views

How do I perform a reverse history search in ZSH's vi-mode?

I use vim for essentially all my editing needs, so I decided to once again try vi-mode for my shell (currently ZSH w/ oh-my-zsh on OS X), but I find myself trying (and failing) to use Ctrl-R ...
3
votes
3answers
2k views

How to save command line history without logout? [duplicate]

Possible Duplicate: Is there a way to make the history when pressing up in bash shared between shells? I am opening more than one console tab and I want to use commands that executed from ...
1
vote
4answers
1k views

Terminal with “repeat last” button

I'm often compiling stuff and therefore repeating the same command over and over, so I'd like to benefit from my "visual memory" and have a sort of "repeat last command" button attached to a terminal. ...
2
votes
1answer
142 views

How do I create history files with date automatically attached?

E.g. at the end of the session for each day I want to create a history file with the date attached at the end. So, say, history > history07162012.txt or something like that.
8
votes
1answer
743 views

What would cause vim not to retain command history?

On other distros I have run, vim remembers your command history even between sessions; this is especially handy when doing a lot of similar operations on different files. For some reason, it has been ...
9
votes
2answers
575 views

How to exit bash history search mode?

In Ubuntu 12.04 I use CTRL-R to enter a reverse history search. If the command I want is not found (after repeated CTRL-R), how do I immediately exit back to the (empty) command prompt with no ...
2
votes
4answers
408 views

Prevent a command from being executed after another command

I would like the shell to warn me for potential errors I'm about to make. How can I prevent a command cmd2 from being executed after cmd1. For example: $ tar tf file.tar $ rm !$ Here, I just ...
11
votes
2answers
581 views

Keep only successful commands in BASH history

Sometimes I misunderstand the syntax of a command: # mysql -d test mysql: unknown option '-d' # echo $? 2 I try again and get it right: # mysql --database test Welcome to the MySQL monitor. mysql ...
3
votes
4answers
255 views

Change working directory of 2 terminals at once

I've typically have gnome-terminal open with ~8 tabs, using 2 consecutive tabs for the same task (one has emacs, the other is used to do git checkins and unittest runs and so). When changing tasks, I ...
2
votes
1answer
1k views

How do I preserve the history file of cygwin bash across independent sessions?

So my home directory does have a .bash_history file, but it refuses to grow any bigger for some reason. I've already changed the .bashrc settings to set the history size to 99999 and the history file ...
1
vote
1answer
582 views

How to disable live shell session command history under AIX 5-6?

It's okay that there are history files logging the commands that has been used. That't not the problem. The problem is that when 2 admins are logged in to an AIX server then it could be bad: If ...
3
votes
1answer
542 views

How can I programatically add entries to Bash history and have timestamps work properly?

On CentOS 6.2 and Bash 4.1.2(1), I have added a file in /etc/profile.d which contains: HISTTIMEFORMAT='%c : ' history -s "# some text as a marker" That works insofar as the the variable gets set ...
21
votes
1answer
5k views

How to Navigate within bash's Reverse Search?

Bash offers the functionality to reverse search via Ctrl + R. Then one can type in a part of a command it will show a fitting entry from the history. Assume this is my history: vim foo1 vim foo2 # I ...
3
votes
1answer
202 views

zsh !! and !$ auto execute as it does in bash

I recently made the switch from bash to zsh. I discovered two minuscule issues and differences between zsh and bash. I was slightly disappointed when my favorite two shortcuts !! & !$ don't behave ...
8
votes
4answers
1k views

How can I save the last command to a file?

When I am running my analyses using the bash shell, I often want to save the commands I've used that gave me good results to a file in the same directory (my "LOGBOOK", as its called) so that I can ...
6
votes
1answer
188 views

Is there a reverse of yank-last-arg/insert-last-argument?

yank-last-arg / insert-last-argument is probably better known by its usual shortcut, Alt-.. It's very nice to navigate through the last argument of earlier commands, but if you're navigating a little ...
3
votes
2answers
250 views

Is there a way to make the history when pressing up in bash shared between shells?

I've seen this answer: Preserve bash history in multiple terminal windows This works for history, but I'm wondering if there is way to extend this so pressing "up" is shared as well?
4
votes
3answers
2k views

How can I expand a relative path at the command line, with tab completion?

In bash is there any way to expand a relative path into an absolute path, perhaps with tab completion? I ask because sometimes I will search for a file, find it, then vim it: cd /etc cd apache2 cd ...
2
votes
1answer
452 views

How to stop bash replacing commands in history with asterisks ? (‘*’)

I have some commands replaced with * in the bash history, e.g. 1094 apt-get update 1095* 1096 dpkg -i /var/cache/apt/archives/libssl1.0.0_1.0.0h-1_amd64.deb How to prevent this?
7
votes
2answers
448 views

How do I add network or user source connection data to history entries?

I would like to modify the history settings for all users on the systems that I manage. I would like it to contain the information from the connecting terminal like from who sysadmin:/ # who sysadmin ...
6
votes
1answer
995 views

How can I alias to `!!` (last command)?

!! in bash runs last command. I find it too difficult to type given how much I use it. alias to the rescue, I presumed. Or not. I tried: $ alias dl='!!' # Aliasing $ echo Testing123 ...
4
votes
3answers
318 views

Converting a history to a script?

Often times I've typed in a bunch of commands when I realize that I am going to keep typing them in and that I would really like a script. Now I understand that no matter how I save my history, I am ...
5
votes
1answer
363 views

history list in bash always truncated to 5000 lines at new login

Similar to the 5000 line limitation problem when first thing in .bashrc I have export HISTSIZE=10001 and export HISTFILESIZE=$HISTSIZE My users do not have ~/.inputrc files and the system-wide ...
4
votes
1answer
2k views

User's executed commands log file

In Unix based systems, is there a log file that stores user's executed command(s)?
13
votes
3answers
2k views

Excluding some of the commands from being getting stored in bash history

Is there any way to exclude commands like rm -rf, svn revert from being getting stored in bash history? Actually I, by mistake, have issued them a number of times even though I have no intent to do, ...
0
votes
2answers
576 views

Permanently Storing a command in bash history

Is there any way to store a command in bash history permanently? The actual scenario goes like this:- I have a project in C and in order to configure my project, I have to run a very long command ...
3
votes
1answer
386 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, ...
3
votes
3answers
6k 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
432 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
130 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 ...
7
votes
1answer
722 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
368 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
640 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
590 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
185 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
82 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.
12
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
2answers
225 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
117 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
798 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
658 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 ...