Install Default Tools & Utilities on Debian 12

These essential programs are a must-have for any Linux user, providing a range of powerful utilities and tools to enhance your system’s capabilities and streamline your workflow. By installing these packages using the ‘sudo apt install’ command, you can seamlessly integrate your Linux system into various network environments, efficiently transfer data with URLs, visualize directory structures, search for files quickly, monitor system processes and resource usage, and gain real-time insights into system performance. This blog provides a glimpse into the functionalities and benefits of these programs, offering you a comprehensive toolkit to enhance your Linux experience.

sudo apt install cifs-utils \
                 nfs-common \
                 curl \
                 tree \
                 locate \
                 htop \
                 dstat

Package: cifs-utils

cifs-utils is a package of utilities and tools used to manage and work with the Common Internet File System (CIFS), which is also known as the Server Message Block (SMB) protocol. CIFS/SMB is a network file sharing protocol that allows computers to share files, printers, and other resources over a local network or the internet.

The cifs-utils package typically includes several command-line tools that facilitate various operations related to working with Windows or Samba file shares. Some of the common utilities included in cifs-utils are:

  1. mount.cifs: This command is used to mount CIFS/SMB shares from remote servers onto a local directory within a Linux file system. It allows Linux systems to access and use files and directories located on Windows or Samba servers as if they were local files.
  2. umount.cifs: This command is used to unmount (dismount) previously mounted CIFS/SMB shares, freeing up the local directory for other use.
  3. smbclient: This is a versatile command-line tool that provides an interactive shell for working with remote CIFS/SMB servers. It allows you to list directories, browse files, upload and download files, and perform various file and directory operations.
  4. smbpasswd: This utility is used to manage the Samba password database. It can be used to change passwords for users who access Samba shares on a Linux server.
  5. cifscreds: This utility allows you to manage and store credentials (such as usernames and passwords) required to access CIFS/SMB shares. It can be used to securely store and retrieve authentication information.
  6. nmblookup: This command is used to query NetBIOS name servers and retrieve information about network devices and services.

The cifs-utils package is particularly useful for integrating Linux systems into mixed network environments where Windows or Samba servers are used for file sharing. It provides the necessary tools to connect, manage, and interact with CIFS/SMB shares from a Linux command-line interface.

Package: nfs-common

nfs-common is a package of utilities and tools used for working with the Network File System (NFS) on Linux-based systems. NFS is a protocol that allows file sharing and remote access to files over a network. It’s commonly used in Unix-like environments to enable seamless access to files and directories located on remote servers as if they were local.

The nfs-common package provides a set of command-line tools and libraries that enable Linux systems to mount and interact with NFS shares. Some of the utilities included in the nfs-common package are:

  1. mount.nfs: This command is used to mount NFS shares from remote servers onto local directories within the Linux file system. It allows Linux systems to access remote files and directories as if they were part of the local file system.
  2. umount.nfs: This command is used to unmount (dismount) previously mounted NFS shares, freeing up the local directory for other use.
  3. showmount: This utility is used to query an NFS server to retrieve information about the exported file systems (shares) it provides. It lists the remote directories that are available for mounting on client systems.
  4. rpcinfo: This command provides information about the RPC (Remote Procedure Call) services available on a remote server. NFS relies on RPC for communication between clients and servers.
  5. nfsstat: This utility provides various statistics and information about the status of NFS operations and interactions on the local system.
  6. Libraries: The nfs-common package also includes libraries that facilitate communication with NFS servers, making it easier for developers to incorporate NFS functionality into their applications.

By installing the nfs-common package on a Linux system, you enable the system to interact with NFS shares on remote servers. This is particularly useful for scenarios where you need to access and manipulate files and directories located on other systems within a network.

Package: curl

curl stands for “Client URL”. It is a command-line tool and a library used for transferring data with URLs. It supports a wide range of protocols, including HTTP, HTTPS, FTP, FTPS, SCP, SFTP, LDAP, and more.

In its most basic usage, you can use curl to make HTTP requests to fetch data from a URL. For example, you can use it to download files, retrieve web pages, or interact with APIs. Here’s a simple example of using curl to fetch the content of a web page:

curl https://www.example.com

curl is highly customizable and supports a variety of options and parameters that allow you to control the request headers, request methods, authentication, data uploading, and more. It’s widely used by developers, system administrators, and researchers to interact with web services, perform network-related tasks, and automate various tasks that involve making HTTP requests.

Here’s an example of using curl to perform a POST request with some data:

curl -X POST -d "key=value" https://api.example.com/data

The above command sends a POST request with the data “key=value” to the specified URL.

In addition to the command-line tool, curl is also available as a library that can be integrated into various programming languages to enable making HTTP requests programmatically.

Package: tree

tree refers to a command-line utility and graphical representation used to display the hierarchical structure of directories and files on a file system. It provides a visual representation of the folder structure, showing how subdirectories and files are organized within a specific directory.

The tree command is typically used in a terminal or command prompt to generate a textual representation of the directory tree. When executed, it lists all the subdirectories and files within the specified directory, along with their respective nested subdirectories. Each level of indentation represents a deeper level of nesting within the directory structure.

