Skip to content

Latest commit

 

History

History
112 lines (68 loc) · 6.66 KB

files.md

File metadata and controls

112 lines (68 loc) · 6.66 KB
copyright
years
2020, 2026
lastupdated 2026-11-11
keywords upload file in cloud shell, download file in cloud shell, add file, add project to cloud shell, file storage, persistence, import file, export file
subcollection cloud-shell

{{site.data.keyword.attribute-definition-list}}

Working with files

{: #files}

Your {{site.data.keyword.cloud-shell_full}} workspace includes a home directory where you can temporarily work with files in your {{site.data.keyword.cloud-shell_short}} sessions. You can upload or download files one at a time to your workspace through the UI, or use command-line tools to work with many files at once. {: shortdesc}

Before you begin

{: #files-before-begin}

Enable File upload and download in the {{site.data.keyword.cloud_notm}} console. For more information about how to enable file upload and download, see Enabling or disabling Cloud Shell features for an account.

Temporary workspace storage

{: #file-persistence}

Your {{site.data.keyword.cloud-shell_short}} workspace includes 500 MB of temporary secure storage, which you can access through your personal home directory, /home/<user-name>. Only you can access your workspace storage, and your storage is separate for each account that you access or region where you work in {{site.data.keyword.cloud-shell_notm}}.

Your workspace storage is shared across all of your sessions, so you can work with the same files in different session tabs. The storage persists only while your workspace is active. If you're idle in {{site.data.keyword.cloud-shell_short}} for over an hour, your files and data are removed. Similarly, if you reach the usage quota or you restart {{site.data.keyword.cloud-shell_short}}, {{site.data.keyword.cloud-shell_short}} closes and removes your data. If you change files that you want to keep, be sure to download the files at the end of your session.

A known issue exists where your connection to {{site.data.keyword.cloud-shell_short}} is lost if your reach the temporary storage limit. If this issue happens, the only way to fix the connection is to restart {{site.data.keyword.cloud-shell_short}}, which removes all of your files. While you work in {{site.data.keyword.cloud-shell_notm}}, avoid uploading huge files and remove any unused files by using standard Linux™ commands, such as rm. {: important}

Backing up your data

{: #backup-data}

Your workspace storage is temporary, and it is not intended to be used as the primary storage location for your files. Don't store business-critical or sensitive data in your workspace, and create a backup of your files outside of {{site.data.keyword.cloud-shell_notm}}. You're responsible for your data, and your backup can help you recover in case an outage or data loss occurs for any reason. For more information about how to transfer files to create a backup, see Transferring multiple files.

Uploading files

{: #upload-file} {: support}

You can upload a file to the root level of your home directory. Only a single file can be uploaded at a time.

  1. In the {{site.data.keyword.cloud-shell_notm}} menu bar, click the Upload icon Upload icon.
  2. Select the file that you want to upload, and click Open.

Your file is uploaded in your home directory, for example /home/<user-name>/myFile.txt. You can move or otherwise work with your files by running standard Linux™ commands. For example, you can move a myFile.txt file that you uploaded to a myFolder subdirectory by running the following command.

mv myFile.txt ./myFolder/

{: pre}

Although you can move files, be sure to keep all files in your workspace under your home directory, /home/<user-name>. If you move files outside of this directory, it can cause {{site.data.keyword.cloud-shell_short}} to close, which removes your data. {: tip}

Downloading files

{: #download-files} {: support}

You can download a file from your workspace to your local system. Only a single file can be downloaded at a time.

  1. Find the path to the file from the command line by using standard Linux commands.

    For example, you can list all files and subdirectories within your current directory.

    ls -R

    {: pre}

    Or, you can search for a file name. The following command searches for files with myFile in the name.

    find -iname *myFile*

    {: pre}

  2. In the {{site.data.keyword.cloud-shell_notm}} menu bar, click the Download icon Download icon.

  3. Enter the path to the file in your home directory, such as /myFolder/myFile.txt. Click Continue.

    Don't include the home directory root /home/<user-name> in the file path. File paths are case-sensitive. {: tip}

  4. Follow your browser prompt to open or save the file to your computer.

Transferring multiple files

{: #transfer-many-files}

Using the {{site.data.keyword.cloud-shell_short}} UI, you can upload or download only a single file at a time. If you need to transfer many files, it might take a long time to move all of them individually. Instead, use these strategies to efficiently move files between your workspace and another file system.

Create archives to move files

{: #files-archive}

Before you move files, combine the files into an archive file such as a .tar, .tar.gz, or .zip so that you can move them all at once.

For example, to upload a folder of {{site.data.keyword.cloud_notm}} administration scripts, you might compress them into a myScripts.zip file and upload them to {{site.data.keyword.cloud-shell_short}}. In your {{site.data.keyword.cloud-shell_short}} session, you can then run unzip myScripts.zip to extract the files.

You can do the same thing in reverse when you want to download files. For example, say you want to back up your entire {{site.data.keyword.cloud-shell_short}} workspace. From your home directory, run tar -cvf myTar.tar * to create a .tar file (Mac or Linux) or run zip -r myZip.zip * to create a .zip file (Mac or Windows). Then, download the archive file from {{site.data.keyword.cloud-shell_short}} and extract it on your local system.

Work from a Git repo

{: #files-clone-git}

For projects in Git repositories, use the {{site.data.keyword.cloud-shell_short}} UI to upload an SSH key so that you can connect to your Git repo. Keep a local copy of your SSH key as a backup. Then, run git clone to clone all of the repo's files to your {{site.data.keyword.cloud-shell_short}} workspace. As a bonus, when you commit and push your changes to your Git repo, your changes are automatically backed up to a file system that's outside of {{site.data.keyword.cloud-shell_short}}.