Google Colab Commands

Harshit Yadav
1 min readNov 1, 2019

--

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:

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

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

!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:

from google.colab import files
uploaded = files.upload()

Libraries

Installing Libraries

Use pip in bash command:

!pip install <PACKAGE_NAME>

Bash Commands

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

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

Installing Libraries

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

!pip install [package name]

OR

!apt-get install [package name]

Referneces for MPI on python

--

--

Harshit Yadav
Harshit Yadav

Written by Harshit Yadav

Software Developer | Azure Solution Architect Expert | Technical Writer | harshityadav.in