recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

0
votes
1answer
27 views

How to prevent .bash_history from being used to rebuild history

We use custom history files which get backed up per user. When someone does a history -c we notice that after they log back in there is history in the buffer again and it seems to come from ...
2
votes
1answer
33 views

zsh tcsh-like history navigation

In tcsh, the \eP and \eN commands take into account the whitespace-normalized prefix of the current line, not just the first word. For instance if my history contains git pull upstream ...
3
votes
1answer
56 views

What does !# (exclamation hash), !$:r:r (exclamation dollar colon r), !#:t (exclamation hash colon t) mean in the below bash commands?

I have been trying to install a Nagios package and stumbled upon these weird bash expansions on a guide here. Can someone help me understand what do the expansions mean? A wiki link would also be ...
0
votes
1answer
21 views

Why there isn't a number of the command and a timestamp for fish?

In fish, when I type history | less I see the following for example: history | less export HISTTIMEFORMAT="%h/%d - %H:%M:%S " bash in bash I see this: 491 18/04/16 14:31:02 cd 492 18/04/16 ...
1
vote
1answer
29 views

Commands pasted into bash not recorded in history [duplicate]

From time to time I find that when I copy/paste a command from a web page (or from the Terminal window itself) the pasted command is not recorded in bash history. For example, just now I did this: cd ...
4
votes
1answer
37 views

What does the history command !# do?

From the manual pages on history: Event Designators An event designator is a reference to a command line entry in the his‐ tory list. Unless the reference is absolute, ...
1
vote
1answer
26 views

How do I both censor a command away from .bash_history and also be able to return to it with up arrow?

When one prepends a space character to the command, it disappears from history. But this also causes the command to no not easily editable and re-runnable. How do I make weaker version of ...
5
votes
1answer
40 views

Clear recent open file history on Linux Mint

Sometimes others in my household briefly use my computer, when they do I sometimes don't want them to see my file history. I know how to prevent Bash from writing entries to the ~/.bash_history file ...
0
votes
1answer
44 views

Create HISTFILE in subshell

Here is my HISTFILE: $ echo $HISTFILE /home/Steven/.bash_history I can create it by using exit: $ [ -e $HISTFILE ]; echo $? 1 $ exit $ [ -e $HISTFILE ]; echo $? 0 However if I exit a subshell, ...
0
votes
0answers
13 views

searching through command line history [duplicate]

I use reverse search when looking for a particular command on the command line by pressing CTRL + R. That returns the first command it finds in reverse order. To go back to the next further command I ...
2
votes
3answers
737 views

Why can't Korn Shell do ctrl-r?

If I use PC-BSD with the default shell (Korn) then Ctrl+r doesn't work. Why won't it work? Ctrl-r was introduced to search your history in the late 1970s or early 80s and my BSD still can't do it ...
26
votes
4answers
2k views

Is there any way to execute commands from history?

For example: [root@ip-10-0-7-125 ~]# history | grep free 594 free -m 634 free -m | xargs | awk '{print "free/total memory" $17 " / " $ 8}' 635 free -m 636 free -m | xargs | awk '{print ...
1
vote
3answers
86 views

Unlimited history in zsh

In zsh, I want to have unlimited history. I set HISTSIZE=, which works in bash. Now I import an old history mv old_history .history which is pretty big wc -l .history 43562 .history If I now ...
1
vote
1answer
86 views

timestamp saved history file

I've seen a lot of documentation on how to timestamp the output of the history command. But how would you go about time-stamping a saved history file? For example I have a server setup to save each ...
0
votes
1answer
50 views

How can I access the history buffer in sh? (not in Bash)

Is there a command history in sh, for example how to access it, and as well, how to ensure it is clear? To clarify shells here: let's say you've logged on to a non-Gui Linux system, and $SHELL is ...
0
votes
1answer
22 views

How to increase history in oh-my-zsh?

I just installed oh-my-zsh for the first time. I just want to know how can I modify the number of past commands that are remembered in history? Where can I set this setting?
1
vote
1answer
62 views

how to save a command in bash history without executing it programmatically?

