Linux Command Line Essentials

Work confidently in a Linux terminal: move around the file system, manage files, permissions, software and processes, analyse text with pipes, write shell scripts and work on remote machines over SSH.

Beginner · Cloud & DevOps · about 9 hours · 4 modules · certificate on completion

Taught by Ismaìlè Rahimovì, Mouhamadouù Bâ, AI Learning Companions.

About this course

Servers, containers, cloud machines and the computers that train AI models nearly all run Linux, and the people who build and run them work in its terminal. This course teaches the command line from the first prompt, on your own Linux system. You'll find your way around the file system and organise files; control who can read, change and run them; install software and keep an eye on running processes; and combine small tools such as grep, sort, uniq, cut, wc, sed and awk with pipes to answer real questions about a web server's log, including spotting someone probing for a login page. Then you'll put commands into Bash scripts that check their input and report errors properly, and run them on a remote machine over SSH, with key pairs instead of passwords. Every lesson shows the commands step by step, and every module ends with a lab on sample files that come with the course, with the exact output a correct answer prints.

What you'll learn

  • Navigate the Linux file system and create, copy, move, find and delete files with confidence
  • Set file permissions and ownership, use sudo safely and install software with apt
  • Monitor and control processes and background jobs
  • Combine grep, sort, uniq, cut, wc, sed and awk with pipes to answer questions about logs and data
  • Write Bash scripts with arguments, checks, loops and exit statuses
  • Connect to and work on remote machines with SSH keys, and copy files securely

Skills you'll gain

Linux, Bash, File system navigation, File permissions, Process management, Text processing, Package management, Shell scripting, SSH

Tools

Bash, Linux

Before you start

No Linux experience needed. You need a Linux system where you can install software: Ubuntu on WSL (Windows Subsystem for Linux) on Windows, an Ubuntu virtual machine (for example in VirtualBox), or a cloud server. The labs assume Ubuntu or Debian, which use apt; other distributions work with small changes.

Modules

  1. Find your way around the shell

    Meet the terminal and the shell, move around the Linux file system, and create, copy, move, find and delete files and directories.

    • The shell, the terminal and commands (10 min)
    • Navigating the file system (10 min)
    • Working with files and directories (12 min)
    • Hands-on lab: Organise a project folder
  2. Permissions, software and processes

    Control who can read, change and run files, use administrator rights safely to install software with apt, and watch, pause and stop running processes.

    • Owners and permissions (12 min)
    • Administrator rights and installing software (10 min)
    • Processes and jobs (12 min)
    • Hands-on lab: Lock down files and manage processes
  3. Pipes and text tools

    Redirect input and output, chain small tools with pipes, and search, sort, count and reshape text with grep, sort, uniq, cut, wc, sed and awk.

    • Redirection and pipes (12 min)
    • Searching, sorting and counting (12 min)
    • Editing streams with sed and awk (12 min)
    • Hands-on lab: Analyse a web server log
  4. Shell scripts and SSH

    Turn commands into Bash scripts that take arguments, make decisions, loop and report errors properly, then run them on remote machines over SSH with key pairs.

    • Your first shell scripts (12 min)
    • Decisions, loops and functions (12 min)
    • Remote machines with SSH (12 min)
    • Hands-on lab: Script a log report and run it over SSH

Project: Automate a server log report

You look after a small web server and want a daily summary of its logs without typing the same pipelines every morning. Write a Bash script, daily-report.sh, that takes a directory of access logs and writes one report per log into a reports directory: the number of requests and visitors, the three busiest visitors and most requested pages, the count of each status code, and a 'suspicious requests' section listing the IP addresses that asked for pages such as /wp-login.php or /admin and got 403 or 404 responses. The script must check its arguments, cope with a missing directory, an empty directory and an empty log with clear messages and sensible exit statuses, use functions, quote its variables and pass shellcheck. Then run it on a remote machine over SSH with key login and copy the reports back with scp or rsync. As a stretch, add a crontab line that would run it every morning.

Part of

The products this course names are trademarks of their owners, who haven't made or endorsed it.

Start the course free