0
votes
1answer
22 views

Bash prompt command being overwritten when invoking history/deleting command

My Bash prompt clears itself when deleting the text after it or going too far in the history. When logging in, the prompt looks normal. There are white brackets around a colored username and then a ...
0
votes
2answers
85 views

bash autocompletion + command history using sudosh on AIX

We configured sudosh on AIX as login shell with /usr/bin/bash as their default shell. All is working fine except bash autocompletion and command history are not working anymore. TAB is TAB, arrows ...
0
votes
0answers
22 views

Correct date not printed for Bash history command [duplicate]

When using the history command, it shows the same date for every entry. I need to find the correct date for commands run several weeks or months ago. How can this be done? Sample current output: $ ...
2
votes
2answers
80 views

How can I use bash history to run a command using arguments from history?

How can I use the bash history to run a command with the arguments from a command in the history? I know that I can use !! to rerun the last command, but how can I run a new command with those ...
4
votes
1answer
350 views

Equivalent of bash's Ctrl-r in PowerShell

does anybody knows of a way to have the backward command search feature of bash [Ctrl-r] (and [Ctrl-o]) that are so useful, in windows powershell ? C-r is a more powerful arrow up history ...
2
votes
6answers
92 views

Get a command from history without execution in bash

To use a command from history you can write like $!100. But sometimes I make a little change of the command. Is there a way to get a command from history without executing it. Now I'm copying and ...
0
votes
1answer
253 views

How can I both use and modify the history inside a bash script?

So I have the following bash script aliased as "fortunes": #!/bin/bash -i REPLY=; history -w /tmp/fortunes_history_backup; # save history ... history -c; # and clear it. while [ ! \( "$REPLY" = "q" ...
0
votes
1answer
335 views

Ways of recovering a missing .bash_history due to a 100% full disk?