I have a docker container and every time I build and start it, I want just to press UP for choosing a predefined command. What's the best way to handle this?
22
votes
8answers
1k views

Clipboard for copying and pasting files in command line?

In Bash, suppose I visit a directory, and then another directory. I would like to copy a file from the first directory to the second directory, but without specifying the long pathnames of them. Is it ...
2
votes
1answer
60 views

Search bash history for already typed command

When I type ctrl+r and then start typing I can see what commands in the history match which is great. Now is there a way to search the history on commands I have already typed in the terminal? For ...
1
vote
1answer
39 views

Duplicates in bash history

I have the following in my ~/.bashrc HISTCONTROL=ignoreboth:erasedups However my history contains many duplicates e.g. I have 5 entries for sudo apt-get upgrade. I am running Raspbian Jessie and ...
1
vote
1answer
78 views

zsh HISTFILE - still read from ~/.zsh_history

I set my $HISTFILE env var to something custom, and my zsh is indeed writing to the new histfile. But when using up-arrow or other history-searching capabilities, it still reads from ~/.zsh_history. ...
1
vote
0answers
28 views

history shows only current session

This is what I see in my terminal in a fresh session: Agent pid 6847 Identity added: /home/eric/.ssh/id_rsa (/home/eric/.ssh/id_rsa) ➜ ~ history 1 history ➜ ~ I'm using Linux Mint 17.3 ...
0
votes
0answers
18 views

Can I make history not print any timestamps for commands that were run before I enabled that option?

If you run history, it outputs the current date before commands that were run before I enabled timestamps, is there anyway I can make it ignore that? For example, if my .bash_history looks like this: ...
1
vote
0answers
33 views

Can I prevent zsh slowing with a large history?

I've just migrated from bash to zsh. I converted ~/.bash_history for use in zsh. It's 150 000 lines long. bash is almost instantaneous to start up, but zsh is now fairly slow, taking half a second to ...
1
vote
1answer
102 views

Implement a shell in a bash script [closed]

I am trying to emulate a shell in a bash script, like this: cmd_shell() { while true; do read -e -p 'pass> ' command run_cmd $command done } It works ok, and the option ...
1
vote
2answers
84 views

How to get the previously used command in HP-UX reverse search

I'm using HP-UX OS and want to use previously typed command, as how I'm using in Linux Ctrl+r for ease access in the HP-UX command line.
3
votes
4answers
73 views

Sticky entries in shell history

Is there a way one could make some commands "sticky" in a shell history? I want to save some favourite commands that would be searchable with Ctrl+R, like the rest of the history, but they should ...
0
votes
1answer
52 views

bash-like last command in history using up-down arrow keys in zsh [duplicate]

In bash, we can use the up and down arrow keys to get the last or nth previous command in history. Can we do this in zsh?
1
vote
2answers
110 views

Echo & redirect bash history !commands to file

Is it possible to echo and redirect history commands into a script file by the ! command? Is there variation of the pipe, redirect, or tee commands I am overlooking? 518 xmodmap -e "keycode 66 = ...
0
votes
0answers
23 views

Linux Bash History - eliminate/stop specific command from being stored in history [duplicate]

I have shared history (very large history too) setup in my .bashrc file (see below for my .bashrc). I also have PRTG monitoring (uptime monitoring and graphing, like MRTG) of my many linux/centos ...
1
vote
0answers
39 views

Variables in history?

Is it possible to include environment variables in the history output. Something along the lines of: %T %F $SUDO_USER $HISTORY_COMMAND 1 2015-01-01 00:00:00 USER123 echo 123 Reason being we have a ...
1
vote
1answer
28 views

Is there any way to list the latest GUI transactions in Linux?

Suppose that I've moved a directory in my Xfc desktop in another directory, which I can't remember the name of the destination directory. Is there any way to list the latest transactions in ...
0
votes
0answers
21 views

How to remove duplicate entries from bash history? [duplicate]

I have set: $ echo $HISTCONTROL ignoreboth:erasedups and expected by the value of erasedups for all my duplicates entries to disappear from my bash history. Yet when calling cd a few time, I still ...
3
votes
2answers
70 views

