pwd
Browse / Ubuntu Linux Essentials Cheatsheet
Ubuntu Linux Essentials Cheatsheet
A quick reference guide to essential commands and concepts for navigating and managing Ubuntu Linux systems.
Basics & File System
Basic Commands
|
Print working directory (current location). |
|
List directory contents. Options: |
|
Change directory. Examples: |
|
Create a new directory. |
|
Remove/delete a file. Options: |
|
Copy files or directories. Example: |
|
Move or rename files/directories. |
|
Create an empty file or update timestamp. |
|
Display the manual page for a command. |
File Viewing & Editing
|
Concatenate and display file content. |
|
View file content page by page (scrollable). |
|
Display the first 10 lines of a file. Option: |
|
Display the last 10 lines of a file. Option: |
|
Search for lines matching a pattern in a file. Example: |
|
Open file in the Nano text editor (simple). |
|
Open file in the Vim text editor (powerful, complex). |
|
Display text. Example: |
Permissions (chmod)
|
Change file permissions. |
Permissions Structure |
Represented as |
Symbolic Notation |
|
Symbolic Examples |
|
Octal Notation |
Each permission type has a value: |
Octal Values per Entity |
|
Octal Examples |
|
Recursive Change |
Use Example: |
Package Management (APT)
Updating & Upgrading
Fetches the list of available packages from the repositories and updates the package information database. Run this before installing or upgrading. |
|
Installs the newest versions of all packages currently installed on the system from the sources enumerated in |
|
Performs the same function as |
|
Removes packages that were automatically installed to satisfy dependencies for other packages and are no longer needed. |
|
Removes old downloaded package files from the |
|
Best Practice |
Always run |
Installing & Removing
|
Install a new package and its dependencies. Example: |
|
Install multiple packages at once. |
|
Remove a package (leaves configuration files). |
|
Remove a package and its configuration files. |
|
Install a package from a .deb file (doesn’t handle dependencies automatically). |
|
Attempt to correct a system with broken dependencies. |
Searching & Information
|
Search for packages containing the keyword. |
|
Display detailed information about a package (version, dependencies, size, description, etc.). |
|
List all installed packages. |
|
List all packages that have available updates. |
|
List all files installed by a specific package. |
|
Find which package a file belongs to. |
Users & Processes
User and Group Management
|
Display the current effective username. |
|
Display user and group information for a given user. |
|
Create a new user (interactive process). |
|
Delete a user (leaves home directory and mail spool). |
|
Delete a user and their home directory/mail spool. |
|
Add an existing user to an existing group. Example: |
|
Create a new group. |
|
Change file owner and group. Example: |
|
Change file group. |
Process Management
|
Display information about running processes. Options: |
|
Display dynamic real-time view of running processes (press |
|
Interactive process viewer (more user-friendly than |
|
Send a signal (default is TERM, 15) to a process to terminate it gracefully. |
|
Send a KILL signal (9) to forcefully terminate a process (use as a last resort). |
|
Kill processes by name. Example: |
|
Find process IDs by name. Example: |
|
List jobs running in the background or stopped in the current shell session. |
|
Bring a background job to the foreground. |
Running Commands as Another User (sudo)
Execute a command with root privileges. Example: |
|
|
Start an interactive root shell. |
|
Start a shell as the superuser, but with the current user’s environment variables. |
|
Switch to the root user’s environment (similar to |
|
Edit the |
Adding User to sudo Group |
Users in the Command: (Requires logging out and back in or starting a new shell session to take effect). |
Networking & System Info
Network Commands
|
Display network interface information (IP addresses, MAC addresses). Alternative (older): |
|
Display the IP routing table. Alternative (older): |
|
Send ICMP ECHO_REQUEST to network hosts (test connectivity). |
|
Print the route packets take to a network host. |
|
Display active network connections, listening ports, and associated processes. Options: |
|
Faster alternative to |
|
Secure Shell: Connect to a remote server. Example: |
|
Secure Copy: Copy files securely over SSH. Examples: |
System Information
|
Print all system information (kernel name, hostname, kernel release, kernel version, hardware, OS). |
|
Display LSB (Linux Standard Base) and distribution-specific information (Ubuntu version). Example: |
|
Report file system disk space usage in human-readable format. |
|
Estimate file space usage (summary, human-readable). Example: |
|
Display amount of free and used memory in the system in human-readable format. |
|
Show how long the system has been running, number of users, and load averages. |
|
Print or set the system date and time. |
|
Display the system’s hostname. |
System Control (systemd)
|
Show the status of a systemd service (running, stopped, etc.). Example: |
|
Start a service. |
|
Stop a service. |
|
Restart a service. |
|
Enable a service to start automatically at boot. |
|
Disable a service from starting automatically at boot. |
|
Reload configuration files for a service (if supported). |
|
List all loaded service units. |