<aside> <img src="/icons/home_green.svg" alt="/icons/home_green.svg" width="40px" />
</aside>
Cheat sheet for MAC and Windows
| Command | Description | Example |
|---|---|---|
pwd |
Shows current location (path) | /c/Users/YourName/Desktop |
lsordir |
Lists files in current folder | |
cd foldername |
Move into a folder | cd Documents |
cd .. |
Move up one level(go back) | |
cd ~ |
Go to your home directory | |
cd / |
Go to the root directory | |
clearorcls |
Clear the terminal screen |
TIP: If a folder or file name has spaces, use:
- Quotes:
cd "My Documents"- Or backslash:
cd My\ Documents
| You want to... | Command |
|---|---|
| Go to Desktop | cd ~/Desktoporcd C:\Users\YourName\Desktop |
| Go to Downloads | cd ~/Downloads |
| Back to previous folder | cd .. |
| Action | Command | Sample Output |
|---|---|---|
| Check current directory | pwd |
/c/Users/YourName/Projects |
| List all files (including hidden) | ls -la |
drwxr-xr-x .git/-rw-r--r-- index.html-rw-r--r-- style.css |
| Find specific files | find . -name "*.js" |
./src/app.js./src/utils.js |
| Check if you're in git repo | git status |
On branch mainYour branch is up to date |
If using GCC (MinGW) or WSL/Git Bash:
gcc hello.c -o hello # Compile
./hello # Run (note the dot-slash!)
Why ./hello and not just hello?
./means "run the file in this folder"- Without
./, the system only checks built-in programs
Before using Git, make sure you are in the correct folder.
| Action | Command |
|---|---|
| Check where you are | pwd |
| List files | ls |
| Start Git in folder | git init |
| Check Git status | git status |
| Add all changes | git add . |
| Commit changes | git commit -m "Your message" |
| Connect remote repo | git remote add origin <url> |
| Push to GitHub | git push -u origin main |