0% found this document useful (0 votes)
103 views15 pages

HHS En02 Windows and Linux

Uploaded by

nipuna
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views15 pages

HHS En02 Windows and Linux

Uploaded by

nipuna
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

License for Use Information


The following lessons and workbooks are open and publicly available under the following terms and conditions of ISECOM: ll works in the !acker !ighschool pro"ect are provided for non#commercial use with elementary school students$ "unior high school students$ and high school students whether in a public institution$ private institution$ or a part of home#schooling% These materials may not be reproduced for sale in any form% The provision of any class$ course$ training$ or camp with these materials for which a fee is charged is e&pressly forbidden without a license including college classes$ university classes$ trade#school classes$ summer or computer camps$ and similar% To purchase a license$ visit the 'ICE(SE section of the !acker !ighschool web page at www%hackerhighschool%org)license% The !!S *ro"ect is a learning tool and as with any learning tool$ the instruction is the influence of the instructor and not the tool% ISECOM cannot accept responsibility for how any information herein is applied or abused% The !!S *ro"ect is an open community effort and if you find value in this pro"ect$ we do ask you support us through the purchase of a license$ a donation$ or sponsorship% ll works copyright ISECOM$ +,,-%

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

Table of Contents
.'icense for /se0 Information%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + Contributors%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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, +%-%1 !ow to open a console window%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1, +%-%+ Commands and tools :'inu&;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%1, +%2% E&ercises%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%16 +%2%1 E&ercises in 7indows%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%16 +%2%+ E&ercises in 'inu&%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%16 +%2%6 E&ercise 6%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%16

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

Contri !tors
8aniel <ern=nde> ?leda$ Internet Security @airo !ern=nde>$ 'a Salle /3' ?arcelona @aume bella$ 'a Salle /3' ?arcelona # ISECOM Aim Truett$ ISECOM *ete !er>og$ ISECOM Marta ?arcelB$ ISECOM uditors

"

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

2#$# Intro%!ction an% O &ecti'es


This lesson introduces commands and basic tools for both 7indows and 'inu& operating systems so that you can become familiar with them% These commands will be used to complete the e&ercises in the following lessons t the end of this lesson$ you should know the following commands: Ceneral 7indows and 'inu& commands ?asic network commands and tools # ping # tracert # netstat # ipconfig # route

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

2#2# )e*!irements an% Set!+


2#2#$ )e*!irements
<or the lesson$ the following are needed: # a *C with 7indows DE)Me)+,,,)(T)F*)+,,6 # a *C with 'inu& Suse)8ebian)Anoppi& # access to the Internet%

2#2#2 Set!+

