Learn Linux: The Terminal and Your First Commands in the CLI World
What Is the Terminal and Why Do Engineers Use It?
The terminal (also called the shell or command line) is a text-based interface to your operating system. Instead of clicking buttons, you type commands that execute immediately.
In industrial environments, the terminal is essential. Factory servers and edge devices often run headless Linux with no graphical interface. When a SCADA server goes down at 2 AM, the engineer who can SSH in and diagnose the problem is the one who gets the plant running again.
Advantages over graphical tools:
- Speed: Renaming 500 sensor log files takes one command, not 500 clicks.
- Remote access: SSH into any server from anywhere in the world.
- Automation: Any command you type can be saved in a script and run automatically.
- Reliability: The terminal works even when the GUI crashes or is unavailable.
This lesson is the first in a 10-part series that will take you from basic commands to building a complete industrial monitoring server on Linux.
Opening the Terminal and the Command Line Anatomy
On Ubuntu Desktop, press Ctrl+Alt+T to open a terminal window. On a server, you connect remotely via SSH:
ssh operator@192.168.1.50
You see a prompt like operator@factory-srv:~$ which tells you four things:
operator-- the current userfactory-srv-- the hostname of the machine~-- the current directory (~ means home)$-- regular user (# means root)
A command follows this structure:
command -options arguments
For example: ls -la /var/log runs ls with long format (-l) and hidden files (-a) on the directory /var/log.
Navigating Directories: pwd, cd, and ls
Every Linux system organizes files in a directory tree starting from / (the root directory). Three commands let you move through this tree efficiently.
pwd # Print current location
cd /var/log # Go to absolute path
cd sensors # Enter a subdirectory
cd .. # Go up one level
cd ~ # Go to home directory
cd - # Go to previous directory
ls # List files
ls -l # Long format: permissions, owner, size, date
ls -la # Include hidden files
ls -lh # Human-readable sizes (KB, MB, GB)
ls -lt # Sort by modification time, newest first
On a factory server, ls -lt /var/log/ quickly shows you the most recently updated log files -- always the first place to look when troubleshooting an issue.
Viewing File Contents: cat, less, head, and tail
cat /etc/hostname # Display entire file (good for short files)
less /var/log/syslog # Scroll large files (arrows to move, q to quit)
head -n 20 sensor_data.csv # First 20 lines
tail -n 50 sensor_data.csv # Last 50 lines
tail -f /var/log/modbus.log # Follow file in real time
In less, press /pattern to search forward and n to find the next match.
The tail -f command is invaluable in industrial settings. It streams new lines as they are written, letting you watch Modbus communication or sensor readings live.
Getting Help: man and --help
man ls # Full manual page (q to exit)
man chmod
ls --help # Quick summary of options
grep --help
apropos network # Search manual descriptions for a keyword
apropos "serial port"
Manual pages are organized into sections: NAME, SYNOPSIS, DESCRIPTION, OPTIONS, and EXAMPLES. Press q to exit. Use --help for quick reminders and apropos when you do not know which command to use.
Practical Example: Exploring an Industrial Server's Files
You have just SSH'd into a factory server for the first time. Let us explore and understand what is running:
pwd # /home/operator
ls / # See top-level directories
cat /etc/hostname # factory-line-03
cat /etc/os-release | head -n 4 # Check the OS version
ls -lt /var/log/ | head -n 10 # Most recent logs
ls -la /opt/scada/ # SCADA application directory
tail -f /var/log/modbus-gateway.log # Watch Modbus log live
This sequence -- connect, orient yourself, check logs -- is the standard first response when diagnosing an issue on any industrial Linux server. You will use this pattern throughout your career.
Summary
The terminal is the primary interface for managing industrial Linux systems. In this lesson you learned:
- The terminal provides speed, remote access, automation, and reliability -- advantages that graphical tools cannot match.
- The prompt shows your user, hostname, directory, and privilege level.
pwd,cd, andlslet you navigate the directory tree.cat,less,head, andtaillet you read files of any size.tail -fstreams log files in real time -- invaluable for live monitoring.man,--help, andaproposprovide documentation for any command.- On a factory server, the first steps are always: orient, check logs, investigate.
In the next lesson, you will learn to create, copy, move, and delete files and directories -- essential skills for organizing sensor data and configuration files.