LinuxGetting StartedBasic Commands

Basic Linux Commands

Learn the essential Linux commands for file management, process control, and system administration.

Basic Linux Commands

This guide covers the most commonly used Linux commands that you'll need to work effectively with the system.

File and Directory Commands

pwd     # Print working directory
cd      # Change directory
ls      # List directory contents

File Operations

cp      # Copy files and directories
mv      # Move or rename files
rm      # Remove files
mkdir   # Create directories
rmdir   # Remove empty directories

File Viewing

cat     # Display file contents
less    # View file contents with pagination
head    # Display first few lines
tail    # Display last few lines

Process Management

Process Commands

ps      # List processes
top     # Display system processes
kill    # Terminate processes

System Information

uname   # Display system information
df      # Show disk space usage
free    # Display memory usage

User Management

User Commands

whoami  # Display current user
su      # Switch user
sudo    # Execute command as superuser

File Permissions

chmod   # Change file permissions
chown   # Change file owner

Network Commands

Network Operations

ping    # Test network connectivity
ifconfig # Display network interface information
netstat # Show network statistics

Text Processing

Text Commands

grep    # Search text patterns
sed     # Stream editor
awk     # Pattern scanning and processing

Package Management

Package Commands

apt     # Advanced Package Tool (Debian/Ubuntu)
yum     # Yellowdog Updater Modified (RHEL/CentOS)

Best Practices

  1. Use Tab Completion: Press Tab to auto-complete commands and paths
  2. Check Manual Pages: Use man command to view detailed documentation
  3. Use Wildcards: * and ? for pattern matching
  4. Combine Commands: Use pipes (|) and redirection (>, >>)
  5. Keep Commands Simple: Use the principle of least privilege

Common Command Options

Most Linux commands support these common options:

  • -h or --help: Display help information
  • -v or --version: Show version information
  • -r or -R: Recursive operation
  • -f or --force: Force operation without confirmation
  • -i or --interactive: Interactive mode

Next Steps

Continue learning about:

  • Advanced command combinations
  • Shell scripting
  • System administration
  • Network configuration
  • Security best practices