files.rst 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. .. _working-with-files:
  2. Working with Files
  3. ==================
  4. Opening Files
  5. -------------
  6. The file browser and File menu enable you to work with files and
  7. directories on your system. This includes opening, creating, deleting,
  8. renaming, downloading, copying, and sharing files and directories.
  9. The file browser is in the left sidebar Files tab:
  10. .. image:: images/file_menu_left.png
  11. :align: center
  12. :class: jp-screenshot
  13. :alt: Arrow pointing to the file browser in the upper left sidebar.
  14. Many actions on files can also be carried out in the File menu:
  15. .. image:: images/file_menu_top.png
  16. :align: center
  17. :class: jp-screenshot
  18. :alt: A screenshot showing the File menu open including options like "New", "Save All."
  19. .. _open-file:
  20. To open any file, double-click on its name in the file browser:
  21. .. raw:: html
  22. <div class="jp-youtube-video">
  23. <iframe src="https://www.youtube-nocookie.com/embed/Rh-vwjTwBTI?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  24. </div>
  25. .. _newtab:
  26. You can also drag a file into the main work area to create a new tab:
  27. .. raw:: html
  28. <div class="jp-youtube-video">
  29. <iframe src="https://www.youtube-nocookie.com/embed/uwMmHeDmRxk?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  30. </div>
  31. .. _multiple-viewers:
  32. Many files types have :ref:`multiple viewers/editors <file-and-output-formats>`.
  33. For example, you can open a Markdown file in a :ref:`text editor <file-editor>` or as rendered HTML.
  34. A JupyterLab extension can also add new viewers/editors for files.
  35. To open a file in a non-default viewer/editor, right-click on its name in the
  36. file browser and use the "Open With..." submenu to select the viewer/editor:
  37. .. raw:: html
  38. <div class="jp-youtube-video">
  39. <iframe src="https://www.youtube-nocookie.com/embed/1kEgUqAeYo0?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  40. </div>
  41. .. _single-doc-sync:
  42. A single file can be open simultaneously in multiple viewer/editors and
  43. they will remain in sync:
  44. .. raw:: html
  45. <div class="jp-youtube-video">
  46. <iframe src="https://www.youtube-nocookie.com/embed/87ALbxm1Y3I?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  47. </div>
  48. .. _file-navigation:
  49. The file system can be navigated by double-clicking on folders in the
  50. listing or clicking on the folders at the top of the directory listing:
  51. .. raw:: html
  52. <div class="jp-youtube-video">
  53. <iframe src="https://www.youtube-nocookie.com/embed/2OHwJzjG-l4?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  54. </div>
  55. .. _file-share:
  56. Right-click on a file or directory and select "Copy Shareable Link" to
  57. copy a URL that can be used to open JupyterLab with that file or
  58. directory open.
  59. .. image:: images/shareable_link.png
  60. :align: center
  61. :class: jp-screenshot
  62. :alt: A screenshot showing the Copy Shareable Link option in the context menu opened over a file, which is the last entry on the list.
  63. .. _file-copy-path:
  64. Right-click on a file or directory and select "Copy Path" to copy the
  65. filesystem relative path. This can be used for passing arguments to open
  66. files in functions called in various kernels.
  67. Creating Files and Activities
  68. -----------------------------
  69. .. _file-create-plus:
  70. Create new files or activities by clicking the ``+`` button at the top
  71. of the file browser. This will open a new Launcher tab in the main work area,
  72. which enables you to pick an activity and kernel:
  73. .. raw:: html
  74. <div class="jp-youtube-video">
  75. <iframe src="https://www.youtube-nocookie.com/embed/QL0IxDAOEc0?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  76. </div>
  77. .. _file-create-menu:
  78. You can also create new documents or activities using the File menu:
  79. .. image:: images/file_create_text_file.png
  80. :align: center
  81. :class: jp-screenshot
  82. :alt: A screenshot showing the context menu entry for creating a new file.
  83. .. _current-directory:
  84. The current working directory of a new activity or document will be the
  85. directory listed in the file browser (except for a terminal, which
  86. always starts in the root directory of the file browser):
  87. .. raw:: html
  88. <div class="jp-youtube-video">
  89. <iframe src="https://www.youtube-nocookie.com/embed/OfISSOTiGTY?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  90. </div>
  91. .. _file-rename:
  92. A new file is created with a default name. Rename a file by
  93. right-clicking on its name in the file browser and selecting “Rename”
  94. from the context menu:
  95. .. raw:: html
  96. <div class="jp-youtube-video">
  97. <iframe src="https://www.youtube-nocookie.com/embed/y3xzXelypjs?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  98. </div>
  99. Uploading and Downloading
  100. -------------------------
  101. .. _file-upload:
  102. Files can be uploaded to the current directory of the file browser by
  103. dragging and dropping files onto the file browser, or by clicking the
  104. "Upload Files" button at the top of the file browser:
  105. .. raw:: html
  106. <div class="jp-youtube-video">
  107. <iframe src="https://www.youtube-nocookie.com/embed/1bd2QHqQSH4?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  108. </div>
  109. .. _file-download:
  110. Any file in JupyterLab can be downloaded by right-clicking its name in
  111. the file browser and selecting “Download” from the context menu:
  112. .. raw:: html
  113. <div class="jp-youtube-video">
  114. <iframe src="https://www.youtube-nocookie.com/embed/Wl7Ozl6rMcc?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  115. </div>
  116. Displaying Hidden files
  117. -----------------------
  118. Hidden files and folders can be displayed in JupyterLab by combining two parameters:
  119. 1. First the server should be allowed to serve hidden files by setting ``ContentsManager.allow_hidden = True``; see `server documentation <https://jupyter-server.readthedocs.io/en/latest/users/configuration.html>`_.
  120. 2. Then you will be able to display or hide the hidden files through the menu ``View`` -> ``Show Hidden Files``.