What’s a Terminal?#

The Terminal may sound complicated, but it is a fundamental part of every computer and a key element used in development for handling most tasks in your coding environment.

You can think of the terminal as a direct line of communication between you and the computer. For instance, when you install an extension in one of your apps or create a new file using an app, you are actually using the terminal indirectly. Learning how to use the Terminal allows you to give the computer the exact commands you want and to know precisely where and how new files are being created. This knowledge comes in handy when developing software or working with large databases.

Commands#

Commands executed on the terminal comprises of the application name <command>, followed by arguments to the command <command> <arguments>. For instance, a command creating a new directory would be expected to have a single mandatory argument which equals the name of the new folder. Other commands may have several mandatory arguments.

pwd (Print Working Directory)#

The pwd command displays the current working directory. It is particularly helpful when you need to know your current location within the file system.

pwd
cd
pwd
pwd

cd (Change Directory)#

The cd command is used to change the current working directory. It enables you to navigate through various folders and explore different parts of the file system.

cd NewFolder
cd NewFolder
cd NewFolder
cd NewFolder

ls (List)#

The ls command is used to list all files and directories in the current working directory. It allows you to view the contents of the folder you are currently in.

ls
dir
ls
ls

mkdir (Create Directory)#

The mkdir command is used to create a new directory. It is particularly helpful when you need to create a new folder for your project.

mkdir NewFolder
mkdir NewFolder
mkdir NewFolder
mkdir NewFolder

rm (Remove)#

The rm or del command is used to delete files and rm -r or rmdir /s to delete directories permanently. It is a powerful command that can help you remove unnecessary files from the file system.

rm NewFile.txt
rm -r NewFolder
del NewFile.txt
rmdir /s NewFolder
rm NewFile.txt
rm -r NewFolder
rm NewFile.txt
rm -r NewFolder

pip (Package Installer for Python)#

The pip command is a package installer for Python that simplifies the process of managing and installing various Python

pip install <package_name>
pip install <package_name>
pip3 install <package_name>
pip3 install <package_name>

How to make using the terminal easier#

There are a few different tips/tricks to make using the terminal a lot smoother:

  • Recycling old inputs with arrow-keys
    • If you have already input a command and need to use it again, pressing the upwards arrow key will go through your old inputs

    • This is especially useful for correcting typos in wrong input

  • Using Tab key to autocomplete input
    • The Tab key is the one with two sideways arrows (usually placed above caps lock)

    • This is very efficient in combination commands which expects files/folders as arguments.

    • For example one can navigate to the folder MyFolderForCourse01006 by simply typing cd My, and then pressing Tab and Enter Pressing Tab multiple times will cycle through all files/folders that starts with My.

  • Pasting code into the terminal
    • The terminal is just like any other document, in the sense that you can copy and paste anything