For example, if you run the following command:

tree /path/to/directory

It will output a representation of the directory structure like this:

/path/to/directory
├── subdirectory1
│   ├── file1.txt
│   ├── file2.txt
│   └── ...
├── subdirectory2
│   ├── file3.txt
│   └── ...
└── file4.txt

This output shows the hierarchy of directories and files under the specified directory.

The tree command is available on many Unix-like operating systems, including Linux and macOS. It’s useful for quickly visualizing the organization of files and folders, especially in complex directory structures. Additionally, there are variations of tree that provide options for customizing the output format and filtering the displayed items.

Package: locate

The locate command is a Unix-like command-line utility used to quickly search for files and directories on a system based on a pre-built index of file names. It is much faster than using the find command, which searches the file system in real-time. The speed advantage of locate comes from the fact that it doesn’t search the file system directly; instead, it relies on a database (often named locatedb or mlocate.db) that contains information about the files and their paths.

Here’s how the locate command works:

  1. Indexing: Periodically, the system updates the locatedb database to include information about the files and directories on the system. This process is usually done by a system cron job and ensures that the index is up-to-date.
  2. Searching: When you use the locate command, it searches the pre-built index in the locatedb database rather than traversing the actual file system. This makes searching for files extremely fast.

Usage of the locate command is simple. Just provide a search term or a partial name of the file or directory you are looking for, and locate will output a list of matching paths:

locate filename

For example, if you want to find all files named “example.txt,” you would use:

locate example.txt

Keep in mind that because locate relies on an index, it might not show the most recent files or changes that have been made since the last database update. If you’re looking for real-time results or need to search for files based on specific criteria, the find command might be more suitable.

To use locate, the mlocate package (or a similar package depending on the distribution) needs to be installed on your system. You can usually install it using your system’s package manager.

Package: htop

htop is a command-line utility that provides an interactive and dynamic view of system processes and resource utilization on Unix-like operating systems, including Linux. It is an enhanced alternative to the traditional top command, offering a more user-friendly and visually informative interface.

Here are some features and functionalities of htop:

  1. Interactive Interface: htop provides an interactive terminal-based interface that allows you to navigate and interact with process information using keyboard shortcuts.
  2. Colorful Display: The display of htop is color-coded, making it easier to distinguish different types of processes and resource usage. Different colors are used for user processes, system processes, kernel threads, etc.
  3. Process Information: htop displays a list of processes running on the system, including details like process ID (PID), user, CPU usage, memory usage, uptime, and more.
  4. Resource Usage Monitoring: It provides real-time monitoring of CPU usage, memory usage, swap usage, and other system resources. These usage values are updated dynamically.
  5. Process Control: You can perform process-related actions directly from htop, such as sending signals (e.g., kill, terminate), changing process priorities, and more.
  6. Sorting and Filtering: htop allows you to sort processes by various criteria, such as CPU usage, memory usage, and more. You can also filter processes based on a search term.
  7. Graphs and Bars: The utility includes graphical representations like bars and graphs to help visualize resource utilization and trends.

To use htop, simply open a terminal and enter the following command:

htop

htop is widely used by system administrators, developers, and power users to monitor and manage system resources in a more user-friendly and efficient way compared to the traditional top command.

Package: dstat

dstat is a versatile and powerful command-line utility for Linux that provides real-time monitoring of various system resources and performance metrics. It allows users to gather and display a wide range of information about system behavior and resource usage in a single view. dstat is particularly useful for diagnosing performance bottlenecks, tracking system health, and identifying resource utilization trends.

Here are some of the key features and functionalities of dstat:

  1. Real-time Monitoring: dstat provides real-time updates, allowing you to see the current state of system resources as they change.
  2. Customizable Output: You can choose which metrics to display and customize the output format to show the information that is most relevant to your needs.
  3. Wide Range of Metrics: dstat can display a variety of metrics, including CPU usage, memory usage, disk I/O, network activity, system load, process statistics, swap usage, interrupts, and more.
  4. Combining Metrics: You can combine multiple metrics into a single output to get a comprehensive view of the system’s behavior. For example, you can monitor CPU usage alongside disk I/O and network activity.
  5. Plugins and Extensions: dstat supports plugins that allow you to extend its capabilities by adding new metrics or functionality.
  6. CSV Output: It can generate comma-separated values (CSV) output, which makes it easy to log and analyze performance data over time.

To use dstat, simply open a terminal and run the following command:

dstat

By default, dstat displays a wide range of metrics in a tabular format. You can use various command-line options to customize the output, select specific metrics, adjust the update interval, and more. For example:

  • To specify a custom update interval (in seconds):
dstat -c -d -n -m --output report.csv 5
  • To display only specific metrics, such as CPU, memory, disk I/O, and network:
dstat -c -d -n -m
  • To see available options and metrics:
dstat --help

dstat is a valuable tool for administrators, system analysts, and performance tuners who need to gain insights into system behavior and resource usage in real-time.