Windows cmd vs Linux shell commands

Table of linux and windows commands equivalents like:

  • shutdown vs reboot
  • ipconfig vs ifconfig
  • F7 vs history
  • help vs man

Have you ever wonder about a command - is it a Linux one or a Windows one? For me, this happens all the time. I'm using commands quite often so I've made my own cheat-list with Linux and Windows pairs of commands. You can use it also when you want to learn the other operating system.
If you find any mistakes or incomplete information feel free to comment. I'm open for suggestions.

Note: It's personal list based on personal experience. Some of the commands are used with different version of the OS so they could vary a little.

Next part is: Windows and Linux variable equivalents

Full page version:
Windows vs Linux commands cheat sheet

Here’s the result of it:

 

 

Windows

Linux

Type

Description

Command 

Example

Result

Command

Example

Result

General

Logoff

shutdown

shutdown -l

 

reboot

reboot

 

Restart

shutdown

shutdown -r

 

logout

logout

 

Shutdown

shutdown

shutdown -s

 

poweroff

poweroff

 

Show user

echo %USERNAME%

echo %USERNAME%

user

echo

echo $USER

user

Install application

 

 

 

apt-get
yum

sudo apt-get install ${package}
yum install ${package}

 

Remove application

 

 

 

apt-get
yum

apt-get remove ${package}
yum remove ${package}

 

Zip/unzip current folder

zip
unzip

zip -r file.zip folder
zip file.zip file
unzip -l file.zip

 

unzip

sudo apt-get install zip unzip
zip -r files.zip folder
zip files.zip file1 file2 file3
unzip /path/to/file.zip

 

Connect ssh

You need putty client

plink user@192.168.101.1 -P 33

 

ssh

ssh user@192.168.1.1  -p 33

 

List mounted devices

net use

net use

 

findmnt

findmnt -lo source,target,fstype,label,options -t ext4

 

Mount Remote

net use

net use \\Server\ShareFolder

 

mount

mount 192.168.1.1:/home /mnt/nfs/home

 

Show network info

ipconfig

ipconfig /all

Windows IP Configuration
   Host Name
   DNS Suffix Search List
Ethernet adapter Local Area Connection:
   Physical Address
   IPv4 Address
   Subnet Mask

ifconfig

ifconfig

eth0      Link encap:Ethernet  HWaddr
          inet addr:  Bcast:  Mask:
          inet6 addr: 
eth1      Link encap:Local  Hwaddr

Execute script

 

test.cmd

 

./

./test.sh

 

History

F7

F7

0: dir
1: cd ..
2: quser

history

history

  1  ls
  2  cd ..
  3  pwd

Go to previous command

or F8

F8 or

 

 

Search for commands

 

 

 

CTRL+R

CTRL+R and type the command

 

Clears screen

cls

cls

 

clear

clear

 

Closes shell prompt

exit

 

 

exit

exit

 

Displays or sets date

date

 

 

date

date

 

Displays command help

command /?

dir /?

 

info

man command

 

Displays command help 2

help command

help dir

 

man

info command

 

Autocompletion

TAB

TAB

 

TAB

TAB

 

Uptime and logged user

quser

C:\Users\user\Desktop>quser

USERNAME;SESSIONNAME;ID;
STATE;IDLE;TIME;LOGON;TIME
>user;console;1;Active;none;
4/5/2016;8:48 AM

uptime

uptime

06:18:56 up 75 days, 17:31,  1 user,  load average: 0.00, 0.00, 0.00

Files &
Folders

Show current folder

cd

cd

C:\Users\user

pwd

pwd

/home/user

Show current folder 2

chdir

chdir

C:\Users\user

echo

echo $PWD

/home/user

Create file

copy NUL file1.txt

 

 

touch

touch file.txt

 

Create file

echo. 2>file2.txt

 

 

cat

cat > myfile.txt

 

Renames a file

ren

ren file1.txt file2.txt

 

mv

mv tfileold.txt filenew.txt

 

Copies files

copy

copy file1.txt C:/foldercopy

 

cp

cp file.txt /home/foldercopy

 

Moves files

move

move file1.txt C:/newfolder

 

