# How to copy from a Jupyter notebook cell?

**URL:** https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594
**Category:** Jupyter-Notebook
**Created:** [February 13, 2023, 11:21pm UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594 "2023-02-13T23:21:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [February 13, 2023, 11:21pm UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/1 "2023-02-13T23:21:18Z")

</div>

I want to copy text from a Jupyter notebook cell to some other application, for example a text editor. I can copy the output of a cell, but not the content of a cell. Is there a way to do it (without downloading the notebook as a Julia file)?

I’m using Firefox and Jupyter 6.3.0 on Ubuntu.

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [February 13, 2023, 11:35pm UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/2 "2023-02-13T23:35:59Z")

</div>

Can you, within your cell, press Ctrl+A together and then Ctrl+C to copy? I am a bit unclear what you are trying to do. Could you explain further?

Thanks!

---

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [February 13, 2023, 11:51pm UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/3 "2023-02-13T23:51:49Z")

</div>

That’s exactly what I tried!

Now I’ve figured out that the problem is the difference between “primary selection” and “clipboard” under X11. Jupyter copies to the clipboard, but pressing the middle mouse button inserts the primary selection in the text editor. You can get the clipboard with some key combination.

Anyway, thanks!

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [February 13, 2023, 11:56pm UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/4 "2023-02-13T23:56:38Z")

</div>

Ah gotcha – what text editor are you using? If you are using (neo)vim, have you seen the fantastic [jupytext extension](https://github.com/goerz/jupytext.vim)? It allows you to use notebooks within the vim text editor. Highly recommend as I use it all the time. Also, plays nice with linux!

---

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [February 14, 2023, 12:20am UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/5 "2023-02-14T00:20:21Z")

</div>

I’m using terminal-based editors like jed or nano. The mouse buttons are handled by the terminal emulator (urxvt).

jupytext.vim is very interesting, but it seems to be for editing the notebook only, not for interactive use.

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [February 14, 2023, 12:25am UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/6 "2023-02-14T00:25:41Z")

</div>

Oh yea – it’s for interactive use as well. Maybe it’s not clear from the documentation, but what you can do is open the Jupyter notebook within a browser (with your kernel) and also open the notebook within your editor. Then, when you change the notebook in your editor, if you save, it should automatically update the notebook contents within the browser as well so you can run scripts in an attached kernel.

Cool. I use Neovim with konsole or alacritty.

---

<div class="post-metadata">

### Author: ![Arpad\_Kosa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arpad_kosa/32/208333_2.png) [@Arpad\_Kosa](https://discourse.julialang.org/u/Arpad_Kosa)
#### Post date: [April 8, 2024, 7:39am UTC](https://discourse.julialang.org/t/how-to-copy-from-a-jupyter-notebook-cell/94594/7 "2024-04-08T07:39:29Z")

</div>

You can export your notebook from the File menu selecting “Save and export notebook as” then select “asciidoc” and there you have all your input and output as txt file.  
Usually the downloaded file can be found in your “Downloads” directory.
