LFCS: Essential Commands (20%)

This document covers essential Linux commands for Git, services, system performance, application constraints, disk troubleshooting, and SSL management.


Goals

Essential Commands 20%


1. Basic Git Operations

Learn

Commands

# Clone repository
git clone <url>

# Check status
git status

# Add files and commit
git add <file>
git commit -m "message"

# Push to remote
git push origin main

# Pull latest changes
git pull

Exercises

  1. Clone a public repository.
  2. Make a change, commit it, and push to a forked repo.

2. Create, Configure, Troubleshoot Services

Learn

Commands

# Start, stop, restart service
sudo systemctl start <service>
sudo systemctl stop <service>
sudo systemctl restart <service>

# Enable/disable at boot
sudo systemctl enable <service>
sudo systemctl disable <service>

# Check logs
journalctl -u <service>

Exercises

  1. Enable and start a service.
  2. Check the last 20 lines of the service log.

3. Monitor & Troubleshoot System Performance

Learn

Commands

# CPU and memory
top
htop
vmstat 2 5

# Disk usage
df -h
du -sh /path/to/dir

# Check running processes
ps aux | sort -nk 3 | tail -10

Exercises

  1. Identify top 5 processes consuming CPU.
  2. Check disk usage of /var/log.

4. Application & Service Constraints

Learn

Commands

# Check limits
ulimit -a

# Set temporary limit
ulimit -n 4096

# Persistent limits
sudo nano /etc/security/limits.conf
# user soft nofile 4096
# user hard nofile 8192

Exercises

  1. Increase the open file limit for a user temporarily.
  2. Make the change permanent.

5. Troubleshoot Diskspace Issues

Learn

Commands

# Find large directories
du -ah / | sort -rh | head -20

# Remove old logs
sudo journalctl --vacuum-time=7d

Exercises

  1. Identify top 10 largest files.
  2. Clear old logs to free space.

6. Work with SSL Certificates

Learn

Commands

# Generate self-signed certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt

# Verify certificate
openssl x509 -in server.crt -text -noout

# Check SSL connection
openssl s_client -connect example.com:443

Exercises

  1. Generate a self-signed certificate.
  2. Inspect and verify the certificate using OpenSSL.

Exam Tips



Revision #2
Created 2025-11-07 10:38:07 UTC by Loïc
Updated 2025-11-07 14:24:08 UTC by Loïc