Sunday, November 2, 2014

Basic Linux & Windows commands paralleled


Here's a quick translation dictionary between Windows and UNIX shell commands. Remember that Windows separates path elements with \, while UNIX uses /. Remember also that Windows has different directory trees, one for each drive letter (file system). UNIX has only one tree.
Basic Shell Commands
 
 
Most commonly used:

UNIX Command Windows Equivalent
ls dir
pwd cd
cd path cd path
cat type
ping ping
ifconfig ipconfig
nslookup nslookup
traceroute tracert
nmap n/a
nc nc
 
Windows UNIX Summary Ex (Windows) Ex (UNIX)
dir ls list contents of current directory C:> dir $ ls
cd pwd display current directory C:> cd $ pwd
cd path cd path change current directory C:> cd \Users\m159999 $ cd /home/m159999
copy path1 path2 cp path1 path2 copy file path1 to name/location path2 C:> copy foo.txt bar.txt $ cp foo.txt bar.txt
move path path mv path path move file path1 to name/location path2 C:> move foo.txt ..\backup\ $ mv foo.txt ../backup/
del path rm path delete file path C:> del foo.txt $ rm foo.txt
rmdir path rmdir path delete folder/directory path C:> rmdir images $ rmdir images
mkdir path mkdir path create folder/directory path C:> mkdir images $ mkdir images
type path cat path print file path to screen C:> type index.html $ cat index.html
Notepad path gedit path
nano path
Open file path in a text editor
(nano doesn't require the GUI)
C:> Notepad foo.txt
 
$ gedit foo.txt
$ nano foo.txt
whoami whoami Tells the username for the account that is executing the command. C:> whoami $ whoami

Basic Networking Tools
 
 
Tool Summary Examples
ssh Open shell on remote UNIX host securely. $ ssh m159999@rona.cs.usna.edu
rdesktop Open desktop on remote Windows host securely. $ rdesktop mich300csd01w.academy.usna.edu
ping Check whether host with name/IPAddess is alive $ ping 10.2.0.5
trace[route/rt] Determine route taken by packets to given host $ traceroute www.mit.edu
nslookup Translates domain names to IP addresses and vice versa
Optional second argument specifies what nameserver to use.
C:> nslookup www.mit.edu
$ nslookup www.mit.edu ns1.usna.edu
ipconfig
ifconfig
Displays information about current network settings
ipconfig is for Windows, ifconfig is for UNIX.
C:> ipconfig
$ ifconfig
netstat Displays information on current port usage (-a shows "all") $ netstat -a
nc Netcat - lets you send and recieve tcp/udp traffic $ nc 143.84.217.3 80
hostname Tells you the name of the "host" (i.e. computer) that's executing the command. $ hostname
Follow these steps to open an Administrator shell in Windows:
  1. Press the System (Windows) key
  2. Type in: cmd
  3. Right-click cmd.exe to bring up the context menu.
  4. Select Run as administrator.























No comments:

Post a Comment