33
votes
2answers
2k views

How do I open an incognito bash session?

Is it possible to open an incognito session in bash? For example, when we need to enter passwords in commands and don't want bash to add them to history.
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 ...
6
votes
2answers
183 views

echo of a string with an exclamation point

Here are what I put in bash and the results I got about 'echo': $ echo '!$' !$ $ echo "!$" echo "'!$'" '!$' I'd like to know how 'echo' deals with the second input. It seems to me that ...
2
votes
1answer
156 views

How does execution of !find command work?

The !find command lets the user perform the previously executed find, with all its parameters. How does it work internally, where exactly has this behaviour been programmed?
16
votes
8answers
2k views

How do I repeat the last command without using the arrow keys?

I know I can use Up to iterate through previous commands. Running the last command simply involves Up + Enter. However, I was thinking of buying the Happy Hacking Keyboard as I spend a lot of time in ...
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. ...
4
votes
1answer
229 views

Why do piping and redirection work differently with here documents?

Combining a redirect with a here document seems logical enough: $ bash > foo <<EOF echo Hello EOF $ less foo Hello But with a pipe it behaves differently: $ bash | tee foo <<EOF ...
11
votes
4answers
816 views

Search for a previous command with the same prefix when I press Up at a shell prompt

Coming from a FreeBSD world I wish to make the Linux terminal behave like FreeBSD one, especially the 9.1 version, basically when you type cd in the terminal and push the "up" arrow you can browse all ...
9
votes
2answers
2k views

How can you log every command typed

How can you log every command someone has entered into the shell? I'm asking on both the basis of protecting yourself if you are logged into someone else's server and something breaks, or if someone ...
1
vote
3answers
430 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 ...
17
votes
5answers
1k views

In what situations would a user not let the shell record his command into history?

If I add export HISTCONTROL=ignorespace in .bashrc, bash won't record any commands which have whitespace before them into history. But I do not understand under what situations it will be useful. ...
4
votes
3answers
134 views

Can any shell do argument-level interactive search?

Sometimes I need to reuse certain long arguments like paths. If I use history search (CTRL+R), I may find some command that contains the path, but I still need to delete anything else in the old ...
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?
9
votes
2answers
962 views

Command line prediction

I've found an interesting paper: Predicting UNIX Command Lines about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?
17
votes
1answer
12k views

How to remove a single line from history?

I'm working in Mac OSX, so I guess I'm using bash...? Sometimes I enter something that I don't want to be remembered in the history. How do I remove it?
2
votes
1answer
148 views

How do I create history files with date automatically attached?

E.g. at the end of the session for each day I want to create a history file with the date attached at the end. So, say, history > history07162012.txt or something like that.
3
votes
4answers
465 views

Prevent a command from being executed after another command

I would like the shell to warn me for potential errors I'm about to make. How can I prevent a command cmd2 from being executed after cmd1. For example: $ tar tf file.tar $ rm !$ Here, I just ...
3
votes
4answers
261 views

Change working directory of 2 terminals at once

I've typically have gnome-terminal open with ~8 tabs, using 2 consecutive tabs for the same task (one has emacs, the other is used to do git checkins and unittest runs and so). When changing tasks, I ...
8
votes
4answers
2k 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 ...
7
votes
2answers
531 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 ...
3
votes
1answer
482 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 ...
3
votes
2answers
674 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 ...
2
votes
1answer
248 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 ...
6
votes
1answer
328 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 ...
6
votes
6answers
593 views

How can I reproduce commands run on one machine on another machine?

I would like to install some software on a linux-machine that I have run in VirtualBox. Then I would like to do the same thing on a linux-VPS. I think that I can save all commands that I run using ...
0
votes
0answers
325 views

bash: recall command by typing some characters of it [duplicate]

Possible Duplicate: best way to search my shell's history In MSDOS I have the option to start typing some characters of a previous command and then pressing F8 it will search the ...
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 ...
11
votes
8answers
384 views

How to access the history on the fly in unix?

for example, if I do a mkdir thisismyfolder912 I remember there is some easier way to switch to thisismyfolder912 than having to do a cd thisismyfolder912 What is that way and how does it work? ...
39
votes
12answers
7k views

best way to search my shell's history

Is there a better way to search my history file for a command than grep? I do have some idea what the command starts as, but I don't know how far back in the history it is. update: was formerly zsh ...