Ankita Chaudhari
4 min readMar 27, 2018

--

Command Line FUN in Windows and Linux side by side!! 😊

Operating the system through the command line looks very cool than operating it from GUI. It feels like we doing some high-end work. Plus it's easy to learn and efficient as we can see the actual logs and errors in the command line. It’s always good to have command over the command line!! 😉

Let’s get started with the everyday useful commands …

1] For viewing all the options available for a particular command

Linux terminal

[command] -help OR [ command] -h OR man [command]

Windows cmd

[command] -help OR [command] /?

Help is a very important command it gives all the options available for a particular command, We can learn so much from this command. man [command] is used in Linux as Linux is open source it gives a full General Commands Manual, it not only states the options but describes the functionality provided by that command and a small description about that method.

2] For clearing the screen:

For Linux:

clear

For windows

cls

3] To check the version of any installed software:

For Linux and windows, this is the same

[application-name] -version

Ex. java -version ⇐ will give the version of java installed on the computer

4] To open a file in read-only mode:

For Linux:

more [file-name]

For Windows:

type [file-name]

5] For making a new directory:

For Linux and windows

mkdir [directory-name]

6] For navigating from one directory to another directory:

This is the same for Linux and windows, the only difference is that in the directory path in Linux we use (/) forward slash whereas, in windows we use (\) backward slash. The same applies to going back from a directory.

cd .. ⇐ To go back one directory

cd ../.. ⇐ To go back two directories

To go to the directory

cd [directory-path]

Ex. in Linux c:/temp/test

In windows c:\temp\test

7] For viewing the content in the directory:

For Linux:

ls or ll

ls gives the only list of content present in the directory while ll shows the permission and metadata of the file

For Windows:

dir

This serves the purpose of showing all the content present in the directory and gives the metadata for the directory.

8] For printing present working directory:

For Linux:

pwd

For Windows:

echo %cd% ⇐ cd stands for current directory

9] For printing the present date:

For Linux:

date

For Windows:

date

NOTE: When we execute the date command it displays the current date and a prompt for a new date is shown. to keep the current date as it is just press ENTER

10] For copying the file from one directory to another directory:

For Linux:

cp [source] [destination]

For Windows:

copy [source][destination]

11] For moving the file from one directory to another directory:

For Linux:

mv [source] [destination]

For Windows:

move [source] [destination]

12] For deleting the directory:

For Linux:

rmdir [directory-name]

For recursively deleting the directory we can use rm -rf

Note: Don’t use this command carelessly, it deletes the content without showing the warning sign.

For Windows:

Rmdir [directory-name] ⇐ deletes directory

DEL [directory-name] ⇐ deletes content in the directory

13] For renaming the files:

For Linux:

mv [source] [destination]

We need to use mv command and while moving to destination specify the renamed directory name

For windows

rename [old-name] [new-name]

14] For creating new files:

For Linux:

touch [file-name]

For Windows:

notepad [file-name]

15] For exiting the command line:

exit

In Linux and window, the command is the same

Other than the above commands, Linux also support other very useful commands

wget [link-address]

The wget command is used to retrieve content from web servers. It supports downloading via HTTP, HTTPS, and FTP.

history

The history command is used to show all the last commands that have been recently used. The command is simply called history, but can also be accessed by looking at your .bash_history in your home folder. By default, the history command will show you the last five hundred commands you have entered.

That’s all for this post. If you enjoyed reading this post please hit like and for advance and deep learning command line visit my next post.

Just remember,

Thank you.

--

--