Interact with terminal Cheatsheet

You will interact with operation system (OS) by using Python.

Python will be our main programming language as an AI researcher/developer. Advantages of using Python are code readability and simplicity. It is a beginner friendly language. You can learn more about how to use python to interact with OS in terminal window here.

Note

It is highly recommended that you use python together with Anaconda

Check current path

pwd

List all files and directories in current working directory

ls 

Note

To list out all the files located at specific directory such as /user/myname/myproject, use

ls /user/myname/myproject

Change directory

Change to home directory

cd ~

Move to one level up of directory

cd ..

Move to previous directory

cd -

Create a new directory in the present working directory

mkdir [directoryname]

Celete a directory

rmdir

Rename file

Description: renames ‘myfile’ to ‘newfile’

mv myfile newfile

For more Python tutorial, you can check at w3schools