Working with the Linux operating system is a key skill in modern web development, server management, and automation. While most users are familiar with graphical user interfaces, the real power of Linux resides in the command line (terminal). In this article, we will cover the most essential and frequently used commands for system navigation and file management.
Navigating the File System
To work effectively in the terminal, we need to know our current location within the file system and how to move between directories.
| Command | Meaning | Usage Description |
|---|---|---|
| pwd | Print Working Directory | Displays the full path of the current directory. |
| ls | List | Lists all files and directories in the current folder. |
| cd | Change Directory | Navigates to the specified directory (e.g., cd /var/www). |
Working with Files and Directories
The command line allows us to quickly create, copy, move, and delete files and directories.
- mkdir: Creates a new directory (e.g.,
mkdir my_projects). - touch: Creates an empty file or updates timestamps (e.g.,
touch index.php). - cp: Copies a file or directory to another location (e.g.,
cp script.sh /tmp/). - mv: Moves or renames a file/directory (e.g.,
mv old.txt new.txt). - rm: Removes a file. To delete an entire directory with its contents, use
rm -rf folder_name.
Example of Using Basic Commands in Terminal
The example below demonstrates a practical sequence of commands to set up a web project folder structure via terminal.
# 1. Print current location pwd # Output: /home/user # 2. Create a new directory for the website and enter it mkdir web_project cd web_project # 3. Create project files touch index.php style.css script.js # 4. View created files with detailed listing ls -la
Why These Commands Matter for Developers
Mastering basic terminal commands allows you to efficiently manage web servers (e.g., via SSH), configure deployment environments, and automate tasks using shell scripts—an essential set of skills for modern IT professionals.