From the terminal/console and using only the command line, create the following:
A new folder with the name of first_day_stuff
.
A new HTML file with the name of first-day.html
.
Open the current folder containing the new HTML file.
one_folder
and second_folder
in one command.one.html
and two.html
in one command in the first_day_stuff directory.cd
to navigate to Desktop
:cd Desktop
To get into Desktop you might see onedrive and that is where desktop folder might be located.
cd Onedrive
cd Desktop
or
cd Onedrive/Desktop
or
cd Desktop
π We use the mkdir
command to create a new directory inside Desktop
named first_day_stuff
:
mkdir first_day_stuff
π We use cd
to navigate inside the first_day_stuff
directory that we just created:
cd first_day_stuff`
π We use touch
to create a new file named index.html
inside first_day_stuff
:
touch index.html
π To test that the user’s goal has been met, we use cd ..
to navigate back to the Desktop
and ls
to list the contents of Desktop
:
cd ..
ls
The first_day_stuff
directory is listed among the contents of the Desktop
.
To test that a file has been created in the folder, we use cd
to navigate into thefirst_day_stuff
directory:
cd first_day_stuff
Then we use ls
to list the contents of the directory:
ls
We see that an index.html
file is located inside the first-day
directory.
The solution addresses all the conditions of the acceptance criteria and clearly meets the user’s goal. Good work!
These are the basic commands for navigating directories in a terminal or Git Bash window.
cd [path/to/desired/directory]
cd ~
cd ..
ls
pwd
Press tab
key once to autocomplete once you have typed a unique portion of a file name.
touch [name of file to create]
mkdir [name of directory to create]
rm [name of file to remove]
rm -r [name of directory to remove]
cp [filename1] [filename2]
mv [filename1] [filename2]
open [name of file]
open .
explorer [name of file]
explorer .
Open Terminal/Console. Then walk and explain to students what each of the following commands does:
cd (changes directory)
cd ~ (changes to home directory)
cd .. (moves up one directory)
ls (lists files in folder)
pwd (shows current directory)
mkdir <FOLDERNAME> (creates new directory)
touch <FILENAME> (creates a file)
rm <FILENAME> (deletes file)
rm -r <FOLDERNAME> (deletes a folder, note the -r)
open . (opens the current folderβMAC SPECIFIC)
open <FILENAME> (opens a specific fileβMAC SPECIFIC)
explorer <FILENAME> (opens the specific fileβBASH SPECIFIC)
explorer . (opens the current folderβBASH SPECIFIC)
Notes
: Tabbing
Pressing the tab key
after typing "cd fol"
will autocomplete to "cd foldername,"
assuming foldername is unique. (Folder/Filename Autocomplete: Show students what happens when there are unique and multiple options based on what they typed.)