04 - Git - Exercise 1
Task 1 - Creating files and directories
Open GitBash
Using the
pwd
command identify the directory you're currently pointing to.Create a directory called
myDirectory
using themkdir
command.Navigate into the newly created directory.
Create another directory called
mySecondDirectory
. Navigate into this directory.Create two files -
file1.txt
andfile2.txt
withtouch
command .Your file structure should look like this
Navigate into the
myDirectory
directory.Navigate into your home folder (hint ~).
Task 2 - Modifying files using vi
Open GitBash if it’s closed and navigate into
mySecondDirectory
folder.Display the content of the folder.
Open
file1.txt
using vi:vi file1.txt
Press
i
on your keyboard - now you're in insert mode.On the first line type “hello world!”. On the second line type “I’m using vi”.
Return from edit mode by pressing
Esc
.Type
:wq
which will be displayed at the very bottom of the page and pressEnter
.Check that your file has been modified either by doing
vi file1.txt
again or usingcat file1.txt
.cat
stands for concatenate and it means that the content of the file will be displayed directly in your shell.
Task 3 - Removing files and directories
Open GitBash if it’s closed and navigate into
mySecondDirectory
folder.Remove
file2.txt
file from themySecondDirectory
folder.Navigate into the directory that contains the
myDirectory
folder.Remove the
myDirectory
folder with all its content.