recall commands previously typed in a shell or other utility

learn more… | top users | synonyms

2
votes
1answer
96 views

How to get a history entry to properly display on multiple lines

Suppose I have entered a function at the bash prompt, on multiple lines rather than squeezing it onto one with semicolons: $ function blah { echo blah } $ history -1 12690 function blah {\necho ...
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 ...
2
votes
2answers
106 views

How to get history search to start afresh?

When I do a search using CtrlR, the search gets limited to entries older than displayed hit. How do I reset this so that it starts from the beginning (i.e. from latest history entry) without leaving ...
2
votes
1answer
61 views

Duplicates in history file even after HISTCONTROL specified

I am using cygwin with bash (on Windows 7 pro). I have the following in .bashrc: # Don't put duplicate lines in the history. export HISTCONTROL="ignoredups" and the following in .bash_profile: # ...
2
votes
3answers
304 views

How can I get the last line number of unique commands when grepping my history file?

I rely on my history file for previous commands, especially ones that are long with many parameters. Once I find the command and its line number(nn) I use !nn to run it. I prefer to see the full ...
2
votes
1answer
61 views

How to use quick substitution to replace all the strings of the previous command? [duplicate]

I know I can replace a string of the previous command using ^old^new. But it seems to only replace the first occurrences as I do the follow: $ cat /proc/5742/task/5742/status ... $ ^5742^2839 cat ...
2
votes
2answers
265 views

Bash's declare -p HISTIGNORE brings bash to a halt! Why?

Executing the following code in GNU bash, Version 4.2.45(1)-release (x86_64-redhat-linux-gnu), Fedora 19 ... shopt -s extglob export ...
2
votes
2answers
1k views

HISTTIMEFORMAT modification. In /etc/bash.rc or /etc/profile? [duplicate]

I'd like to add the date/time to the output of the history command in CentOS/RHEL 6. I would like this to apply to all users on the machine by default. This itself is easy. It seems to just be a case ...
2
votes
1answer
120 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 ...
2
votes
1answer
36 views

Can you change timestamp format for history command on tcsh

When I run history command (on tcsh), it only prints the TIME portion of the timestamp and omits the date: 3 15:07 echo $PATH 4 15:07 ls -la In bash, you can use HISTTIMEFORMAT ...
2
votes
1answer
49 views

Ctrl-R style interactive search in custom file

I want to be able to search a custom text file similar to the interactive history search in bash. Once the wanted entry is found, executes the line. Bonus Points: have each record contain two ...
2
votes
1answer
125 views

History in the Almquist shell in the NetBSD

In NetBSD /bin/sh is a modified version of the Almquist shell. With the command fc -l it is possible to view the last 16 commands typed in the prompt in the current session and not the older ones. ...
2
votes
1answer
182 views

Get the last executed command line in ksh

Is there a way to get the last executed command possibly together with the arguments within a ksh script? I am using mksh with cygwin. I tried fc -nl -1, but the script throws a "“fc: history ...
2
votes
1answer
501 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?
2
votes
1answer
280 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 ...
2
votes
1answer
47 views

Persistent directory stacks across sessions in zsh

I would like to share my directory stack (the one accessed with dirs) across sessions and tmux panes/windows. In the zshbuiltins man page I have found autopushd to add every directory I switch into ...
2
votes
0answers
113 views

Preserve tcsh history in multiple terminal windows

How can we preserve or maintain the same history across multiple terminals? The same question, but for bash shell , were discussed in the below link Preserve bash history in multiple terminal ...
2
votes
0answers
231 views

Tcsh: Searching history using Ctrl-P and Ctrl-N

What are the equivalent functions in tcsh for the following zsh functions? up-line-or-history history-beginning-search-backward down-line-or-history history-beginning-search-forward I have the ...
1
vote
3answers
50 views

Command to 're-apply' previous command?

Is there an easy way to re-apply a previous command to a new command line entry? Say I typed in chmod u+r,g+x file.txt but forgot the sudo. Could I simply type sudo <some easy symbol>'? ...
1
vote
3answers
121 views

Copy command from history to bash prompt

Sometimes I'd like to get some command from history output, copy it to bash prompt, make some changes and run it. Is there a way to copy command from a history output to bash prompt without involving ...
1
vote
1answer
46 views

Unable to make .zhistory a symbolic link

Every time I try to make my Zsh history file (.zhistory file) a symbolic link to a file (previously existing .zhistory file) that lives in another folder, Zsh deletes the symbolic link and makes it a ...
1
vote
1answer
198 views

Recover my history of past commands?

Always when I turn on my Fedora 18, my history command disappear. How can I recovery all my history since I installed my OS? In my ./bash_history show olny the command of the day when I turn off ...
1
vote
3answers
88 views

Terminal: Use different command on previous file

I know that there is the !! command to reuse the previous command. How would one reuse the file or directory specified in the previous command but use a different command on it? Example: I want to ...
1
vote
3answers
297 views

Best tool for monitoring server usage

I was just wondering what the best tools for retracing logs and what logs I should be checking to work out what's going wrong with a server, or what the client has executed to get the server into it's ...
1
vote
2answers
1k views

Extending history search in zsh

How to extend Ctrl+R search in zsh? It cannot find entry despite it is in history file. Edit: My .zshrc: setopt AUTO_CD setopt CORRECT_ALL setopt EXTENDED_GLOB # History SAVEHIST=10000 ...
1
vote
2answers
42 views

Livesearch with first 10 matches as preview for zsh-history?

I have seen a history-livesearch with a preview, that shows the 10 first matches in the history in a list below the BUFFER-line, which is updated on every keystroke, and acts like the standard ctrl+r ...
1
vote
2answers
213 views

shell saves ip address that you ping? [duplicate]

I was once shown a shortcut that I can't recall/ find. After pinging an ip, then attempting to ssh into it - the ip was saved into to a variable automagically. Something like: ping 10.1.23.4 ...
1
vote
2answers
49 views

Can I see in history output from which directory I had actually issued a command?

CTRL+R allows me to reverse search through the command history which is great but can I also find out from which directory that command was run? I am using C-shell in Linux.
1
vote
1answer
297 views

How to sync terminal session command history in bash?

I've tried to search in ~/.bash_history for my recent commands while in a terminal session but they just weren't there. I guess this is because I have multiple terminal sessions open. Is there a way ...
1
vote
1answer
162 views

Enable previous command cycling at ftp prompt

Currently on pressing arrow keys or Ctrl+P/N, I see characters like ftp> ^[[A ftp> ^[[B ftp> ^P ftp> ^N I would like to know, how to configure the ftp prompt so that I am able to view ...
1
vote
2answers
613 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
1answer
242 views

Pressing `up` to get the previous command in a tty on Ubuntu Server

I've installed Ubuntu Server 10.10, and when I press up in a terminal nothing happens. Using Ubuntu Desktop it gave me the previous command that I ran. How can I make it do this in Ubuntu Server as ...
1
vote
1answer
18 views

Partially duplicated history when setting PS1 in .bash_profile [duplicate]

When I set PS1 variable in ~/.bash_profile, it worked as configured. However, the history is somehow messed up. When I press Arrow Up or Ctrl+P to view commands I typed, it starts to duplicate ...
1
vote
1answer
65 views

Searching history forward after backward?

In bash, when I hit Ctrlr, I can search the command history backward. If I would like to search forward again, what shall I do? I hit Ctrls, but it doesn't work. My bash is GNU bash, version ...
1
vote
2answers
61 views

alias for a command using !! to recall the last command [duplicate]

This is a follow-up question to Execute a line of commands with one sudo If you want to redo the same command with sudo !! after doing a command like this: echo "something">/path/file You ...
1
vote
1answer
760 views

Automatically save bash command history in screen session [duplicate]

I connect to a screen session. After doing some stuff I detach it. Then in history | tail I only see screen -r and previous commands and not the commands run in screen session. Basically history shows ...
1
vote
3answers
3k views

How to run the most recent command on AIX?

How can I run the most recent command again from history in AIX Server? And how to edit the most recent command and run it again in AIX?
1
vote
2answers
1k views

Shell - Deal with multiple command history files

Where I work, for security and auditing purpose, we have to keep one history file for each session (user, date, terminal, etc in the file name). Obviously, the HISTFILE variable, is set to read only ...
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. ...
1
vote
2answers
194 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 ...
1
vote
0answers
71 views

HISTSIZE HISTFILESIZE not working [closed]

I have set these global variables in my .bashrc file Running echo $HISTSIZE echo $HISTFILESIZE both return 10000 My History contents are overding, currently from 254 - 432 If I type another two ...
1
vote
0answers
31 views

why bash history overlap the prompt when scroll up in the history? [duplicate]

I customized my bash prompt, PS1 value. ~/.bashrc: Color_Off='\e[0m' # Text Reset BGreen='\e[1;32m' # Green BPurple='\e[1;35m' # Purple BWhite='\e[1;37m' # White ...
1
vote
0answers
108 views

Zsh: quickly bookmark commands

I just had an idea, I'm sure it must exist though I could not find anything on the web. This topic gets close to my idea but not enough: How to quickly store and access often used commands? I'd like ...
1
vote
3answers
429 views

Different “history” command output after reconnecting via SSH

Why do I get different results for the "history" command for the same user after I reconnect a disconnected SSH session? I connect to a server using putty (SSH), say as root My network gets ...
1
vote
0answers
402 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
1answer
655 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 ...
0
votes
2answers
301 views

How to use the last command in the while loop?

I am wondering how to modify this code. ls while [ 1 > 0 ] do fc -s sleep 1 done For fc -s, you can refer to this question for details. My question are as follows: How will it run? If you ...
0
votes
2answers
89 views

Why must you be careful when using Bash's built in command history function to re-run previous commands that contain variables?

I know !! re-runs commands but what exactly would occur if I re-ran a command that had a variable in the command?
0
votes
1answer
57 views

openSuse, linux, chmod to change link's permisions

I am trying to change the permissions for the link. I want the "Other" entity to have only the read permission, but when I run the command the permissions are not changing. Is there something I am not ...
0
votes
2answers
643 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 ...