Two Putty sessions were opened to a Debian 6 Linux. Log-files led to a full disk. The bash history of the entire shell sessions is missing, and even beyond that (This may be due to a blocked ...
0
votes
1answer
315 views

Linux: page-up key to browse through history

In some linux systems, when I write the beginning characters of a command and press page-up, I can browse through the latest similar commands saved in the history file. However, I found that this ...
2
votes
3answers
128 views

How can I reset an edited history line in Bash?

In Bash, you can press the up (and down) arrow to traverse through history. You can then modify the command before executing it. Sometimes I've incorrectly modified the command, and wish to reset it ...
0
votes
0answers
11 views

Bash history lost [duplicate]

My bash history in cygwin is lost between two consecutive shells. Here are the outputs of some commands that might help to understand the issue: set -o | grep history history on $ grep -i ...
2
votes
2answers
113 views

How to look at the past directory history the shell was in?

Sometimes I like to look back in the command history to figure out what I was doing. Sometimes it would help to know what the cwd was for each command. So, I'm wondering if there's some way to track ...
6
votes
4answers
1k views

BASH history truncated to 500 lines on each login

For some reason, I cannot get my system to keep my BASH history after a reboot. Here are the relevant sections of my ~/.bashrc: shopt -s histappend PROMPT_COMMAND='history -a; updateWindowTitle' ...
4
votes
4answers
224 views

Save command to history without executing in bash

Is there a way to save a command in bash history without executing it? e.g. $ cmd [a long list of arguments] and now during typing i remember I'd like to do something else first. Can I have ...
1
vote
2answers
197 views

What determines what shows up in the bash history command?

When I run history, I get a list of commands. However, it does not appear to be complete, even for a given period of time. (It doesn't feel like it has continuous coverage of the past N commands - it ...
4
votes
3answers
101 views

change the first word of the previous command

For example I enter cat /very/long/path/textfile and right after that I decide to give the next command rm /very/long/path/textfile So, my question is: What is the easiest/fastest way to replace ...
2
votes
2answers
208 views

Record bash_history to private database for all users?

I want to be able to setup a MySQL database and record all commands issued on my server by username and command. Is this possible, and if so, how would I set it up?
1
vote
1answer
228 views

Figuring out how my /etc/ folder got deleted [closed]

I was playing around with my sendmail configuration in the /etc/ folder, and then, somehow, the contents of my /etc/ folder went away, and I'm unsure of how. From /var/log/auth.log: Nov 8 10:28:42 ...
1
vote
1answer
62 views

mapping cntrl+p , cntrl +n in command prompt

I m looking for a way to map CNTRL+p and CNTRL+n in command prompt to previous and next command in history. I m aware of F3 and up/down key but I m habituated to CNTRL+p/n on linux.
0
votes
1answer
506 views

using history command with ssh and getting output with correct time stamps [duplicate]

Possible Duplicate: using history command with ssh and getting output with time stamps Basically i want to get a record of all commands executed on my ssh server, with their correct ...
0
votes
2answers
881 views

using history command with ssh and getting output with time stamps

Basically i want to get a record of all commands executed on my ssh server, with their times. The codes i have tried are : ssh user@ip 'export HISTFILE=~/.bash_history; set -o history; history' I ...
0
votes
1answer
459 views

How to make bash remember history of previous sessions?

I have MacOSX but this should be *NIX-generic. In my computer at work, my bash shell remembers history from previous sessions, even if I just opened a new terminal. In my computer at home, this ...
16
votes
1answer
3k views

How to get infinite command history in bash?

I set export HISTSIZE=99999999999999 but is that the best way? I don't know if an overflow might occur. I'm looking for a tested, reliable way to remove command history limits.
6
votes
1answer
9k views

Retrieve Linux command line history by date

I want to see what I typed on my bash command line on a certain day a week ago. Is there a way to retrieve command line history? Something like below, perhaps? > history --include-date | grep ...
35
votes
9answers
36k views

Remove a certain line from Bash history file

How can I remove a certain line from history's database?
8
votes
8answers
670 views

Per-directory bash/zsh history log files

I find I do a lot of work on a project in a set directory. Sometimes — a few months down the track — I need to redo something on that project but I can't remember what I did. I use ...
2
votes
1answer
335 views

Re-run command with prepended text from bash history

How do I repeat the last bash command with some text pre-pended to the front of it. So if the previous command was: $ ls /somedir I want to run the following command utilizing the bash history to ...
10
votes
2answers
2k views

Execute a terminal command without saving it to .bash_history on OS X?

This site says that on Linux you can add a space before a terminal command to keep it out of .bash_history. This does not seem to work for Mac OS X. Does anyone know of a way to execute a single ...
13
votes
2answers
704 views

How to prevent Bash from altering history?

If I press the Up or Down arrows on my keyboard and then modify something from my history, it's changed forever. Even if I press Ctrl-C and then try to bring it up again, it's still changed -- I've ...
9
votes
4answers
2k views

Is there a directory history for bash?

Is there something like bash's reverse-search-history (Ctrl-r), but for only directories? I have some deep folder hierarchies that I want to jump to, so I'd like to use something like ...
8
votes
1answer
6k views

How can I see a timestamp for when a command was executed using history?

I'd like to check at what time/date a command in bash history was executed. Is this possible?
7
votes
2answers
722 views

reverse history search with regular expressions

I'm looking for a tool to allow reverse incremental searching with simple regular expression (or just multiple matches) support. For example, if I want to find the command 'foo bar baz', I could do ...
2
votes
3answers
3k views

HISTSIZE not being set in bash

I am trying to increase the size of my history in bash. I have the following in my ~/.bash_profile # Control the command history export HISTFILESIZE=10000 export HISTSIZE=10000 export ...
0
votes
1answer
383 views

Can I create a device in linux that is actually a memory-mapped file?

I want to speed up access to my .bash_history file. I have my PROMPT_COMMAND set to do history -a; history -r, so there is a significant delay in getting a new prompt. I want to see if I can speed ...
2
votes
1answer
799 views

How to get down-arrow history browsing in bash in Mac OS X Terminal?

On almost all modern command-line environments I've used, you can hit up arrow to go back a few commands in your history and re-run an earlier command. But on some command-line environments I've ...
1
vote
1answer
137 views

Bash exeute command from history and pull next/previous command into command line

I'm sure I read it somewhere, but I cannot find the site any more. Basically I want to search the history "^r" and then execute a command and leave me at the next/previous position in the history. ...
1
vote
2answers
466 views

In GNU Screen, Recalled bash history command displays one character position to the left of actual location

I am running Red Hat 5 32-bit (2.6.18-194.26.1.el5). The issue is that when I recall any previous command in bash's history, the first character in the command is displayed immediately after the ...
7
votes
1answer
585 views

bash: per-command history. How does it work?

OK. I have an old G5 running Leopard and a Dell running Ubuntu 10.04 at home and a MacPro also running Leopard at work. I use Terminal.app/bash a lot. On my home G5 it exhibits a nice feature: using ...
11
votes
5answers
6k views

How do I keep my bash history across sessions?

I am working on a x86 target running fedora 9. Whenever I reboot it, my history returns to some state, and I do not have commands I did in the sessions before the reboot. What I have to change to ...
4
votes
3answers
2k views

How to get Bash shell history range

How can I get/filter history entries in a specific range? I have a large history file and frequently use history | grep somecommand Now, my memory is pretty bad and I also want to see what else I ...
5
votes
6answers
5k views

Terminal *output* history?

I make extensive use of the functions to navigate through the command history in my terminal; I wonder if there is some way to navigate the command output history as well? (besides keeping a large ...
9
votes
2answers
22k views

How can I check the user command history in Unix?

I know the 'history' command give me a list of the commands I have typed into the Unix terminal. How do I see the command history for all of the users currently logged onto the system?
2
votes
1answer
2k views

get bash history from another shell instance [duplicate]

Possible Duplicate: Can history files be unified in bash? I have bash running in an ssh session, call this session A. I leave the office, go home, ssh to the same box, call this session B. ...
3
votes
2answers
1k views

Sometimes my .bash_history gets cleared. Why? How can I prevent that?

Here's my shell: $ $SHELL --version | head -1 GNU bash, version 4.1.7(2)-release (i386-apple-darwin10.3.0) Here are my history related settings: export HISTCONTROL=ignoredups:erasedups export ...
8
votes
2answers
9k views

(reverse-i-search) in bash

I usually end up using CTRL+r for (reverse-i-search), however, sometimes I pass the command that I was looking for; if I do again a (reverse-i-search) it doesn't find it anymore. I assume that the ...
4
votes
1answer
367 views

bash command history update before execution of command

Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT. However, I'm wondering if there is a way to log the commands to a file as soon as ...
1
vote
1answer
347 views

Displaying what `history` line is current in bash prompt

What formatting character needs to be added to a bash prompt to indicate the most recent history item run (or the current command number if 1 could be added to the last history entry)? My prompt ...
5
votes
4answers
15k views

How can I see Bash history from more than one terminal session in Ubuntu? [duplicate]

Possible Duplicate: Can history files be unified in bash? I use Ubuntu Server 9.10 and I would like to be able to see my bash history for more than one terminal sessions. I.e. my last 200 ...
5
votes
2answers
1k views

How can I set my BASH history scrolling to filter by what I've already typed?

Given a history of commands: 1 pwd 2 mysql -u root -p 3 ps -ef | more 4 top 5 mysql -h 192.168.1.101 -u root -p When you press the Up arrow, you scroll through all those commands. I've read it ...
10
votes
4answers
2k views

Bash history loss

I like to keep a lot of history, so I have histappend set in my .bashrc. Most of the time everything works fine, with history built up from many shells appending. However, every once and a while, I'll ...