Files & Directories
Common commands for creating, copying, moving, and removing filesystem entries.
| Term / Syntax | Name | Description | Example |
|---|---|---|---|
mkdir |
Create directory | Creates a directory. | mkdir assets |
touch |
Create/update file | Creates an empty file or updates timestamps on many Unix-like systems. | touch README.md |
cp |
Copy | Copies files or directories when used with appropriate options. | cp index.html index.backup.html |
mv |
Move/rename | Moves or renames files and directories. | mv old-name.js app.js |
rm |
Remove file | Deletes files; use recursive options cautiously. | rm old-file.txt |
Inspecting & Searching
Commands for reading files and searching text/output.
| Term / Syntax | Name | Description | Example |
|---|---|---|---|
cat |
Print file | Writes file contents to standard output. | cat README.md |
less |
Paged viewer | Displays text one screen at a time with navigation/search. | less server.log |
grep |
Search text | Searches input for lines matching a pattern. | grep -n "error" server.log |
find |
Find files | Searches directory trees using conditions such as name or type. | find . -name "*.js" |
Pipes & Redirection
Shell operators for composing commands and controlling standard input/output.
| Term / Syntax | Name | Description | Example |
|---|---|---|---|
| |
Pipe | Sends one command's standard output to another command's standard input. | cat app.log | grep "ERROR" |
> |
Overwrite redirect | Writes standard output to a file, replacing its existing contents. | npm test > test-output.txt |
>> |
Append redirect | Appends standard output to a file. | echo "done" >> build.log |
2> |
Error redirect | Redirects standard error in common shells. | command 2> errors.log |
Environment & Processes
Commands and syntax for environment variables and running processes.
| Term / Syntax | Name | Description | Example |
|---|---|---|---|
env |
Environment | Displays environment variables in many Unix-like shells. | env |
export |
Set exported variable | Sets a shell variable for child processes in many shells. | export NODE_ENV=development |
echo |
Print value | Prints text or expanded shell values. | echo "$PATH" |
Ctrl+C |
Interrupt process | Common terminal shortcut for sending an interrupt signal to the foreground process. | Press Ctrl+C |
npm scripts |
Project commands | Runs scripts defined in a Node project's package.json. | npm run dev |