Learning Your Ship's Language
Before you can navigate through space, you need to communicate with your spacecraft's computer. The command line is your direct interface to the ship's systems—no graphical buttons, just pure, efficient commands.
Essential Navigation Commands
Where Am I? (pwd)
The pwd command (print working directory) tells you your current location in the file system:
pwd
Output might look like:
/home/astronaut/projects
What's Here? (ls)
The ls command lists files and directories in your current location:
ls
For more details, add flags:
ls -la
This shows hidden files (-a) with detailed information (-l).
Windows users: Use dir in Command Prompt, or ls in Git Bash/PowerShell.
Change Location (cd)
The cd command (change directory) moves you through the file system:
cd projects # Move into 'projects' directory
cd .. # Move up one level
cd ~ # Go to home directory
cd /path/to/dir # Go to specific path
File System Manipulation
Create Directory (mkdir)
Create a new directory (folder):
mkdir my-mission
mkdir -p deep/nested/directories # Create parent directories too
Create File (touch)
Create an empty file:
touch mission-log.txt
Windows Command Prompt users: Use echo. > filename.txt or type nul > filename.txt
Remove Files (rm)
Delete files (be careful—this is permanent!):
rm old-file.txt
rm -r directory/ # Remove directory and contents
rm -rf directory/ # Force remove (very dangerous!)
Windows Command Prompt: Use del for files, rmdir for directories.
Copy Files (cp)
cp source.txt destination.txt
cp -r source-dir/ destination-dir/ # Copy directories
Windows Command Prompt: Use copy for files, xcopy for directories.
Move/Rename (mv)
mv old-name.txt new-name.txt # Rename
mv file.txt other-dir/ # Move file
Windows Command Prompt: Use move or ren (rename).
Viewing File Contents
Display File (cat)
Show entire file contents:
cat file.txt
Windows Command Prompt: Use type file.txt
View Large Files (less)
For large files, use less for scrollable viewing:
less large-log.txt
Press q to quit, Space to scroll, / to search.
Useful Shortcuts and Tricks
Tab Completion
Press Tab to auto-complete file and directory names. This saves time and prevents typos.
Command History
- Press
↑(up arrow) to cycle through previous commands - Type
historyto see all recent commands - Press
Ctrl+Rto search command history
Clear Screen
clear # macOS/Linux
cls # Windows Command Prompt
Paths: Absolute vs Relative
Absolute Path
Starts from the root directory:
/home/astronaut/projects/mission
Relative Path
Starts from your current location:
./current-directory
../parent-directory
../../grandparent-directory
Combining Commands
Use pipes (|) to chain commands:
ls -la | grep ".txt" # List all .txt files
cat file.txt | wc -l # Count lines in file
Output Redirection
Redirect command output to files:
ls -la > file-list.txt # Write to file (overwrite)
echo "New log entry" >> log.txt # Append to file
Practice Exercise
Try this sequence to practice:
- Check your current location:
pwd - Create a directory:
mkdir test-mission - Move into it:
cd test-mission - Create a file:
touch launch-log.txt - List contents:
ls -la - Go back:
cd .. - Remove it:
rm -r test-mission
Getting Unstuck
- Stuck in a command? Press
Ctrl+Cto cancel - Terminal frozen? Press
Ctrl+Zto suspend, or close and reopen - Made a mistake? Most terminal commands can't be undone—be careful with
rm!
Windows-Specific Notes
Windows has different commands in traditional Command Prompt:
| Unix/Mac/Linux | Windows CMD | Purpose |
|---|---|---|
| ls | dir | List files |
| cd | cd | Change directory |
| pwd | cd | Show current path |
| clear | cls | Clear screen |
| rm | del | Delete file |
Recommendation: Windows users should use Git Bash or PowerShell for Unix-like commands.
Ready for Configuration
You now know the basic commands to navigate your file system. These work alongside Git—you'll use them to move between projects, create directories, and manage files.
Next, we'll configure Git with your identity so your commits are properly attributed to you.
Command Mastery: You don't need to memorize all these commands now. Keep this page bookmarked as a reference. With practice, the essential ones will become second nature.