Inconsistent Bash history

On this Debian Jessie installation, Bash history seems to be behaving inconsistently in Gnome Terminal: $ echo $USER me $ echo $HISTFILE /home/me/.bash_history $ grep browser ~/.bash_history ...
0
votes
0answers
18 views

Bash previous command refresh is messed up [duplicate]

I'm running on a mac with el Capitan. I'm at the command prompt, running bash. When I hit the up-arrow, sometimes it's as if it thinks that my prompt is much longer than it is? The first part of the ...
1
vote
2answers
75 views

What is in a new terminal window's command history?

If I open a terminal window (Gnome terminal 3.6.2) and type a command, say echo "hello", then open a new terminal window and type <Ctrl>Rhello, I might expect to be able to dig this command out ...
2
votes
2answers
100 views

Can't get “echo !!” to work in bash from a saved script

I'm trying to write a simple script to take a previous command that was (accidentally) written in a non-English layout, convert everything into correct symbols and run it. I'm using Bash 4.3.11. My ...
4
votes
3answers
144 views

How to make Bash flush command history so it can be cleared?

I accidentally put a password on the command line and needed to clear Bash shell history. That was easy enough with echo "" > ~/.bash_history. I added the same to my .bash_logout just in case for ...
3
votes
1answer
162 views

Replace the last word of last command but keep the first

Assuming I have a script for grepping through a bunch of files with certain options and run this script with many different words: $ mygrep worda [output] $ mygrep wordb [output] $ mygrep wordc ...
28
votes
2answers
1k views

What does !#:3 mean in a shell command

The install guide for ack suggests installing the ack script using this command: curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3 I assume that the !#:3 at ...
3
votes
4answers
276 views

How to remove the last command (or current command for bonus) from zsh history

Sure there's a super simple smart way to do this, but since history in zshell seems to be aliased to fc, there's no way to use the tricks mentioned in How to remove a single line from history?. Any ...
3
votes
3answers
160 views

fish: sudo: !!: command not found

I have fish installed in my Linux Mint DE. I really like how fish makes things easier and it looks so pretty although I haven't find a correct answer about why I can't execute: sudo: !!: command not ...
12
votes
5answers
1k views

How to recall a previous command (without execution) in order to change it?

I can't remember the trick where I could get the last command without running it: let's say I want to be be able to access the command !1255 when pressing the up arrow key and modify the command. So ...
5
votes
5answers
1k views

Where is the log of used commands in Linux?

In Linux, generally we use a lot of commands and it is difficult to remember all of them. history command provides the list of commands we used previously but its limit is less. New commands are ...
17
votes
6answers
1k views

Search for a previous command with the prefix I just typed

We can use up and down arrow to navigate in command history. In some IDE, such as matlab, if we input sth and then press the arrow keys, we stroll among only the history commands starting with what ...
1
vote
1answer
30 views

Some confusion about the working mechanism of ~/.bash_history

I'm confusing about the content in ~/.bash_history when I worked on several terminals. How does it work on saving the history in different terminals?
0
votes
0answers
48 views

reverse-i-search (Ctrl-r) with history -r?

I'm searching a way to reload the bash history before executing "Ctrl-r" command. Or better, complete using the .bash_history instead of the in-memory dump. Every Terminal has its "own" history but ...
0
votes
1answer
96 views

Where is zsh storing my history?

I have two terminals open, both running zsh. The history options which I currently have set are these: export HISTFILE=~/.histfile export HISTSIZE=10000 export SAVEHIST=10000 setopt ...
3
votes
2answers
159 views

Can I delete .bash_history without sudo?

I don't want it to do it to my system, But I am wondering , is it possible to delete .bash_history ? And if yes, Then can you bring it up again or there will be no history ever again ? Also, Is the ...
2
votes
1answer
218 views

.bash_history vs history command

When I open my .bash_history file and view my previous commands via the history command, I see that they are not the same exact commands ? I feel like the .bash_history commands contains less ...