I usually start the IPython Notebook engine and put it in the background. But whenever users open/close notebooks or timeouts happen, I see the background spitting out messages on the terminal from where I started it - which is kind of annoying.
Is there a way to suppress those and make the engine stay silently in the background? I suspect this might be a simple switch at startup.
I forgot the simple piping of the output to /dev/null, which does the trick:
alias start_ipy='cd /path_notebook_folder; ipython notebook --profile=nbserver --no-browser --pylab inline --port=443 2>/dev/null >/dev/null &'
Related
I initially had a notebook in one directory in AWS SageMaker JupyterLab, say /A, but then moved it into /A/B. However, when I run !pwd in a jupyter notebook cell, I still get /A. This happens even when I press 'restart kernel'. How does the notebook remember this, and is there a way to prevent or reset this?
Thanks
I was actually using AWS SageMaker, and restarting the kernel from the toolbar was not enough. I needed to restart the kernel session, by pressing 'shut down' in the "Running terminals and kernels" section on the left navigation.
They are currently discussing warning users about the need to restart the kernel when a notebook is moved.
I'm running ubuntu 1804 on windows using the WSL. Everything is set up fine and works correctly. I've also installed ZSH and oh-my-zsh, again this is all good and everything looks like its working fine. Everything except the arrow keys whilst using vim or man pages or some other command line tools.
The up and down keys work on the command line when scrolling through history and also for select commands like nano. Also if I boot into bash rather than zsh the arrow keys do work in vim and man pages, in fact they work everywhere.
If i boot into bash, then switch to zsh on the command line manually the arrow keys then work everywhere.
So my cmder config for zsh
c:/_distros/ubuntu1804/ubuntu1804.exe -c zsh -cur_console:pm
and for bash
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt
The one for bash uses the conemu-cyg-64.exe program that comes from conemu which is a symbiont of POSIX enabled pty and WinAPI full-featured terminal.
Apparently you can use this tool with zsh but i cant manage to make it work i get the error
{PID:10592} failed to run shell (2): No such file or directory
{PID:10592} shell: `/usr/bin/zsh` `-l` `-i`
{PID:10592} dir: `/cygdrive/c/Program Files/cmder`
ConEmuC: Root process was alive less than 10 sec, ExitCode=0.
Press Enter or Esc to close console...
and this is the task in cmder
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe /usr/bin/zsh -l -i -cur_console:pm:/mnt
So I think that if i can boot into zsh using conemu-cyg-64 that the cursor keys will probably work in commands like vim and the man pages. Any help or advice getting that working would be brilliant.
EDIT:
On my ubuntu install zsh is installed at /usr/bin/zsh, but there is no file or folder /cygdrive/c/Program Files/cmder
Many thanks to #Maximus for pointing me in the right direction. The answer was right under my nose at the bash on windows page of conemu. A small change to the command i was using before. the zsh needs to go on the end rather than before the --wsl.
The correct task to ensure that cursor keys work on all apps in the terminal is:
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pnm:/mnt -t zsh -l
Running Julia in a terminal (macOS) and then launching a Jupyter notebook
julia> using IJulia
julia> notebook(detached=true)
This works fine. However when I log out of the notebook and closing the browser, there is still a jupyter-notebook running and I have to kill -2 pid to make it go away.
Is this expected behaviour? Is there a parameter I need to set somewhere?
Yes, this is the expected behaviour for the way you've called notebook. The server doesn't stop when your browser page is closed (you might open another, for example!). Using the detached keyword argument means the server process is started in the background, so doesn't block the Julia session you started it from, so you'd have to do extra work if you wanted to stop it from there. From the IJulia readme:
You can use notebook(detached=true) to launch a notebook server in the background that will persist even when you quit Julia
Let's say you run a command like grunt serve on a tmux pane,
and you kill the pane on which the command is running. I found that
the process is not killed:
ps aux | grep grunt
still shows that grunt is running even though the pane is gone.
How do you kill a tmux pane along with the process(es)?
To stop the program running you can close the pane by entering <C-B> x and then entering y.
Just do: <CTRL-B>:kill-pane
Use Ctrl + b¹, > to get a menu with this and other useful commands:
This is what uses the Spotify plugin.
¹ Or the chosen tmux escape sequence.
Other notes and sources
tmux list-keys | grep display-menu #
curl cht.sh/tmux # Online cheatsheet
https://wiki.archlinux.org/title/tmux
You may find the tmux-safekill plugin useful.
I wanted it to kill Ruby processes, so I had to fork the repo to add that functionality in, so I'm sure you could do the same for grunt processes if you don't get all the functionality you need from the repo directly.
I yesterday upgraded by MacPorts' apps which took apparently about 4 hours.
It was irritating to see the installation process going on in one tab in terminal.
Problem: to hide a running process in terminalsuch that it does not take space in my working area
I found today that there a new command coproc in Bash 4:
coprocess is executed asynchronously
in a subshell, as if the command
established between the executing shell and the coprocess
I am not sure whether you can use it to solve the problem or not. I did not manage to use it.
How can you hide the running process such that it is not visible in terminal but it continues to run?
Did you consider Ctrl + Z to put the process in pause, then bg to run this one in background?
To detach your process from the terminal, you can then type disown. You can now close the terminal, and even your session.
The problem here is that the outputs will appear anyway in the bash.
You can also start your program in screen. This command provide an easy way to start a program, close the console and retrieve it later.
I suspect you are looking for nohup
nohup LongRunningNoisyProgram &
will run the program, log the output to a file so you don't see it, push the program into the background, and won't cancel the program if you exit your terminal later while it is still running.
There is at least one thing the other repliers have not covered: how to manage hiding processes.
Suppose you have 100 background processes created with "nohup find / &". You want to quit them to really see how the background processes work. Please, use the command:
ps -ej | awk '! /grep/ && /find/ {print $2}' | xargs kill -9
Then, you may want to know how to control the keys to hide processes. You can change it to p, where susp stands for CTRL+z (^Z):
stty susp p
You can see the keys here:
stty -a
Please, compare the stdouts before and after the change. The command is particularly useful because it helps to remember other commands, such as ^W (to remove a word).
Jerome had an excellent tip about screen. I highly recommend to pursue the direction:
http://www.commandlinefu.com/commands/matching/screen/c2NyZWVu/sort-by-votes