Empowering you to understand your world

Debian Commands: A Cheat Sheet With Examples

glow in the dark keyboard
Photo by seppe machielsen on Pexels.com

This article provides a list of useful Debian commands with examples that you can use for your daily activities. Whether you are a system administrator or a home desktop/laptop user, it’s helpful to keep this list of Linux commands handy. Note that these commands may not work with all other Linux distributions. However, many of them will.

Debian Commands To Install Apps

‘sudo’ is to provide the administrative privileges required to make changes to your system.

You can install apps on Debian using the APT package management system’s commands shown below. Example usage:

sudo apt install nameofapp

You can uninstall or remove an app from Debian using the ‘apt remove’ command as shown below. Example usage:

sudo apt remove appname

You can do a more thorough app removal, including its configuration files you can use APT’s purge command. Example usage:

sudo apt remove --purge appname

Debian Commands To Edit Files

If you need to edit configuration files, which is a common need for a Debian installation without a GUI (example: a server), you can start by trying to launch the Nano text editor since it usually comes with Debian. Press Ctrl + O to save the file, and Ctrl + X to close Nano and return to the command prompt. Example usage:

nano filename.txt

You can also quickly view files without launching a text editor using the ‘less’ command. Press ‘Q’ to return to your command prompt. Example usage:

less filename.txt

You can view the last line of a log file in real time using the tail command. Every time the log file changes, it will show the updated last line so you can monitor it without running the command or opening the file repeatedly. Example usage:

sudo tail -f var/log/syslog

How To Find A File On Debian

You can find a file on Debian at the command line using ‘locate’. You may have to install it first using the following commands:

sudo apt install locate

sudo updatedb

Example using of the ‘locate’ command. It will return the path to the file afterwards if it found it:

locate filename.txt
Subscribe to our newsletter
Get notified when new content is published