§ 1.2section 2 of 16·~4 min
The terminal survival kit
The terminal feels scary for about two days, and then it becomes faster than clicking. You only need about ten commands to start.
pwd # "print working directory": where am I?
ls # list files here
ls -la # list ALL files (including hidden ones like .git) with details
cd projects # move into the folder 'projects'
cd .. # move up one folder
cd ~ # jump to your home folder
mkdir notes # make a new folder
touch main.py # make an empty file
cat main.py # print a file's contents
rm old.txt # delete a file (there is no recycle bin, so be careful)
code . # open the current folder in VS Code
Paths. A path is an address for a file.
- An absolute path starts at the root:
/home/priya/projects/expense-tracker/main.py. - A relative path starts from where you are now:
expense-tracker/main.py. .means "this folder" and..means "the parent folder".
Three habits that save hours:
- Press Tab to auto-complete file and folder names. It prevents typos.
- Press the Up arrow to bring back your previous command.
- Press Ctrl+C to stop a program that's stuck or running forever.
Reading error messages. When a command fails, the last line of the output usually says why: No such file or directory, command not found, Permission denied. Read it before you do anything else, and copy it exactly when you ask for help.
Try it
Without using your mouse: make a folder week1, go into it, create a.py and b.py, list them, go back up, and open week1 in VS Code.