Skip to main content

All Questions

1 vote
2 answers
3k views

On macOS, how do we remove the past commands history from Terminal > Shell > New Command?

We want to remove the list of commands that were run in the past in the New Command window. It is the AutoFill or AutoComplete history of commands. To see them, follow these steps: Launch Terminal ...
Muhammad Asif Mohtesham's user avatar
1 vote
1 answer
1k views

Bash prompt getting garbled when I browse history?

I have MacOS and .bash_profile content: export PS1="\[\e[0;31m$\]\[\e[m\] \[\e[0;32m\w\e[m\] : \]" as a result I have pwd printed in terminal like this: but when I press up and down arrows to use ...
Vladimir Gerasimenko's user avatar
2 votes
2 answers
8k views

How do I record all terminal input and output to a local file by default for each session?

I'm aware the script command can be used to record all keyboard input and screen output to a file, but this has to be invoked each time a terminal session is started. I keep timestamped versions of my ...
user208145's user avatar
  • 2,535
15 votes
5 answers
18k 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 ...
Arturas M's user avatar
  • 254
1 vote
3 answers
212 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 ...
aldorado's user avatar
  • 625
3 votes
4 answers
591 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 ...
cweiske's user avatar
  • 531