Photo by Gabriel Heinzer on Unsplash
3: The Terminal
Day 2: Talking to the computer in the old fashioned way!
Self-study | 2 hours, after work
Today, I am learning the below, before the next LIVE lecture:
Overview of Terminal
Warning*: Below are my study notes as I learn and hence I could be wrong here and there. Please correct me where required and my apologies in advance.*
TERMINAL
This is an interface on a computer that allows you to input text and perform various operations. These inputs are often called Command Lines.
In our day-to-day computer use, we are not used to Terminal because we use graphics to operate a computer. Graphics can be loosely described as the "visual treats" you see on your screen. With these, you can create folders & files, rename, move, and delete them, go to different applications, install and uninstall them, etc. Technically speaking, we interact with the company using a GUI.
GUI = Graphical User interface. Sometimes, people pronounce "GUI" as "Goo-ey".
At this stage, I was curious and wanted to learn a bit more about Terminal, Command Line, etc. So, a Google search led me to freeCodeCamp, and I learned the below:
CONSOLE: Tools to interact with the computer (mouse, keyboard, monitor)
TERMINAL: An environment (or a program) on a computer that allows us to input commands or instructions, and the computer returns a result or an output.
COMMAND LINE: The space where one enters the commands for the computer to perform specific tasks. Sounds like a Terminal, right? It seems they are the same and the terms can be used interchangeably.
So, now we know there are 2 interfaces for an operating system (OS):
CLI
GUI
Question: If GUI is easy to use and understand, why even bother with a CLI, especially for a programmer?
Because it's more efficient and quicker, you can automate tasks, and perform repetitive tasks, and in some cases, there's no other way to interact with a computer in a deep technical sort of way.
When you enter a Terminal, you will type your commands after the $ symbol.
Some useful commands I learned today:
COMMAND | MEANING | HOW IT'S USED |
~ | a Tilde, represents the home directory | |
clear | cleans out the Terminal, provides a clean slate | Just type, "clear" |
history | shows your previous work (after you've cleaned out a Terminal) | Just type, "history" |
pwd | Print Working Directory, tells you the full path name of the directory you are in | Just type, "pwd" |
cd | Change Directory, allows you to move into a different directory | cd academy |
mkdir | Make Directory, create a new directory | mkdir coder |
ls | List, this command lists the files and folders in the location you are in | Just type, "ls" |
touch | Create a new file | touch manoj.txt |
more | Shows the contents in a file | more manoj.txt |
mv | Move a file or Rename a file | mv manoj.txt emanoj.text |
. | a single dot represents the current directory | |
.. | double dots take you 2 levels above | |
cp | Copy or duplicate a file | cp emanoj.text emanoj-copy.text |
rm | Remove - delete a file | rm emanoj-copy.txt |
man | Manual - if you want detailed documentation on a specific command | man rm |
Phew! It's 9:30 p.m., and I am so tired and sleepy. Time to hit the sack and rejuvenate!