Command-line Computing Exercise
Command Prompt (Windows OS)
Open the Command Prompt application.
FYI: If you are into maximum efficiency through keyboard shortcuts, get there quick by pressing the "windows" button, then begin typing the word "command", then hit enter when you see "Command Prompt" show up. :smiley_cat:
Instructions
After typing each of the commands below, press "enter" to execute it.
Optionally, clear previous output at any time by typing "CLS" and pressing "enter".
Current User
Print the current user's name:
Present Working Directory
Print the current/present working directory:
List Files in a Directory
List files in the current working directory:
Navigate and Manage Directories
Change directories (specifying absolute file path):
NOTE: if your username has a space in it (e.g. "Sammy Student"), then you may run into issues unless you surround the name of that directory with quotes (e.g.
cd C:\Users\"Sammy Student"\Desktop\
. This usage of quotes applies to any / all files and directories which may have spaces in them, so in general you are encouraged to create new files and directories without any spaces in them, to make life easier on yourself.
Make a new directory:
Remove a directory:
Manage Files
Change directories (using relative file path):
FYI: Use the command
cd ..
to move "up" one directory relative to the current working directory.
Create one or more files:
CLARIFICATION: yes,
type
is part of the command :smiley_cat:
Remove/delete a file:
Edit and save a file, using a command-line utility provided by your preferred text editor (just choose one of these, depending on which editor you're using):
Print file contents:
Move a file to target location:
FYI: If you are into maximum efficiency, press "tab" to auto-complete file paths so you don't have to type the whole thing. :smiley_cat:
Copy a file:
Copy contents of a file into the clipboard for pasting:
Further Exploration
Optionally explore additional command-line interfaces, if you're curious.
Internet Computing
Trace the route traveled by a network request:
Time the duration of a network request:
Download the cURL utility if necessary, then request the contents of a webpage:
You may need to execute these commands from within the downloaded directory. See "Installing cURL on Windows" for more support.
Last updated