Essential Linux CLI Shortcuts and Debian Package Management

Terminal Interaction and Directory Navigation

Adjusting the terminal font size can be done quickly using Ctrl + Shift + +.

To toggle between the current working directory and the previous one, use cd -. For instance, if you navigate from /var/log to /etc/nginx using cd /etc/nginx, running cd - will instantly return you to /var/log. Executing it again switches back to /etc/nginx.

The !$ expansion retrieves the final argument from the immediately preceding command. This is useful for chaining operations on the same target:

$ mkdir deployment_assets
$ cp config.yaml !$
$ cd !$

If a command fails due to insufficient privileges, prepend sudo to the previous execution without retyping it:

$ systemctl restart nginx
$ sudo !!

File and Directory Operations

Standard filesystem manipulation relies on a core set of utilities. While touch is commonly used to generate empty files, output redirection offers a shorter alternative:

> system_trace.log

Directory and file management commmands include:

# Generate a new directory
mkdir project_workspace

# Remove a single file
rm system_trace.log

# Delete an empty directory
rmdir project_workspace

# Recursively delete a directory and all contents
rm -rf project_workspace

Debian Package Management Essentials

Querying the package repository and managing installed software is primarily handled through the APT suite.

Searching and Inspecting Packages To locate software matching a specific keyword:

apt search database_client

For detailed metadata, including version, architecture, and dependencies:

apt show postgresql-client

To verify wich files an installed package placed on the filesystem:

dpkg -L postgresql-client

Repository Statistics and Filtering Listing every available package and counting them can be achieved by piping the search output:

apt-cache search . | wc -l

Filtering the repository for specific toolchains:

apt-cache search . | grep -i llvm

Core APT Workflow

  • Refresh repository indexes: sudo apt update
  • Apply available upgrades: sudo apt upgrade
  • Upgrade with dependency resolution and package removal if necessary: sudo apt full-upgrade
  • Install single or multiple targets: sudo apt install pkg_a pkg_b
  • Remove binaries but retain configuration: sudo apt remove pkg_a
  • Remove binaries and configuration files: sudo apt purge pkg_a
  • Clean up orphaned dependencies: sudo apt autoremove
  • List installed software: apt list --installed

Analyzing Local DEB Files and Dependencies When working with a downloaded .deb archive rather than a repository package, apt commands will not function. Instead, inspect the archive metadata directly:

dpkg -I ./custom_tool.deb

The required dependencies are listed under the Depends: field.

To identify which installed packages rely on a specific library (reverse dependencies):

apt-rdepends -r libssl3

APT vs APT-GET: Architectural and Usage Differences

apt-get has served as the foundational package manager for Debian-based systems since the late 1990s. It operates at a lower level, focusing on stability and scriptability, making it ideal for automation and backend processes.

The apt command was introduced as a high-level frontend that consolidates the most frequently used features of apt-get and apt-cache. It provides a more streamlined interface, includes a visual progress bar during installations, and formats output for human readability. It became the default recommendation starting with Ubuntu 16.04 and Debian 8.

Command Mapping

Legacy Command Modern Equivalent Purpose
apt-get install apt install Fetch and configure packages
apt-get remove apt remove Uninstall binaries, keep configs
apt-get purge apt purge Uninstall binaries and configs
apt-get upgrade apt upgrade Apply safe updates
apt-get dist-upgrade apt full-upgrade Update with dependency changes
apt-get autoremove apt autoremove Clear unused dependencies
apt-cache search apt search Query repository by keyword
apt-cache show apt show Display package metadata

Operational Gudielines Neither tool is deprecated. apt-get retains granular flags and deterministic output preferred in CI/CD pipelines and shell scripts. apt is optimized for interactive terminal sessions, offering fewer required flags and clearer status indicators. For daily administration, apt reduces cognitive load and typing overhead. For automated provisioning or when parsing command output programmatically, apt-get remains the standard.

Tags: Linux CLI bash apt package-management

Posted on Thu, 11 Jun 2026 18:08:52 +0000 by mickd