A guide to command line
2 min readDec 28, 2021
Whether you are just starting off on your journey as a coder or are an experienced professional, this guide will help you understand the basic important commands in CMD to start with and always aid as a cheat-sheet anytime you want to revise! :)
So, what is command line?
In simple words, it’s a way to communicate with your computer, but instead of the mouse or touchscreen (in some), we use ‘commands’.
Today let’s cover a few important commands here, like:
cal, cd, cp, date, df, file, free, help, less, ls, mkdir, mv, pwd, rm, unzip, wget,
Lets get right into it.
$ cal
displays the calendar of the current month.$ cd
helps you change directory.$ cp
*$ cp <itemOne> <itemTwo>
copies file/directory ‘itemOne’ to file/directory ‘itemTwo’.
*$ cp fileOne fileTwo directoryOne
copies ‘fileOne’ and ‘fileTwo’ into ‘directoryOne’.$ cp directoryOne/* directoryTwo
copies all files from ‘directoryOne’ into ‘directoryTwo’.$ cp -r directoryOne directoryTwo
copies the content of ‘directoryOne’ into ‘directoryTwo’.$ date
displays the current date and time.$ df
helps you check the current amount of free disk space on our drive.$ file <fileName>
helps you check the file type.$ free
helps you check the amount of free memory.$ help
use this command when you’re not sure of which command you want to use or when you want to review the information about shell built-in commands.$ less <fileOne>
displayes content of ‘fileOne’.$ ls
list files.$ mkdir
*$ mkdir <directoryName>
create directory by the name ‘directoryName’.
*$ mkdir <directoryOne> <directoryTwo> <directoryThree>
create multiple files.$ mv
*$ mv <itemOne> <itemTwo>
helps move and rename a file.
*$ mv fileOne fileTwo
Move ‘fileOne’ to ‘fileTwo’.
Note: If ‘fileOne’ exists, it is overwritten with the content of fileOne, if not, fileTwo is created.
*$ mv fileOne fileTwo directoryOne
Move ‘fileOne’ and ‘fileTwo’ into ‘directoryOne’.
Note: ‘directoryOne’ must already be an existing directory.
*$ mv directoryOne directoryTwo
Move ‘directoryOne’ and it’s content into ‘directoryTwo’.
Note: If ‘directoryTwo’ does not exist, it is created, the content is moved to ‘directoryTwo’, and ‘directoryOne’ is deleted.$ pwd
‘print working directory’ / displays your working directory.$ rm
*$ rm <itemOne>
removes/deletes itemOne.
IMPORTANT: Once you delete something withrm
, it’s gone!
*$ rm -r directoryOne
deletes ‘directoryOne’ and it’s content(s).
*$ rm -r fileOne directoryOne
deletes ‘fileOne’ and ‘directoryOne’ and it’s content(s).$ unzip
command to unzip a file.$ wget <location>
command-line program for file downloading.
Thank you for reading.
Happy coding!