The tag has no wiki summary.

learn more… | top users | synonyms

51
votes
10answers
53k views

Remove a certain line from Bash history file

How can I remove a certain line from history's database?
23
votes
2answers
6k views

oh-my-zsh history completion

I have recently switched to zsh, using robbyrussell's oh-my-zsh. Before that i used bash with a lot of custom stuff and i am only missing one thing because zsh is trying to be 'too smart': If i type ...
12
votes
3answers
2k views

How can I add a command to the Bash history without executing it?

Every now and then it would be useful to add a command directly to the history in Bash without actually executing it. So far the closed thing I have found is adding a # in front of it and hitting ...
11
votes
1answer
5k views

Command history in zsh

Currently I have zsh set up in such a way that command history is shared between all sessions immediately. Say I have a terminal emulator open with two tabs, each with a zsh session, A1 and A2. If I ...
10
votes
2answers
1k views

Separate up arrow lookback for local and global ZSH history

Is it possible to... Step up local ZSH shell history (actions only happened in that prompt) Step up global ZSH history (shared history is on) - default what happens when you press UP arrow when ...
7
votes
1answer
256 views

How can you reverse the direction of alt-period in Bash?

In Bash, you can press Alt-. to insert the last argument of the previous command. If you press it multiple times, it cycles through the last arguments of all of the commands in your history. However, ...
6
votes
4answers
787 views

How to selectively navigate through Bash command history on a Linux terminal [duplicate]

Everyone knows (or should know!) that on a terminal the up and down arrow keys are used to navigate through the history of used commands. When you use the terminal on a daily basis, your command ...
6
votes
1answer
379 views

Custom prompt botched during history and control-a in OS X's Terminal.app using Bash

I customized my prompt in .bash_profile to look like this: export PS1="\w \e[0;32m\$(vcprompt -f '[%n:%b]')\e[m\$ " Now, when I press up arrow to go back through history, find the one I want, then ...
4
votes
2answers
243 views

Change the order of Windows shell command history retrieval

One of the things that drive me crazy in command line under MS-Windows is the order in which the Windows shell (both the standard one and PowerShell) retrieve commands from history when you use the up ...
4
votes
4answers
5k views

To know which IP executed a certain command in linux using ssh

There is a server which is accessed by many users using ssh. I am trying to figure out which user executed a certain command. I can know the list of users currently accessing server using who Also I ...
4
votes
1answer
92 views

Shell history support that doesn't suck?

When I use multiple terminal sessions at once, bash only persists the commands from one of them. Then later when I try to do a reverse command search, the command I want is not going to come up, ...
3
votes
4answers
204 views

Unix-like command-line shells: Get full command input/output history

I'm looking to see if there is some smooth way (that is, not me just writing a wrapper for the shell) to get full logs of both everything I enter into the command-line shell and everything that gets ...
3
votes
3answers
2k views

bash save history without exit

in linux ubuntu bash terminal. is there any way to save bash history without writing exit? i've set the config to "HISTCONTROL=erasedups" which in my opinion works better than ignoredups. anyways ...
3
votes
2answers
437 views

Delete current command

Is there a keyboard shortcut to delete the current command? Let's say I have: $ cp /home/one/two/tree/ /var/www/one/two/three I want to easily the current command, specially when it's long and I ...
3
votes
2answers
362 views

Vim-like history in bash?

In bash, it's possible to scroll through the command history using the up and down keys. In vim, this is also possible (after pressing :). But with vim, if you type the first few letters of a previous ...
3
votes
1answer
892 views

When and how is bash_history appended to?

As far as I can tell, the history of an individual shell is only appended to the .bash_history file when the shell is closed. This means that I frequently lose individual shells' histories on crashes ...
3
votes
1answer
182 views

How to log in which terminal session a zsh command was run

In zsh's history file, all commands are logged from all terminal sessions. Is there any way to log in which terminal session a command was run (i.e., a unique identifier for this instance of the ...
2
votes
2answers
284 views

In Windows Command Prompt, how to get the last command that started with some letters?

Let's say I entered a bunch of commands one after another: rm blah.txt pwd ls cd .. cd blah pwd If I want to get "rm blah.txt" to appear again without typing the whole thing again, I can press up 6 ...
2
votes
3answers
380 views

How to start bash and immediately “type” command into it?

