How do I exit the nl command in CentOS? - command-line

I'm really a noob in the CLI, so please help me. I accidentally entered nl in CentOS and now I'm stuck in this list. How do I exit nl?
Thanks for your help!

Ctrl-C can usually be used to kill terminal commands in linux.
EDIT:
Ctrl-D should be used to terminate nl correctly. Ctrl-C is just a general way to kill applications.

Related

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.

Breaking of running lex program

When I run any lex program it keeps on running. I need help regarding how to stop its execution.
How to break a running lex program? is there any shortcut key for stop running program?
Try pressing Ctrl + C key... :)

Start a remote Matlab process within Emacs matlab-mode?

I use Matlab remotely via ssh, and would like to execute regions of code from an m-file in Emacs without having to cut and paste. How do I configure Emacs to do this?
I tried to follow the solution offered here: I wrote a script that connects to the server and opens Matlab. The script works when I run it in a terminal. I edited matlab.el as explained on that page. Now, if I'm editing my m-file in Emacs and try to start Matlab, I get a message that it can't execute my remoteMatlab.sh file, and that M-shell exited abnormally with code 1.
Thanks in advance for any help.
You can achieve this running a shell from within emacs, starting up your ssh and matlab session in it, and renaming the shell buffer from *term* or whatever to *MATLAB*. You can then use matlab-mode on a script file and run the code.
This is not exactly what you asked for but may achieve the same thing. You can use function dbstop, which allows you to set debug break points through code.
http://www.mathworks.com/help/techdoc/ref/dbstop.html#inputarg_location

perl debugger freezes

First time perl user and I am trying to debug some script to follow project logic and of course syntax.
Using cygwin after entering at command line $
$ perl -d sample.pl
Loading DB routines from perl5db.pl version 1.3
Editor support available.
Enter h or `h h' for help, or `perldoc perldebug' for more help.
main::(sample.pl:5): print 'Hello world.'; # Print a message
DB<1>
It hangs at the DB<1> line. I cannot enter anything at the prompt.
Is there a reason why this post is inappropriate? or how is this not clear?
This is the actual program code:
#!/usr/local/bin/perl
#
# Program to do the obvious
#
print 'Hello world.'; # Print a message
I upgraded my cygwin installation at home and ran into a similar problem (though maybe not the exact same problem -- the perl debugger still responds to my input but does not display my input, and fubars my input even after I quit the debugger). In the meantime while I figure what is going on, my workaround is to fire up xemacs, launch a shell (M-x shell), and run the perl debugger from the emacs buffer.
If this works for you, then there is something funky going on with your cygwin terminal settings. If your debugger hangs even in an emacs buffer, then something else funky is going on but I have no idea what it could be.
Sorry for reviving this three-year-old question, but I believe to have been hit with the same problem, and to have found the solution.
In my case, perl -de0 invokes infocmp from ncurses, which hangs in a weird way (can't kill it). And infocmp seemed to be a victim of my Avast anti-virus which is listed under BLODA as affecting Cygwin. Disabling it resolved the issue -- see if you have any of the listed applications and try disabling it (perhaps also try safe mode).
Also, simply renaming infocmp.exe allowed perl -d to run normally. In the end I used this approach and left my Avast running.
It could also be a different executable that perl -d is starting -- try to run whatever hangs with strace, see what is the last executable mentioned and try to see if that is the culprit.

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

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.