Command | Description |
---|---|
pwd |
Displays the path of the current working directory |
cd <PATH> |
Changes the current working directory to <PATH> |
cd ~ |
Changes the current working directory to the user’s home directory |
cd .. |
Moves up one folder |
cd ../.. |
Moves up two folders |
clear |
Clears the contents of your command line window |
ls |
Lists files and folders in the current working directory |
ls <PATH> |
Lists files and folders in <PATH> |
ls -a |
Lists all files (including hidden files) in the current working directory |
ls -alh |
Lists all files in a long format that is easy to read for humans |
[Command] --help |
Displays all possible flags for a specific command (on Windows) |
man [Command] |
Displays all possible flags for a specific command (on macOS) |
mkdir <FOLDER> |
Creates a new folder called <FOLDER> |
mkdir <FOLDER1> <FOLDER2> |
Creates two separate folders called <FOLDER1> and <FOLDER2> |
touch <FILE> |
Creates a new empty file called <FILE> |
open <FILE> |
Opens the file called <FILE> (on macOS) |
start <FILE> |
Opens the file called <FILE> (on Windows) |
echo "example text" >> file.txt |
Writes “example text” into file.txt |
cat <FILE> |
Displays the content of <FILE> |
mv FILE.txt <FOLDER> |
Move FILE.txt into <FOLDER> |
mv <FOLDER_OLD> <FOLDER_NEW> |
Renames <FOLDER_OLD> to <FOLDER_NEW> |
ls -alh *.csv |
Uses a wildcard to list all .csv files in the current working directory |
rm -r <FOLDER> |
Removes the folder <FOLDER> |
history |
Display the command history of the current terminal session |
history > history.txt |
Saves the entire command history to a file named history.txt (overwrites existing content in history.txt ) |
history >> history.txt |
Adds the entire command history to the end of the file named history.txt |
tree |
Displays a graphical representation of the directory structure |
wget <URL> |
Downloads a file from the specified |
This session
In this session, you will work on the following tasks:
- Reading: Read the chapter(s) Command Line in the Version Control Book.
- Implementation: Try out the commands in the chapter.
- Exercises: Work on the exercises for the
city-guide
project. - Quiz: Test your knowledge with the quiz.
As always:
- Try out the commands of this session and play around with them.
- Check whether you have achieved the learning objectives.
- Ask questions!
- Let’s git started!
Learning objectives
At the end of this session, you should be able to answer the following questions and / or achieve the following learning objectives:
💡 You can navigate directories using the command line.
💡 You can use shortcuts like the tilde or dots to navigate your file system.
💡 You can explain the difference between absolute and relative paths.
💡 You can use arguments and flags to modify command-line commands.
💡 You understand the concept of wild cards (*
) and can use it for system navigation.
city-guide
project
At the end of this session, you should have accomplished the following:
- You used the command line to create a folder on your computer called
city-guide
. - You used the command line to create a file called
city-guide.txt
inside thecity-guide
folder.
Please keep the city-guide
folder! We will continue to use it in the following sessions.
Slides
To print the slides to PDF, do the following:
- Toggle into Print View using the E key (or using the Navigation Menu).
- Open the in-browser print dialog (CTRL/CMD+P).
- Change the Destination setting to Save as PDF.
- Change the Layout to Landscape.
- Change the Margins to None.
- Enable the Background graphics option.
- Click Save.
Note: This feature has been confirmed to work in Google Chrome, Chromium as well as in Firefox.
Here’s what the Chrome print dialog would look like with these settings enabled:
These instructions were copied from the Quarto documentation (MIT License) and slightly modified.