This is the setup in which you are going to work% It consists of your *C$ with access to the Internet$ and the ISECOM !acker !ighschool network$ which you will access through the Internet% This is the network against which you will make most of the tests% (ote that access to the ISECOM test network is restricted% In order to gain access to it$ your instructor must contact the sytem administrator$ as detailed on the www%hackerhighschool%org web site%

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

2#3# S-stem O+eration. WINDOWS


Most of the tools used for the study of networks are internal commands in the 7indows operating system% Therefore$ we are going to e&plain how to open a command window when the 7indows operating system is being used%

2#3#$ /o0 to o+en an MS1DOS 0in%o0


To issue the following commands$ it is necessary to open a command prompt :an MS#8OS window;% The procedure for this is the same for all versions of 7indows% 1%# Click the ST 3T button +%# Choose the 3/( option 6%# Type .comman%0 if you are using 7indows D2)DE or .cm%0 for all other versions of 7indows and press Enter or click OA% -%# window similar to the following one will appear:

2%# (ow the commands and tools listed below can be entered%

2#3#2 Comman%s an% too2s 3Win%o0s4


Commands %ate time 'er %ir c2s m5%ir6 m% directory c7%ir6 c% directory rm%ir6 r% directory 8isplay or set the date of the system 8isplay or set the time of the system 8isplay the MS#8OS version that is being used 8isplay the list of subdirectories and files of a directory Clear the screen Make a directory with the name .directory0 E&ample: md tools 8isplay the name or change the current directory to .directory0 E&ample: cd tools 8elete the directory with the name .directory0 E&ample: rd tools

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

tree directory c75%s5 mem rename6 ren source dest co+- source dest move source dest t-+e file more file %e2ete6 %e2 file

8isplay the structure of folders of a path in te&t#graphic format E&ample: tree c:Gtools Check a disk and show a status report Show the amount of memory used and free in the system Change the name of files E&ample: ren oldname newname Copy one or more files to another location E&ample: copy c:GtoolsGmyfile%t&t c:Gtmp Move files and change the name of files and directories E&ample: move c:Gtools c:Gtmp Type the content of one or more te&t files E&ample: type c:GtoolsGmyfile%t&t 8isplay the information screen by screen E&ample: more c:GtoolsGmyfile%t&t 8elete one or more files E&ample: del c:GtoolsGmyfile%t&t

(ote: The words in italics are not commands$ and must be replaced by the desired values% Some of the commands can be used by typing either their long version or short versionH for e&ample$ IdeleteI and IdelJI are the same command% Tools +in9 host Kerify contact with the machine .host0 The command ping sends IpacketsI using ICM* :Internet Control Message *rotocol; to another computer$ to learn whether it is accessible through the network% In addition$ it shows a statistical summary about the percentage of packets that have not been answered and the response time% The name of the machine can be used directly or its I* address% E&amples: ping www%google%com ping 1D6%1-2%E2%+ Some options are: # n (: send ( packets # t: ping the specified host until stopped :press CT3'LC to end; To see more options: ping )h

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

tracert host

Show the route that packets follow to reach the machine .host0 The command tracert is the abbreviation of trace route$ which allows you to learn the route that a packet follows from the origin$ :your machine; to the destination machine% It can also tell you the time it takes to make each "ump% t the most$ 6, "umps will be listed% It is sometimes interesting to observe the names of the machines through which the packets travel% E&amples: tracert www%google%com tracert 1D6%1-2%E2%+ Some options are: # h (: to specify ($ at the most$ "umps% # d: to not show the names of the machines%

i+confi9

To see more options: tracert 8isplay information on the active interfaces :ethernet$ ppp$ etc%; in the computer% Some options: )all: to show more details )renew name: renews connection with .name0 when automatic configuration with 8!C* is used% )release name: deactivates all matching connections when automatic configuration with 8!C* is used%

ro!te +rint

To see more options: ipconfig )M 8isplay the routing table The command route serves to define static routes$ to erase routes or simply to see the state of the routes% Some options: print: to show the list of routes% delete: to delete a route% add: to add a route%

netstat

To see more options: route)M 8isplays information on the status of the network and established connections with remote machines% Some options: #a: To sample all the connections and listening ports #n: to display addresses and port numbers in numeric form #e: to sample Ethernet statistics <or e&ample: netstat # an To see more options: netstat)M

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

<or additional information on these commands and tools type Icommand )hI or Icommand )MJI or Ihelp commandI from a MS#8OS window% <or e&ample$ for additional information on the tool netstat$ we have three possibilities: 1; netstat )h +; netstat )M 6; help netstat

2#"# S-stem O+erations. Lin!<


@ust as in 7indows$ if you are using 'inu&$ a great ma"ority of the commands that you will use are e&ecuted from a console emulation window% Therefore$ we will ne&t learn how to open a console window in 'inu&% 2#"#$ /o0 to o+en a conso2e 0in%o0 To issue the following commands$ it is necessary to open a console window: 1% # To go to the ST 3T **'IC TIO( button +% # Select .3un Command0 6% # Enter .konsole0 -% # window similar to the following one will appear:

2% # (ow the commands and tools listed below can be entered%

2#"#2 Comman%s an% too2s 3Lin!<4


Commands +0% 7ostname 8isplay the name of the current directory% 8isplay the name of the local host :the computer which you are currently using;

$=

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

fin9er user 2s c% directory

8isplay information on the user .user0 E&ample: finger root 'ist the content of the directories E&ample: ls #la Change from current directory to .directory0% If no directory name is specified it changes to the home directory$ E&ample: <or the login name .mylogin0 the command Ncd changes the directory to )home)mylogin E&ample: Ncd # changes to the last visited directory E&ample: Ncd )tmp

c+ source dest rm file m' source dest m5%ir directory rm%ir directory fin% > 1name file ec7o string command ? file command >> file

man command