mv

mv file.txt /home/newfolder

 

Lists files

dir

 

 

ls

ls

 

Collect file names

dir

dir "C:\" >FilesC.txt /b /o

file1
file2

find

find /home -name '*'

/home/file1
/home/file2

Deletes files

del

del deleteme.txt

 

rm

rm deleteme.txt

 

Deletes folder

rmdir

rmdir /S deleteme

 

rm -r

rm -r deleteme

 

"Echoes" output to the screen

echo

 

 

echo

echo this message

 

Delete file content

type
break

type nul > file.txt
break>file.txt

 

cat

> file.txt
cat /dev/null > file.txt

 

Compares the contents of files

fc

fc file1.txt  file2.txt

Comparing files file1.txt and file2.txt
***** file1.txt
1
***** file2.txt
2
*****

diff

diff file1.txt file2.txt

 

Finds a string of text in a file

find

find "test" 123.txt


---------- 123.TXT
test

grep

grep test file1.txt

test line

Displays help

command /?

dir /?

 

info

man command

 

Displays help 2

help command

help dir

 

man

info command

 

Creates a folder

mkdir

mkdir newfolder

 

mkdir

mkdir directory

 

View file content

more

more file1.txt

 

less

less file1.txt

 

View file content 2

type

type file1.txt

 

tail

tail -n 15 file1.txt

 

Edit file

edit

edit  file1.txt

 

vi
nano
gedit

vi file.txt
nano  file.txt
gedit  file.txt

 

Changes directories with a specified path (absolute path)

cd

cd C:/

 

cd

cd /directory/directory

 

Go one folder

cd

cd ..

 

cd

cd ..

 

Search for a file

dir

dir /s *test*

07/31/2010  02:30 AM               301 test.png
               1 File(s)            301 bytes

find

find / -name '*test*'

/home/test.txt
/home/file2.png

Search for text files

dir

dir /b/s *.txt 

 

find

find / -name '*.txt'

 

Change files extension to lower

ren

ren *.TXT *.txt

 

mv

 for i in $( ls *.TXT ); do echo $i; mv $i  ${i%%.TXT}.txt; done

 

Check files permissions

 

 

 

ls

ls -l /home/user

"-rwxr-xr-x 1 root root  53 Mar 23  2015 /home/user"

Change Permissions

 

 

 

chmod

chmod 755 file

 

Changing ownership

 

 

 

chown

chown user file

 

Changing group ownership

 

 

 

chgrp

chgrp group file

 

Other

Displays the date

date

date /T

Wed 07/05/2017

date

date '+%d %W %Y'
date '+%D'

05 27 2017
05/27/2017

Displays the time

time

time /T

1:27 PM

date

date '+%X'

12:18:22 PM

Shows amount of RAM in use

wmic

wmic OS get FreePhysicalMemory /Value

 

free

free

 

Show disk space

wmic

wmic logicaldisk get size,freespace,caption

 

dh

dh -f

 

Show processes

tasklist

tasklist

 

top

top

 

Services

Stop execution

CTRL+C

CTRL+C

 

CTRL+C

CTRL+C

 

Start service

net

net start [serviceName]

 

service

sudo service [serviceName] start

 

Stop service

net

net stop [serviceName]

 

service

sudo service [serviceName] stop

 

Start service 2

sc

sc start [serviceName]

 

systemctl

sudo systemctl start [serviceName]

 

Stop service 2

sc

sc stop [serviceName]

 

systemctl

sudo systemctl stop [serviceName]

 

Variables

Display all variables

set

set

USERNAME=user
USERPROFILE=C:\Users\user
windir=C:\Windows

printenv

printenv

HOME=/home/user
LOGNAME=user

Display variable

echo

echo %USERNAME%

user

echo

echo $HOME

/home/user

Display variable 2

set

set USERNAME

USERNAME=user

printenv

printenv | grep

HOME=/home/user

Set variable

set

set MYVAR=VALUE

 

export

export MYVAR=/path/to/var

 

Set variable permanent

setx

setx MYVAR VALUE

 

change profile

vi ~/.bash_proflle
export MYVAR=/path/to/var