Basic Linux Commands for Development¶
As a developer, understanding essential Linux commands is crucial. Whether you're managing files, setting up Python environments, or working with directories, these commands will help you get started.
📁 File and Directory Management¶
List Files and Directories¶
List files in the current directory:
Common options: -ls -l : Long format listing - ls -a : Show hidden files Create and Remove Directories¶
Create a new directory:
Remove an empty directory: Remove a non-empty directory:Navigate Between Directories¶
Change directory:
Go up one level: Show current directory:Copy, Move, and Delete Files¶
Copy a file:
Copy a directory: Move or rename a file or directory: Delete a file:🐍 Python and Pip Basics¶
Check Python Version¶
Install pip (Python Package Manager)¶
Debian/Ubuntu:
RedHat/CentOS:Manage Python Packages¶
Install a package:
List installed packages: Uninstall a package:🏗️ Virtual Environments¶
Virtual environments isolate your project's dependencies from the global Python environment. This helps avoid conflicts and makes collaboration easier.
Using venv (Python 3.3+)¶
Create a virtual environment:
Activate it: Install dependencies: Deactivate when done:Using virtualenv (Alternative)¶
Install virtualenv:
Create a virtual environment: Activate: Deactivate:Tip: Use a requirements.txt file to share dependencies:
More on Python virtual environments
🔒 File Permissions and Ownership¶
Change File Permissions¶
Make a file executable:
Set specific permissions:Change File Ownership¶
Change owner and group:
📦 Package Management (Debian/Ubuntu)¶
Update package lists:
Upgrade installed packages: Install a package: Remove a package:More on apt package management
✅ Wrapping Up¶
These commands are foundational for Linux-based development environments. Whether you're organizing files, managing Python projects, or working with packages, mastering these commands will make your workflow more efficient.
Practice them, and you'll become more comfortable with Linux in no time!