Repeat last command windows terminal - windows-terminal

On the Windows Terminal, is there a way to repeat the last command by starting character, similar to the feature on a Unix Terminal?
For example, if I type the command cd .. then laster type !cd on a Unix Terminal, it will do the command cd .. again. However, I can't find this feature on the Windows Terminal.
EDIT: Here is the terminal I am using (as installed by Windows, no specific configurations):
EDIT: I am aware that pressing the up/down arrow can navigate the history of commands, but I am in a situation where I use a multitude of different commands and use the arrow keys every time can be tedious. Accessing last command by starting letter will be a lot more useful, similar to the ! command on Unix mentioned above.
Two Solutions
Ctrl + r, then type initial letter(s)
type initial letter(s), then F8

If you are using PowerShell or Bash on your Windows Terminal, you can use a feature called Reverse Search. This will go through your history backwards and show you the recently used command based on the starting characters.
In order to activate reverse search, press Ctrl + R on the terminal and type out the initial characters and watch the recent command appear.
Bonus tip: You can press Ctrl + R further to show next recent command
Note: This does not work for Command Prompt (cmd.exe)

Related

Call the previous command in lldb inside Xcode

I have a basic question on lldb in Xcode.
When using lldb in Xcode, how you guys call the command previously executed ?
Typing the same command every time is very frustrated to me, and
now looking the way to call them in efficient way.
I know "command history" will list the command with the number,
and the $ will execute the command.
But is there something similar like ctrl-p/ctrl-n or ctrl-r in bash
to show or search the previous commands ?
(lldb command running on terminal (not build-in lldb inside
Xcode) can do this.)
I'm using Xcode version 11.5(11E608c).
Use up arrow in the LLDB command prompt. It works similar to Terminal in that regard.
Type Ctrl R and then type part of the command you want. It'll display the first matching command. Keep typing Ctrl R and it will cycle through previous matching commands.

Search a text on terminal output on Mac (not using Terminator)

I installed something via Terminal (iterm2) on Mac and it showed a whole bunch of commands while installing. I need to look for a specific word to decide my next step?
What should I do?
Note:
I don't want to search a file. I want to search a text on the terminal output.
I cant use Ctrl + Shift + F. It for Ubuntu, not for Mac.
I don't use Terminator.
Damn it! Simply Ctrl + F works.
Edit: As #sojim2 pointed out in comments, it's CMD + F on mac.

how do you enable command line editing with vim keys using mac terminal?

I'm reading this book and I really do not understand what this author is talking about. It appears that you can program your mac to go forward one character by either hitting l or ^F. I do not understand the difference between emac key stroke and vim keystroke. He also says run this command and 'place it in your $HOME/.bash_profile but I cannot figure out how to place the command in the bas_profile.
The Author is talking about make you terminal console behaves like vi, this means typing set -o vi in your terminal, the console will work similar vi. So you will be able to navigate using the motion keys of vi, use INSERT mode, x to delete, etc.
You can set that permanently if you include this command in your ~/.bash_profile file.
If you are not sure what it does, I don't recommend so.

Missing windows command line history when executed from Matlab

I occasionally use the Matlab 'dos' command which brings up a command window and executes a program for me. However, I've discovered that the command issued through Matlab is not present in the history of the command window - which means that I can't simply hit the up arrow key to call up the command and run it again.
Is there a way to retrieve Windows command window history when the original command was issued through the Matlab 'dos' function?
No. The Windows command processor only stores what you typed in the command history. Alternative command processors may differ.

unable to use ctrl f to go back to a suspended program in vim

I am new to ubuntu and vim. I was writing a 'C' language code in vim. After saving the file , I used ctrl + z to suspend the program but I am unable to go back to the source code by pressing ctrl+f. Please help me with this.
In Bash (the default shell in Ubuntu, though the following applies to most other shells, too), the suspended programs can be listed with the jobs command, and fg (optionally followed by a [jobspec]) puts it back to the foreground.
Next time you're struggling with something like this, bring up the corresponding man page:
$ man bash
A quick search for "suspend" brings you right to the chapter job control!

Resources