lsb_release -a
Displays Linux distribution details like name, version, and codename.
Useful for quickly identifying the Ubuntu release.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 25.10
Release: 25.10
Codename: questing
/etc/os-release
Shows official OS metadata stored in a standard config file.
Most reliable source for scripts and system checks.
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 25.10"
NAME="Ubuntu"
VERSION_ID="25.10"
VERSION="25.10 (Questing Quokka)"
VERSION_CODENAME=questing
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=questing
LOGO=ubuntu-logo
hostnamectl
Displays hostname, OS, kernel, architecture, and virtualization info.
Used to inspect machine identity and environment.
lscpu
Provides a summarized view of CPU architecture and cores.
Best high-level CPU inspection command.
cat /proc/cpuinfo
Shows detailed per-core CPU information from the kernel.
Useful for low-level debugging and feature detection.
uptime
Shows how long the system has been running.
Also displays current load averages.
printenv
Lists all environment variables for the current session.
Used to debug shell and application behavior.
File & Directory Navigation
pwd — Show the current working directory
Prints the full path of your current working directory.
Useful to confirm where you are in the filesystem.
ls — List files and directories
Lists files and directories in the current location.
Options like -l show details, -a shows hidden files.
cd — Change directory
Changes the current directory.
Use .. to go up, ~ to jump to home.
tree — Display directory structure as a tree (install first)
Displays directories in a hierarchical tree view.
Helpful for visualizing project structure.
File & Directory Management
touch — Create an empty file
Creates an empty file or updates timestamp.
Often used to quickly create placeholder files.
mkdir — Create a directory
Creates a new directory.
Supports nested creation with -p.
rmdir — Delete an empty directory
Deletes an empty directory only.
Fails if the directory contains files.
rm — Remove files or directories
Deletes files or directories permanently.
-r removes directories recursively—use carefully.
cp — Copy files or directories
Copies files or directories from source to destination.
-r is required for directories.
mv — Move or rename files
Moves or renames files and directories.
Also used to relocate files across paths.
Viewing & Reading Files
cat — Display file contents
Prints the entire file content to terminal.
Best for small files.
less — View file page by page
Views file content page by page.
Supports scrolling and search.
head — View first lines of a file
Shows the first few lines of a file.
Useful for checking file headers.
tail — View last lines of a file
Shows the last few lines of a file.
-f follows live updates (logs).
whoami — Show current user
Displays the current logged-in user.
Helps verify permissions and identity.
uname -a — Show system information
Shows kernel and system architecture info.
Useful for debugging OS-level issues.
df -h — Show disk usage
Displays disk usage in human-readable format.
Helps track storage availability.
free -h — Show memory usage
Shows RAM and swap usage.
Essential for monitoring memory pressure.
Package Management (Ubuntu-specific)
sudo — Run command as administrator
Runs commands with administrator privileges.
Required for system-level changes.
apt update — Update package list
Refreshes package index from repositories.
Should be run before installing software.
apt install — Install software
Installs packages from Ubuntu repositories.
Automatically resolves dependencies.
apt remove — Remove software
Uninstalls installed packages.
Does not remove config files unless specified.
Searching & Help
find — Search for files
Searches files and directories by name or conditions.
Powerful for large directory trees.
grep — Search text inside files
Searches text patterns inside files.
Widely used for log analysis.
man — View command manual
Displays the official manual for a command.
Primary source of truth for CLI tools.