For many beginner developers, the terminal or command line feels intimidating. A black screen with white text and a blinking cursor — no buttons, no icons. But this is precisely the tool that will make you far more productive. Almost every modern development tool — Git, NPM, Composer, Docker — is operated through the terminal. Mastering the terminal is not optional; it is a must for a professional developer.
Getting to Know the Terminal and the Shell
A terminal is an application that provides a text interface for interacting with the operating system. A shell is the program that runs inside the terminal and interprets your commands. The most common shells are:
- Bash — the default on most Linux distributions and older macOS versions.
- Zsh — the default on modern macOS, richer in features.
- PowerShell — on Windows.
- Git Bash — a Bash emulator for Windows that ships with Git.
Navigating Directories
The most basic command is navigating between folders:
pwd
Displays the current directory location (Print Working Directory).
ls
ls -la
Displays the contents of a folder. The -l flag gives a detailed format, and -a shows hidden files.
cd nama-folder
cd ..
cd ~
cd /var/www/html
cd .. moves up one level to the parent folder. cd ~ takes you straight to the home directory.
Managing Files and Folders
Creating a new folder:
mkdir nama-folder
mkdir -p proyek/src/components
The -p flag creates the entire folder structure at once, even if the parent folders do not yet exist.
Creating a new file:
touch index.html
touch .env .gitignore
Copying a file or folder:
cp file.txt file-backup.txt
cp -r folder-asal/ folder-tujuan/
Moving or renaming a file:
mv file-lama.txt file-baru.txt
mv file.txt /path/tujuan/
Deleting a file or folder (be careful, this cannot be undone):
rm file.txt
rm -rf nama-folder
Reading File Contents
cat index.html
less package.json
head -n 20 app.log
tail -f app.log
tail -f is very useful for monitoring a log that is continuously updated in real time.
Searching for Files and Text
Searching for files by name:
find . -name "*.php"
find /var/www -name "config.php" -type f
Searching for text inside files:
grep "function login" app/Controllers/AuthController.php
grep -r "api_key" .
grep -rn "TODO" src/
The -r flag is for recursive search, and -n shows line numbers.
Running and Managing Processes
Running the PHP development server:
php -S localhost:8000
Running a Node.js script:
node server.js
nodemon server.js
Viewing running processes:
ps aux | grep php
ps aux | grep node
Stopping a process by its PID:
kill -9 12345
Or stop a process currently running in the terminal with:
Ctrl+C
Pipes and Redirects
A pipe (|) sends the output of one command as input to the next command:
ls -la | grep ".php"
cat access.log | grep "404" | wc -l
Redirecting output to a file:
php artisan migrate > migration.log 2>&1
echo "APP_ENV=production" >> .env
Terminal Productivity Tips
- Press
Tabto autocomplete a file or folder name. - Press
Ctrl+Rto search through your previous command history. - Press
Ctrl+Lor typeclearto clear the terminal screen. - Use
!!to repeat the last command:sudo !! - Create aliases for long commands in
.bashrcor.zshrc:
alias gs="git status"
alias gp="git push"
alias serve="php -S localhost:8000"
Conclusion
The terminal is a developer's most powerful weapon, one that is often overlooked by beginners. Start with basic navigation commands like cd, ls, and pwd, then move on to file management, searching, and automation with aliases. The more comfortable you become using the terminal, the faster you will finish tasks that would feel tedious if done through a graphical interface. Invest time in learning the terminal — it will pay off many times over throughout your career.