| Command | What it does |
|---|---|
pwd |
Shows the current directory |
cd <path> |
Moves into a directory (cd .. goes up one level, cd ~ goes home) |
ls |
Lists files in the current directory (ls -la shows hidden files and details) |
find <path> -name "<pattern>" |
Searches for files by name |
which <command> |
Shows where a command is installed |
| Command | What it does |
|---|---|
touch <file> |
Creates an empty file |
mkdir <dir> |
Creates a directory (mkdir -p makes parent directories too) |
cp <src> <dest> |
Copies a file or directory (cp -r for directories) |
mv <src> <dest> |
Moves or renames a file |
rm <file> |
Deletes a file (rm -r for a directory, use carefully) |
cat <file> |
Prints a file's contents to the screen |
less <file> |
Opens a file for scrollable reading (q to quit) |
head -n 10 <file> |
Shows the first 10 lines of a file |
tail -n 10 <file> |
Shows the last 10 lines (tail -f follows a file as it grows, useful for logs) |
| Command | What it does |
|---|---|
grep "<pattern>" <file> |
Searches a file for lines matching a pattern (grep -r searches a whole directory) |
wc -l <file> |
Counts lines in a file |
sort <file> |
Sorts lines alphabetically or numerically (sort -n for numbers) |
uniq |
Removes adjacent duplicate lines (usually paired with sort first) |
awk '{print $1}' <file> |
Prints a specific column from structured text |
sed 's/old/new/g' <file> |
Replaces text in a file |
| Command | What it does |
|---|---|
chmod +x <file> |
Makes a file executable |
ps aux |
Lists running processes |
kill <pid> |
Stops a process by its process ID |
top |
Shows live resource usage by process (q to quit) |
| Command | What it does |
|---|---|
curl <url> |
Fetches a URL, useful for testing an API |
ssh user@host |
Connects to a remote machine |
scp <file> user@host:<path> |
Copies a file to or from a remote machine |
| Symbol | What it does |
|---|---|
| ` | ` |
> |
Writes output to a file, overwriting it |
>> |
Appends output to a file |
&& |
Runs the next command only if the first one succeeds |