If you want to get into Software Development, one thing you should know is how to use Terminal?
Yes, it could be Mac's Terminal, Linux's Terminal, or Windows terminal(not exactly, but run Git Shell or Cmder on Windows).
Don't worry I have your back here, just follow this article, and trust me, you'll thank me later for reading this post.
First of all, lets understand what is terminal?
What is Terminal?
Terminal is a program on your Operating system which lets you navigate throughout your computer’s folders and files, most importantly runs commands to help you perform your task.
First and foremost, we need to open Terminal, it could be different depending on your OS, and here I trust you, you can open Terminal.
Okay, need help, please follow the below steps depending on you OS:
If you are on a Mac, hit "command + space bar" and you’ll get the computer’s "Search" bar. Once that pops up, type in "Terminal" and hit "Enter".
If you are on Linux, hit "The Windows logo key" (also known as Windows-, win-, start-, logo-, flag-, or super- key) and type "Terminal" and open the program by clicking on it.
If you are on Windows, search "Git Shell" or "Cmder" depending on what you have installed.
Cmder Terminal on Windows
Must know Terminal Commands
And stay away from
rm, but here I'll teach you how to master that command and use only when really needed.
pwd command, stands for "Print Working Directory" You type in that command on terminal, and it will print out the exact file path for the file or folder you are in.
cd command, stands for "Change Directory". There are multiple ways you could use
cd commands. Here are those:
cd ~: Will take us to the Home directory.
cd ..: Will move us back to the parent folder.
cd ../test: Will move us back and take us to
cd <folder name>: Will take us to the
ls command is the list command, it shows what's present in a folder/directory. Again,
ls could be used in many ways. Here are few which you might want to use:
ls: it will show us everything in that folder.
ls -a: it will show the hidden files along with the other listed previously.
ls -l: it will display in a long listing format
mkdir command, stands for "Make Directory". It will create the new folder/directory in that place from where it is run. So always check whether you are at right place using
touch command is for creating file, there are multiple ways you can create a file. But
touch is an easiest. Here's how
clear command does what the name say, it "clears" your terminal. It's always a good practice to work in a neat and clean environment.
Once run, the terminal would look like
Or you can use Keyboard shortcut for this,
Ctrl + L it is faster on most of the terminals.
man command, is an interface to the system reference manuals, this is something which you should use to understand how a command works and what parameters to be used to get the best out of that command. And to be a master of terminal, always refer to this command.
Now, as said, STAY AWAY FROM
So, here are a few ways you can use
rm in necessary situations.
rm <filename>: Remove(Delete) the file.
rm -i <filename>: It will ask before deleting a file. Remember to use
-i, so it gives you some time to double-check before deleting.
rm -iwill ask before deleting each file.
rm -r <foldername>: It will recursively delete a directory and all its contents. (normally rm will not delete directories, while
rmdirwill only delete empty directories)
rm -f: this will forcibly delete files without asking; this is mostly useful if you have rm aliased to
rm -ibut want to delete lots of files without confirming each one.
rm -rf <foldername>. Always avoid this command, and never run as
With these terminal commands, you are good to go and get ready to explore the learning paths.
Here's a diagram, which shows what are the paths one could take in
And at last, keep learning, keep sharing.
Top comments (3)
Unless you know what you want to do
Ctrl+l is faster on most terminals
Ctrl+l is faster, let me update the article.
Thanks for the input :-)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.