I want bash to first execute a command, but after the command finishes (or Ctrl+C'ed) go into interactive mode (preferrably with the command in history, available for up). How to attain it in easiest ...
2
votes
1answer
679 views

How do I change the .bash_history file location?

I'm running CentOS 6.x and want to move the .bash_history to a different location. The home directories of my users are (because I run a VPS) in /var/www/vhost/<domain>.<tld> which is FTP ...
2
votes
1answer
48 views

How to disable the confirmation of history expansions like `!!`

Zsh takes real good care of me, and at times it can get a bit too much. One of the times where I'd rather have it stay out of my business is when it "wants to make sure I want to execute the given ...
2
votes
1answer
268 views

Record all commands

I am learning ruby and following tutorials in a book. I want to record all the commands i enter in shell( I am using zsh) . How can I do that? I should be able to stop and start recording.
2
votes
1answer
1k views

How to log bash command with its output?

I want the actual command line be logged together with its output. I routinely execute important commands like this: PERL5LIB=${PERL5LIB}:/something/extra my-command.pl many arguments which I want ...
2
votes
1answer
594 views

Bash alias history substitution similar to \!* in csh

My question is very similar to that of this old post. I would like to do something similar: place in an alias the last argument(s) typed on the current command line. This would be equivalent to the ...
2
votes
1answer
63 views

can I use wrap a command inside a history-aware script?

Suppose I have a command line interface tool that doesn't have any notion of 'history'. Would it be possible to write a small script that merely does readlines and forwards them to the tool, but that ...
2
votes
1answer
92 views

Use a separate history for 'read -e' (readline)

I would like to write an interactive command shell in shell script, for easier adjusting of the iptables firewall. The problem is, that read -e uses the shell history. Is there a way of using a ...
2
votes
1answer
165 views

How to append to bash history before showing the prompt if the line isn't a duplicate?

Because it seems often the history isn't saved when shutting down and not closing gnome terminal, I'd like to append to bash history before showing the prompt if the line isn't a duplicate. Although I ...
2
votes
1answer
169 views

How to enable the bash history only caching commands that are acutally in path?

Having a bash history enabled is a security risk, because when you accientally enter your password into the bash the password gets stored in the bash history. To prevent this a good solution would be ...
1
vote
1answer
895 views

Does Linux save the history of executed commands

I know we can do a "history" command or use control+R to find the command history in a particular shell session. But is there a way to find out the command history of my last ssh session for example? ...
1
vote
3answers
170 views

Copy all users' .bash_history in one go

Is it possible to use cp to copy every user's .bash_history file into the same folder (with the username appended)? Or is it at least possible to copy them into a parallel set of folders? I can't ...
1
vote
1answer
42 views

Automatically export history at end of powershell session

I can export my Powershell history using the scripts outlined in the Technet page on the subject, Get-History | Export-Clixml ~\PowerShell\history.xml and I can automatically load up the saved ...
1
vote
2answers
73 views

Logging in over ssh in a different session?

I don't know exactly what the correct term is, but I notice if I log in to a remote SSH server, then close the window, open a new one, and log into that server again, my bash history and user ...
1
vote
2answers
44 views

How to see history of commands entered as superuser

Is there a way to see the commands that I entered in su mode? Similar to the ~/.bash_history? Where would this be located?
1
vote
1answer
216 views

Terminal history in auto-completion

I am running Ubuntu 12.04 LTS and for some reason there is no terminal history (hitting the up arrow for the previous command), nor is there auto-completion (hitting the tab key). These wonderful ...
1
vote
1answer
505 views

How to enable command history in Run, without enabling recently opened programs history in start menu?

I want to enable command history in Run dialog box, without enabling recently opened programs history in start menu? (!) This previous answer will enable history in both Run and Start Menu (recently ...
1
vote
1answer
148 views

Accessing your bash profile and history anywhere - via the internet

I'm curious if anyone has tried to tackle the task of having non-sensitive parts of their bash (or other shell) profile made available anywhere they go. I worked for a company for a time that did ...
1
vote
1answer
230 views

Repeat last command matching “two words” zsh

I want to repeat the last command that matches foo bar. Using !! doesn't work (it's not the last command I used), and neither does !foo, because my history looks something like foo bar dee zep foo ...
1
vote
1answer
171 views

How to make windows 8.1 command line save commands history?

Exist a way to automatically save command history on windows 8.1 command line and have it available after close and open the command line program?
1
vote
2answers
235 views

Bash is losing history even though shopt -s histappend is set

I lost all commands that were executed from the last session - they do not show up in history at all. What needs to be done to prevent this?? I had added shopt -s histappend just for this ...
1
vote
1answer
166 views

put in bash or zsh history absolute path to files I working on

I have found that in bash i frequently use something like that: vim ./somefile1 less less ./dir1/dir2/somefile2 cp some_other_relative_path_to_file and so on After that when I trying to find a ...
1
vote
1answer
123 views

how to speed up my .bash_history commands

I use my .bash_history all the time using ctrl-R to find complex commands I figured out in the past and since forgot how to run. I have a large history (50,000) lines, managed by these commands in my ...
1
vote
1answer
205 views

Windows Command Prompt: How to change the size of command history window?

Pressing F7 in the Windows command prompt window displays a console window with the command history (list of previous commands). How do I change the size of this command history window? For example, ...
1
vote
1answer
676 views

Notepad++ Undo History wanted

I cannot seem to find a history in Notepad++ showing you all the actions you did. Sometimes you might not be sure anymore what the next Undo action would do. Does this feature really not exist or I ...
1
vote
1answer
120 views

Making bash command history act like Windows command shell

In bash, up arrow recalls the previous command. Tap it twenty times, I get the command from twenty places back in history which I ran five minutes ago. Suppose I run that command right now. Now when ...
0
votes
1answer
297 views

“history position out of range” when calling history from bash script

I want to make a simple script to delete a line from bash_history, based on user input of the line number. echo -n "Delete History Line Number: " read num history -d $num The error is "history ...
0
votes
3answers
61 views

Disable repeated items in bash history

Bash in Fedora 19 is really annoying me. Say I run a command: echo "Hello" Then I run another command: echo "World" Now I run the last command (echo "World") again N times by pressing up on my ...
0
votes
1answer
3k views

How to enable command history in Run command dialog box? [duplicate]

Possible Duplicate: Enable history for Run dialog for Vista administrator In my PC (running Windows 7 Professional - 64 bit), the Run dialog box does not keep the history of previous ...
0
votes
3answers
61 views

Is there a way to determine which user ran a command in bash history?

We work on CentOS servers available to over a hundred employees via SSH, each with their own login. Running a normal history bash command shows all of the commands ran by all of the employees, however ...
0
votes
0answers
17 views

Location of commands executed in past

With HISTTIMEFORMAT="%d/%m/%y %T ", history command shows the exact time of the execution of a command. Is there a way to find from which folder the command was executed?
0
votes
2answers
59 views

Why does “cmd /k” reset/clear/delete command history?

Can anyone explain why cmd /k clears the command history of my window terminal (CMD). When I run a batch file within a previously CMD and I put cmd /k at the end of the line, the command history will ...