Ho to abort a command in Ubuntu(16.04), where CTRL+C I am already using for copying? - ubuntu-16.04

I am currently using CTRL+C and CTRL+V for copy and paste respectively in Ubuntu (16.04). So in this case, how can I terminate /abort a command in Terminal.
NOTE: The control+C does not work for me neither quit() or Exit().
Please advise.

The default terminal (gnome-terminal) uses Ctrl+Shift+c and Ctrl+Shift+v for exactly this reason. If you are in a bash prompt (unclear from context here), you can quit by writing exit.

Related

VSCode Terminal - Clear Command Prompt

I'm running on Linux. I have the issue both in bash and pwsh shells.
How do I clear the current command prompt in the VS Code terminal?
For example, say you have copied and pasted a very long string into the terminal.
How do you clear what you just pasted?
The only way I know of for getting back to a an empty command prompt involves hitting backspace until you have deleted every character.
Is there any short cut for getting back to an empty prompt?
Thanks!
How do you clear what you just pasted?
There is no command to clear what you have already pasted. You can do Ctrl + C or Ctrl+D to get the next promt.
Now if you want a short-cut to clear command which we use in terminal, its Cmd + k for Mac OS
CTRL + shift + p, then write clear. You can use the clear command in bash terminal too.
Use Console.Clear() in code.
or use 'cls' cmd on console

How to exit gitbash after running Mongod?

I am following some tutorials on how to work with Mongodb but they don't explain how to close the CLI. I usually just use "exit" but after running mongod it now does nothing, and if I try to leave by just closing the window I get a message saying "processes running in session".
I get the same problem with the other gitbash window after running npm run dev (I think the "dev" part is just specific to what I do now?).
Normally you can press 'ctrl' + 'c' on your keyboard and it should stop the process running on your command line tool.
Have a look here thing might be more MongoDB specific help
https://stackoverflow.com/a/11776728/4389143
The command to save a file in Vim and quit the editor is :wq . To save the file and exit the editor simultaneously, press Esc to switch to normal mode, type :wq and hit Enter .
Check this.

Ctrl+c not working in integrated terminal which uses Powershell

I'm using Powershell in the integrated terminal by adding the following line to the settings.json file.
"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\WindowsPowershell\\v1.0\\powershell.exe",
It works very well, but usually, when I'm in Powershell, typing ctrl+c cancels what I had typed and opens a new line.
But in the integrated terminal it just prints ^C.
Is there a way to fix it or find an alternative method to achieve this?
Thanks
This is with VSCode and not necessarily with the PowerShell Extension. You can see this by just using the default cmd.exe terminal, CTRL+C does nothing. It does not print the ^C at all, and creates no new line.
If you want this to work as expected in the normal command prompt or PowerShell.exe you will need to submit an issue to VSCode repository and request it.
I would expect this is all tied to the keybindings.json file. I went through that file but could not find a command available to the same function that occurs in the full command prompt or console. So this will likely need a new command added for VSCode.
If you search through the keybindings file you can see the terminal has that key CTRL+C bound to copySelection when terminalFocus && terminalTextSelected. This is why the ^C is being output, and no new line is being added.
A workaround:
Pressing Esc will erase the line back to the beginning.

How do I make MINGW not wait for Sublime Text to close before accepting more commands?

On my Windows, I managed to get sublime text become a command on my MINGW terminal. I'm able to open sublime text itself or open sublime text with a text file. However, the terminal won't accept more commands until I close the terminal. It's similar to calling vim, where vim needs to exit before it accepts more commands. But sublime is its own window, so there's no reason for a terminal to wait. What is the way to configure a command in such a way that we don't wait for it to terminate before the terminal accept more commands?
Is it a bash compatible shell?
The most obvious way of doing might be to append an & to the end of
the command. This detaches the command from stdin which means the
shell isn’t tied up by the command and you can execute other commands.
However, the command's process is still managed by the shell and
stdout and stderr are still attached to the shell session. This means
that when the shell session ends (you close your terminal window, exit
ssh, etc) the command’s process is sent a HUP signal, which usually
terminates the command.
Refrence:
Running bash commands in the background properly

MongoDB shell is not maintaining command history

In my MongoDB shell the command history is lost the moment I come out of it. How to configure it to remember the commands?
I don't know what's the theory behind it, but from my experience:
if you quit the command line with Ctrl+C or exit command, history is kept;
if you quit by closing the command line window (red cross on Windows 7), or with quit() command, history is not kept, but the previous history of properly closed windows is not erased.
That's not really "configuration" but it works for me (Windows - mongo 2.6.1).
History file should be in ~/.dbshell