changes to the .tmp0 directory Copy files% Copy the file .source0 to the file .dest0% E&ample: cp )etc)passwd )tmp 8elete files% Only the owner of the file :or root; can delete it% E&ample: rm myfile Move or rename files and directories% E&ample: mv oldname newname Make a directory with the name .directory0% E&ample: mkdir tools 8elete the directory with the name .directory0 if it is empty% E&ample: rmdir tools <ind a file with the name .file0 beginning the search in the root directory E&ample: find ) #name myfile 7rite the string .string0 in the standard output E&ample: echo hello 3edirect the normal screen output of the command .command0 to the file .file0 E&ample: ls O myls 3edirect the normal screen output of the command .command0 to the file .file0% If the file already e&ists$ it appends the output to the end of the file% E&ample: ls OO myls Show the pages of the online manual about .command0 E&ample: man ls

(ote: The words in italics are not commands and must be replaced by the desired values%

$$

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

<or additional information on the use of these commands and tools$ type in Icommand #helpI or Iman commandI in the console window% <or e&ample$ for additional information on the .ls0 command$ type in either of these two possibilities: 1; ls P#help +; man ls Tools :*lease see the 7indows section for details on these tools%; +in9 host tracero!te host ifconfi9 ro!te netstat Kerify the contact with the machine .host0 E&ample: ping www%google%com Show the route that the packets follow to reach the machine .host0% E&ample: tracert www%google%com 8isplay information on the active interfaces :ethernet$ ppp$ etc%; 8isplay the routing table 8isplay information on the status of the network E&ample: netstat #an

Basic comman% e*!i'a2ences for Win%o0s>Lin!< This is a table showing the basic command e4uivalences between 'inu& and 7indows% Commands are e&ecuted from a shell :in 'inu&; or from a MS#8OS window :in 7indows;% 'inu& command ##help man command cp rm mv mv more$ less$ cat lpr rm #3 ls cd mkdir rmdir route traceroute PI ping ifconfig 7indows command )h$ command )M help command copy del move ren type print deltree dir cd md rd route print tracert ping ipconfig

$2

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

2#(# E<ercises
2#(#$ E<ercises in Win%o0s
1% Co to a MS#8OS window% +% Identify the version of MS#8OS that you are using% 7hat version have you detectedM 7hat command have you usedM% 6% Identify the date and time of the system% If they are incorrect$ modify them so that they are correct% 7hat command have you usedM -% Identify all the directories and files that are in .c:G0% 7hat command have you usedM 2% Create the directory c:GhhsGlesson,% Copy in this directory all the files with the e&tension .%sys0 that are in .c:G0% 7hat files have you foundM 7hat commands have you usedM 5% Identify the I* address of your host% 7hat command have you usedM 7hat I* address do you haveM 9% Trace the route to .www%google%com0% Identify I*s of the intermediate routers%

2#(#2 E<ercises in Lin!<


1% Identify the owner of the file .passwd0% :(ote: first locate where this file is;% 7hat command have you usedM +% Create the directory .work0 in your own home directory :for e&ample$ if your login is .mylogin0$ create the directory in .)home)mylogin0;$ and copy the file .passwd0 in the directory .work0 that you have "ust created% Identify the owner of the file .passwd0 that has been copied% 6% Create the directory .%hide0 in the .work0 directory% 'ist the contents of this directory% 7hat did you have to do to see the contents of directory I%hideIM -% Create the file .test10 with the content .This is the content of the file test10 in the .work0 directory% Create the file .test+0 with the content .This is the content of the file test+0 in the .work0 directory% Copy into a file with the name Itest0 the contents of previous files% 7hat commands have you usedM 2% Identify the name and the I* address of your machine% 7hat commands have you usedM 7hat I* address do you haveM 5% Trace the route to .www%google%com0% Identify I*s of the intermediate routers%

2.5.3 Exercise 3
Complete the following table with parallelisms between 7indows and 'inu&% <or e&ample: the 'inu& command .command #help0 is e4uivalent to the 7indows

$3

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

command .command )h0% command$ .copy0%

s another e&ample$ in 'inu&: .cp0 is "ust like the 7indows

command help cp mv more

##

command ) h copy del print deltree

ls cd md rd route tracert *ing ipconfig

$"

LESSON 2 BASIC COMMANDS IN LINUX AND WINDOWS

@!rt7er )ea%in9
<or an e&tensive glossary of terms visit the following /3's: http:))www%matisse%net)files)glossary%html http:))www%uic%edu)depts)accc)inform)v1,5%html http:))www%catb%org)Qesr)"argon) 7indows P for additional information on commands and tools$ type in Icommand )hI or Icommand )MJI or Ihelp commandI from a MS#8OS window% 'inu& P for additional information on commands and tools$ type in Icommand ##helpI or Iman commandI from a shell%

$(

You might also like