Post

Google Colab Commands

Google Colab Commands

Google Colab Commands

Medium article image


Click this Link if Stopped by Medium Paywall :https://medium.com/@harshityadav95/google-colab-commands-60f779842d3c?source=friends_link&sk=e66e440f3ced23d2c66f4ba4281204d3

Running a Cell

SHIFT + ENTER

Executing Bash Commands

Simply add an!before, for example:

1
!ls '/content/gdrive/My Drive/Colab Notebooks/'

Let’s check the information of OS, processors and RAM they are using:

1
!cat /proc/version!cat /proc/cpuinfo!cat /proc/meminfo

Uploading Files

You can simply upload files manually to your Google Drive, and access them using codes above. Alternatively, you can use the following code:

1
from google.colab import filesuploaded = files.upload()

Libraries

Installing Libraries

Usepipin bash command:

1
!pip install <PACKAGE_NAME>

Bash Commands

Bash commands can be run by prefixing the command with ‘!’.

  • Cloning a git repository
1
!git clone [git clone url]
  • Directory commands!ls, !mkdir.
1
!ls

Installing Libraries

Although most of the commonly used Python libraries are pre-installed, new libraries can be installed using the below packages:

1
!pip install [package name]

OR

1
!apt-get install [package name]

Referneces for MPI on python

Reference

This post is licensed under CC BY 4.0 by the author.