Basic Linux and Windows commands you need to know

These commands will help you to do main things in your command line. And you may compare Windows and Linux commands in the same place.

CORE COMMANDS

Linux Key/Command

Windows Key/Command

Description

  C:  Change disk
cd cd  (work as pwd in linux) Home directory
cd [folder] cd [folder] or chdir [folder] Change directory e.g. cd documents
cd / cd / Root of drive
cd -   Previous directory
ls dir Short listing
ls -l   Long listing
ls -a   Listing incl. hidden files
ls -lh   Long listing with Human readable file sizes
ls -R   Entire content of folder recursively
sudo [command]   Run command with the security privileges of the superuser (Super User DO)
open [file] notepad [file] Opens a file ( as if you double clicked it )
top   Displays active processes. Press q to quit
nano [file]   Opens the file using the nano editor
vim [file]   Opens the file using the vim editor
clear cls Clear screen
reset reset {session} Resets the terminal display
  assoc Displays or modifies file name extension associations. Used alone, displays a list of all the current file name associations

FILE MANAGEMENT

Linux Key/Command

Windows Key/Command

Description

touch [file]   Create new file
pwd cd Full path to working directory
. . Current folder, e.g. ls .
.. .. Parent/enclosing directory, e.g. ls ..
ls -l .. dir .. Long listing of parent directory
cd ../../ cd ..\..\ Move 2 levels up
cat type [file] Concatenate to screen
rm [file] del [file] Remove a file, e.g. rm data.tmp
rm -i [file] del -i [file] Remove with confirmation
rm -r [dir]  rmdir [dir] Remove a directory and contents
rm -f [file]   Force removal without confirmation
cp [file] [newfile] copy [file] [newfile] Copy file to file
cp [file] [dir] cp [file] [dir] Copy file to directory
mv [file] [new filename]  ren [filename] [newname] Move/Rename, e.g. mv file1.ad /tmp
pbcopy < [file] sfk toclip Copies file contents to clipboard
pbpaste sfk fromclip Paste clipboard contents
pbpaste > [file]   Past clipboard contents into file, pbpaste > paste-test.txt