less – View file one screen at a time. head and tail – View the first/last lines of a file. Exercise: Navigate to /tmp and create a directory named practice. Create a file example.txt inside practice. Copy example.txt to backup_example.txt. Delete the example.txt file.
----------------------------------------- Part 2: User and Permission Management Commands:
User Management
whoami – Show the current user.
id – Display user ID and groups. passwd – Change user password.
Permissions
ls -l – View file permissions.
chmod – Change file permissions. Example: chmod 755 script.sh chown – Change file ownership. Example: chown user:group file.txt Exercise: Check your current username using whoami. Create a file and change its permissions to make it executable by everyone. ----------------------------------------------- Part 3: Process Control Commands:
ps – View running processes.
Example: ps aux top or htop – Monitor system processes in real-time. kill – Stop a process. Example: kill <PID> (Get PID from ps or top). Exercise: Run a command (e.g., sleep 300) in the background using &. Identify the process ID using ps and terminate it with kill.
---------------------------------------------------------- Part 4: System Monitoring
df -h – View disk usage.
du -sh <directory> – View directory size. free -h – View memory usage. uptime – Check how long the system has been running. Exercise: Check how much disk space is available on the system. Find the size of the /var/log directory. Monitor memory usage with free.