7 Basic Command Lines (CMD) Everyone Must Know

There are some things you can only do from the command line, even on Windows. Some of these tools don’t have graphical equivalents, while others are just plain faster to use than their graphical interfaces.

We can’t possibly cover all the useful commands you can use in the Command Prompt or PowerShell here. We’ll be focusing on commands that should be useful even if you’re not a command-line person.

1. Change Directory

Often you will have to navigate through directories. Terminal and Command Prompts both use the same cd command to change your current directory to the destination specified within the command. Say you want to go to a folder named tech, you type:

cd tech

You can navigate directly to the sub-directory of foo, like so:

cd tech/sub-folder

To head back to the previous directory or go one level up of the current directory, type:

cd ..

2. Create a New Folder

Another command that you may find in need often is mkdir. This command creates a new directory with the specified name. The following command, for example, will create a new directory named tech.

mkdir tech

We can also create multiple folders at once. This example below will create three directories named foo, hello, and world all together at once.

mkdir tech hello world

The mkdir command is compatible both in Terminal and Command Prompt.

3. Creating New File

Use thetouch command to create an empty file. For example:

touch filename.html

You can specify more filenames, as follows, to create multiple files at once.

touch file.html style.css

4. Moving Files

Use the mv command to move a particular file to a folder. This example below moves the tech.css to a folder named /sid.

mv tech.css /sid

You can also make use of the mv command to rename files and folders. This example below will rename the index.html into about.html.

mv index.html about.html

5. Copying Files

Type cp command or copy, if you want to copy a file or folder. Below is an example where we copy index.html and name the new file to about.html.

cp index.html about.html

If you are running on Windows, use the copy command instead.

6. List Directory Content

This is one of the commands that I personally use often, List Directory or known as ls. With this command, you can list the content of a directory. Specifying a folder name ahead of the ls command will list the content of the folder specified.

The ls command, however, will only work in a UNIX shell. You can run lscommand in Ubuntu and OS X, but not in Windows. In Windows, type dircommand instead.

7. Open Files

The open command will open files of folders in the default app. This command below will open the folder Desktop in Finder.

open ~/Desktop

The following command will open a .txt folder in TextEdit, which is the default app in OS X to edit plain text file.

open readme.txt

Windows users should use edit. Given the same example, you can run:

edit readme.txt


  • You can use exit command to exit from command prompt in windows.
  • You can use ipconfig to quickly find your ip address.

These are only some of the the command lines but they are basic commands everyone must know.

Take your own time and comment down below.

Post Author: admin_droidmegatech

Leave a Reply

Your email address will not be published. Required fields are marked *