/
04 - Git - Exercise 1

04 - Git - Exercise 1

Task 1 - Creating files and directories

  1. Open GitBash

  2. Using the pwd command identify the directory you're currently pointing to.

  3. Create a directory called myDirectory using the mkdir command.

  4. Navigate into the newly created directory.

  5. Create another directory called mySecondDirectory. Navigate into this directory.

  6. Create two files - file1.txt and file2.txt with touch command .

  7. Your file structure should look like this

     

  8. Navigate into the myDirectory directory.

  9. Navigate into your home folder (hint ~).

Task 2 - Modifying files using vi

  1. Open GitBash if it’s closed and navigate into mySecondDirectory folder.

  2. Display the content of the folder.

  3. Open file1.txt using vi: vi file1.txt

  4. Press i on your keyboard - now you're in insert mode.

  5. On the first line type “hello world!”. On the second line type “I’m using vi”.

  6. Return from edit mode by pressing Esc.

  7. Type :wq which will be displayed at the very bottom of the page and press Enter.

     

  8. Check that your file has been modified either by doing vi file1.txt again or using cat 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

  1. Open GitBash if it’s closed and navigate into mySecondDirectory folder.

  2. Remove file2.txt file from the mySecondDirectory folder.

  3. Navigate into the directory that contains the myDirectory folder.

  4. Remove the myDirectory folder with all its content.