Terminal is a command line interface that lets user to access files and accomplish tasks on computer without the use of a graphical user interface (GUI). It lets user accomplish tasks without even making a single click on the mouse that makes the working more efficient. In general, what we see in Windows and Mac OS are the GUIs in which from copying file or creating new one, the user needs to click on the icons or use keywords shortcuts to do the same, that at times becomes very tedious task; the command line interface becomes highly functional in those cases.
The application of terminal is not just limited to simple task, there are varieties of software and services that are principally accessed by terminal like finite element solver FEniCS, version control Git, cloud computing Google Cloud etc. Cloud computing can be accessed solely by terminal, that makes very crucial to have the knowledge of terminal.
In most of the operating systems (OS) the terminal or command line interface comes preinstalled
- in Windows – it is Command Prompt or cmder
- in Mac – it is Terminal
- in Linux – it is konsole, eterm, gnome-terminal etc.
Let’s see commands for some of the basic tasks that we perform –
1. Details about the Current Working Directory – This commands tells in which directory you are working or in other words in which directory the terminal is right now .
2. Navigating through directories – These commands will help in going from one directory to another in the same or different drive.
- Changing directories within current Drive – Suppose you are in
D:drive and wish to navigate from one directory or folder to another.
This will bring the terminal from anywhere in
D: drive to the
D:\Desktop\image directory, whose path has been specified.
cd [Path to the directory]
- Moving between parent directory and sub-directory – These commands lets you go to parent directory or subdirectory from current working directory.
cd [Subdirectory name]
- Changing the current Drive – Suppose you are in
D:and wish to go in
cd /d [Path to the directory]
This will bring the terminal anywhere in
D: to the directory in
C:, whose path has been specified.
- Changing directory to root directory – Suppose you are in in any directory and wish to directly to the root directory of that drive.
3. Listing contents of the directory – This command will show the list of all directories and files present in current directory.
-l is the argument that we are providing will list the information about the directories and files present.
4. Making a directory – This command will create a new directory in the current working directory.
mkdir [Directory name]
5. Renaming directory or file – These commands will let you rename any directory or file.
mv [Current Directory Name] [New Directory Name]
mv [Current File name] [New File Name]
6. Deleting directory or file – These commands will delete directory or file from the system.
rmdir [Directory name] or
rm -r [Directory name]
rmdir command will delete an empty directory only, if you wish to delete directory containing files and folders then, use
rm -r [Directory name]
rm [File name]
Note – These commands will delete the file and directory permanently from the system !!
You can also watch this video to learn more about the Terminal commands.