As a developer command line is a crucial skill to have. So, in this article, I’ll share the top 10 command line command every developer should know.
Let’s get started.
*If you prefer video then check it out: *
#1. mkdir
Make directory. With this command, you can create a folder easily
mkdir folder-name
#2. cd
After creating a directory/folder we need to go to that directory. We can do so with cd
cd folder-name
#3. cd ../
The next one is cd ../ this command used to go one step back. For example, if you are inside “folderA” and it’s on the desktop. You can use this command to go back to desktop.
cd ../
#4. rmdir
So, you created a directory/folder now you want to delete it. You can do so with this command
rmdir folder-name
#5. touch
We need to create files a lot. we can do that easily with this command.
this command will create a .html file. when creating a file don’t forget to add the extension.
touch index.html
#6. ls
If you want to see how many folders and files a directory have. You can use this command to see. All you need to do is go to that directory and run this:
ls
#7. mv
With this command, you can move a file to another directory. You need to provide the file name and the directory you want to move the file. like this:
mv file.txt moveTo
#8. rm
With is the command you can delete a file and a folder. When you want to delete a folder with this command just add an -r flag at the end.
like this:
// remove file
rm file.text
//remove directory
rm folder-name -r
#9. date
This command is a fun one. It just prints out today's date, just for fun.
date
#10. pwd
This command print out the current directory you are in.
pwd
Conclusion
Working with the command line makes a programmer's life a lot easier. If you don’t use the command line, I highly recommend starting using it.
If you enjoyed reading this article, I think you’ll also enjoy my newsletter where I share my articles and videos, and resources I found online.
Subscribe Now!
connect with me on Twitter at coderamrin
Oldest comments (9)
Thanks for the article , does this work for windows?🤔
few work in the Windows. Using powershell or Git bash.
Few don't work on windows such as "touch" and "ls" commands.
with git bash I use them all the time on windows machine
dude these are based on linux
I use windows,
with git bash
If you use WSL2 (Windows Subsystem for Linux), you can find Windows files and directories at
/mnt/c
* (e.g./mnt/c/Users/<Your Username>/Documents
), then traverse and manipulate them as if they were Linux files. You can even set it as your default terminal, then you get easy access to it though Windows Explorer > right click > Open in Terminal.Git Bash will work for the commands in this article but doesn't give you the full power of Linux. WSL2 is much more powerful.
* Replace with
d
,e
, etc depending which drive you have Windows installed in.I have a request please edit your post and add linux and git bash in it it would be good if there are tags
Can I use these commands without terminal application? best tantrik in Borivali