File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v...
-
Upload
godfrey-maxwell -
Category
Documents
-
view
212 -
download
0
Transcript of File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v...
![Page 1: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/1.jpg)
File and Folder CLI Commands
04/21/23 1
![Page 2: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/2.jpg)
AgendaOverview of OS functions and the SHELLInternal v External CommandsCommand HistoryMaking & Modifying DirectoriesMaking & Modifying Files
![Page 3: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/3.jpg)
Application Program Layer
Operating System Layer
Hardware Layer
User Interface (shell)
File Management
Device Management
Task Management
![Page 4: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/4.jpg)
Application Program Layer
Operating System Layer
Hardware Layer
User Interface (shell) cmd.exe
File Management
Device Management
Task Management
OPEN FILE
![Page 5: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/5.jpg)
CLI Syntax
Command tells CLI “what” user wants to doParameter tells CLI “where” user wants the
command to happen. (A:)Switch (or Option) tells CLI “how” the user
wants the command to be executedC:\> COPY /A /V myfile.txt e:\backup\
Switch/A ASCII file
/V Verify after copying
Parameter 1Source
Parameter 2Target
CommandPrompt
Drive and path
![Page 6: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/6.jpg)
Internal CommandsInternal commands
are built into the command interpreter cmd.exeInstalled with OSNo disk accessFaster performance
Examples: CD, CHDIR COPY DEL DIR ECHO GOTO REN, RENAME RD, RMDIR SET START TITLE PAUSE
![Page 7: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/7.jpg)
External Commandsexternal commands
that are not built into the command interpreter cmd.exeInstalled in separate
folderDisk Access requiredSlower performance
Examples: TREE MORE HELP IPCONFIG PING ATTRIB XCOPY SORT NET
![Page 8: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/8.jpg)
Command History DOSKEYF7 – to list commands to dateF9 – to select command number and place on
the command lineF3 – to repeat previous commandUP Arrow – to scroll previous commandF2 – edits previous command line up to the
identified character
![Page 9: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/9.jpg)
![Page 10: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/10.jpg)
Same Explorer information, but different views
![Page 11: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/11.jpg)
C:\
IOS110
LecturesLecture1.txtLecture1.pps
LabLab1.htmLab2.draft.htm
Root
Child
Child
Child\Parent
![Page 12: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/12.jpg)
File Names You can use most characters in a file name
although there are some illegal ones: / \ : * ? " < > |
File names can be up to 255 characters and can use upper and lower case, spaces and multiple extensions
Win16 programs must use 8.3 rule XP automatically creates a “short file name”
or “alias” Long file name (LFN) e.g.
The little brown fox.foxx.jan.doc Alias Thelit~1.doc
04/21/23 12
![Page 13: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/13.jpg)
C:\
IOS110
LecturesLecture1.txtLecture1.pps
LabLab1.htmLab2.draft.htm
Absolute path defines a file or directory from the root
Relative path defines a file or directory from the working directory (its position in the directory tree)
\IOS110\lab\lab1.htm
..\..\lab1.htm
![Page 14: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/14.jpg)
Make a directory (MD, MKDIR) To create or make a directory type md or
mkir at the prompt, with the name of the directory
For example, to create a file called data, use the command: MD data
04/21/23 14
![Page 15: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/15.jpg)
Change Directory (CD,CHDIR)To switch between directories, we use the CD
command (chdir will also work).Note: if you use the CD command and
misspell the directory or enter a directory that does not exist, you will receive an error message.”the system cannot find the path specified”
To go to the root from anywhere type cd\To go up one directory (parent) type cd ..To go up 2 levels type cd ..\..
04/21/23 15
![Page 16: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/16.jpg)
Remove Directory (RD) To remove an empty directory, the RD
command works well. If your directory is not empty though, you
need to add the /s switch to delete a “directory tree”
04/21/23 16
![Page 17: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/17.jpg)
PracticeCreate two directories January and
February under the root of C:. Create three directories under January:
tests, quizzes and labsCreate the same three directories under
February.Navigate to the c:\February\quizzes
directory.How would you get from this directory to
the January\tests directory?04/21/23 17
![Page 18: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/18.jpg)
Absolute Pathnames ExerciseCreate a directory called week2 under the
root of C:\ you would type:C:\> MD c:\week2 or C:\> MD \week2 (TRY IT)
Once that directory has been created, let’s say you want to create a subdirectory called prac2 in week2.
Using absolute pathnames you would type C:\> MD \week2\prac2 (TRY IT)
04/21/23 18
![Page 19: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/19.jpg)
Absolute Pathnames PracticeCreate a directory called cars under the root of C:\Create the following directories using absolute
paths onlyC:\cars\SUVsC:\cars\compactC:\cars\sportsC:\cars\SUVs\escapeC:\cars\SUVs\tributeWhen you are done, run the command TREE \cars
For more absolute path information click here
04/21/23 19
![Page 20: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/20.jpg)
Relative PathnamesInstead of working from the root, we work
from our current or working directory.
For example, if you were in the c:\apps directory and wanted to create a directory called word within the apps directory, you would simple type:
MD word
04/21/23 20
![Page 21: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/21.jpg)
Relative Pathnames ExercisesWe have the following directory structure:C:\AppsC:\Apps\wordC:\Apps\GhostAssuming you were in the Apps\Ghost
directory and you wanted to create a directory in the root of C:\ called Games.
You could type MD ..\..\gamesThe ..\..\ brings you up two levels back to
the root.
04/21/23 21
![Page 22: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/22.jpg)
DIR commandIf you want to see a listing of all of the files and
folders in a given directory or even your entire system, then this is the command to use.
DIR always lists the contents of your working directory unless you specify a directory such as:
DIR c:\2005\JanuaryThis command will list the contents of the
January directory.If you were in the January directory then
simply typing the command DIR would also display the contents of the January directory.
04/21/23 22
![Page 23: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/23.jpg)
Viewing Text FilesIf all you want to do is view the contents of a file,
then use the TYPE command. TYPE [path to file] will display the contents of the
file to the screenHowever, if file is large it will scroll past very fast.
For large files use Type file1.txt | moreThe “|” pipe symbol is used to filter the output one
page at a timeMore file1.txt file2.txt file3.txt
More is a better command but is “external”. It automatically filters input and provides a “submenu” for greater control
04/21/23 23
![Page 24: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/24.jpg)
Create a Text FileNotepadEditCopy conNote: remember the path where you saved
them!!To help you remember display the full path to
the file in the title barIn an Explorer window go to Tools\Folder
Options\View and click “Display Full Path in Title Bar”
![Page 25: File and Folder CLI Commands 12/24/20151. Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.](https://reader036.fdocuments.us/reader036/viewer/2022070415/5697bfed1a28abf838cb92d0/html5/thumbnails/25.jpg)
DEL (Delete) commandTo delete a file, use the DEL command.You can delete multiple files at once by using
wildcards.Remember, use the RD command to remove
empty directories
04/21/23 25