recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

1
vote
1answer
500 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
483 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 ...
19
votes
1answer
4k 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
189 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
875 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
173 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
220 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
1k 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
388 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
388 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 ...
5
votes
1answer
888 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 ...
3
votes
3answers
304 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
339 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
1k views

User's executed commands log file

In Unix based systems, is there a log file that stores user's executed command(s)?
12
votes
3answers
1k 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
493 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
355 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
5k 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
386 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 ...
7
votes
1answer
1k 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
121 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 ...
6
votes
1answer
611 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
2answers
341 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
560 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
524 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
181 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
79 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
165 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
3k 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.
10
votes
2answers
2k 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
208 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
111 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
687 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
637 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
1k 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
3k 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
145 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?
12
votes
4answers
4k 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
479 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
267 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. ...
6
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 ...
2
votes
2answers
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
413 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
819 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
261 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
307 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 ...