Modifying Indentation in Vim

Indentation settings are crucial for maintaining consistent and readable code. In Vim, you can easily modify indentation preferences using various commands. Here’s a breakdown of your provided commands and their effects:

Converting Tabs to Spaces

To replace tabs with spaces, follow these steps:

Working With Background Processes in Linux Bash

In Linux, you can manage processes in the background using various commands and keyboard shortcuts. This article will walk you through how to list, stop, start, and bring background processes to the foreground, as well as how to kill running processes.

Listing Processes

To list the processes running on your system, you can use the ps command. Here’s the basic syntax:

Timing Shell Commands in Bash

When working in a Unix-like environment, timing the execution of shell commands is a useful way to measure the performance of various operations. Bash provides a couple of approaches for timing shell commands: using the /usr/bin/time command or setting the TIMEFORMAT variable.

Using /usr/bin/time Command

The /usr/bin/time command is a versatile utility that can provide information about the resources used by a process, including the execution time. To time a command using /usr/bin/time, you can use the following syntax:

Unanttended Upgrade Docker

To configure unattended upgrades for Docker on a Debian-based system, you can add the following line to the 50unattended-upgrades file. This will ensure that Docker packages are automatically updated when unattended-upgrades runs.

Here are the steps to do this:

  1. Open a terminal on your Debian-based system.

  2. Use a text editor to open the 50unattended-upgrades file for editing. You’ll typically find this file in the /etc/apt/apt.conf.d/ directory.

1
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
  1. Add the following line to the file, which specifies that Docker packages should be automatically upgraded:
1
2
3
4
5
Unattended-Upgrade::Allowed-Origins {
    "${distro_id}:${distro_codename}-security";
    "${distro_id}:${distro_codename}-updates";
    "Docker:${distro_codename}";
};

This configuration tells unattended-upgrades to include the Docker repository for automatic updates, in addition to the security and regular updates repositories for your distribution.

Removing Orphaned Packages on Debian/Ubuntu With Deborphan

When you install and remove packages on a Debian-based Linux distribution like Debian or Ubuntu, sometimes you end up with orphaned packages - packages that were installed as dependencies for other software but are no longer needed. These orphaned packages can take up disk space and clutter your system. One tool that can help you identify and remove these orphaned packages is Deborphan.

What is Deborphan?

Deborphan is a command-line tool for identifying and removing orphaned packages on Debian-based systems. It analyzes the package dependencies and checks which packages are no longer required by any other installed packages. Once it identifies these orphaned packages, you can choose to remove them, freeing up disk space and keeping your system clean.

Enabling Root as Default User in WSL on Windows 10

If you want to set the default user in Windows Subsystem for Linux (WSL) to “root” instead of your regular user, you can achieve this using PowerShell or by modifying the WSL configuration file. Please note that running WSL as the root user is generally not recommended for security reasons, as it can expose your system to potential risks. Proceed with caution and only if you have a valid reason for doing so.

0%