How to find a path of a Linux command like a pro
One of the most common questions I get is how can I find a Linux
command path that I just installed on Linux using a package manager such
as apt/dnf command. We have many new developers coming from the Windows
world. Many are first-time Linux users. Some are using Linux from WSL,
and others are directly dealing with cloud servers over ssh. Let us see
some common commands to list or find a path for Linux commands.
How to switch boot target to text or GUI in systemd Linux
Most modern Linux distro uses systemd as init replacement. It is a
suite of basic building blocks for Linux distros such as RHEL/CentOS
& co, OpenSUSE/SUSE, Fedora, Arch, Debian, Ubuntu, and more. By
default, most distro boot into GUI, but you can change to text or vice
versa.
How to upgrade Debian 10 to Debian 11 Bullseye using the CLI
I have Debian 10.10 installed on the AWS EC2 and Linode server. How do I
upgrade Debian 10 Buster to Debian 11 Bullseye using the apt command or
apt-get command safely? How can I upgrade Debian 10 to Debian 11 using
ssh client?
How to disable core dumps in Linux including systemd
Core dumps created for diagnosing and debugging errors in Linux apps.
They are also known as memory dump, crash dump, system dump, or ABEND
dump. However, core dumps may contain sensitive info—for example,
passwords, user data such as PAN, SSN, or encryption keys. Hence, we
must disable them on production Linux servers.
How to define multiple when conditions in Ansible
Sometimes we need to evaluate multiple when conditions in Ansible
playbooks. Let us see how to define multiple when conditions in Ansible
for a single task.
How to repeat a character 'n' times in Bash
Let us say you want to repeat a character such as '-' OR '=' multiple
times while writing bash script. Please note that I needed a quick
script to work on Linux, macOS, and FreeBSD server to repeat a
string/character n times.
How to convert man page to HTML on Linux and Unix
We can easily convert all Linux man pages to HTML, text, or pdf format.
To display online manual documentation pages in terminal on Linux,
macOS, *BSD, and Unix-like systems, we use the man command. However,
some man pages are long and might be hard to search when using less or
most as a pager. Hence, we can convert them to HTML format and skimmed
them in a web browser such as Firefox.
How to see what packages updates available on Alpine Linux
On Debian or Ubuntu Linux, one can run ‘apt list --upgradable‘ command
to see and list available package updates. On RHEL, we can use ‘dnf
check-update‘ to list available updates on screen. However, the apk
command does not have an option to show and list available security
software updates. But fear not. Some other tricks can list, and you can
see what packages updates are available on Alpine Linux using the apk
command.
How to find the number of RAM Slots in Linux
Sometimes Linux sysadmins or developers need to determine the number of
RAM slots on their servers or desktop/laptop without opening the case.
Then, it is helpful to upgrade or install new RAM. Let us see how to
find the number of RAM slots and supported max memory on Linux using
command-line options.
How to find and replace ALL IP addresses with a new one
At a certain point, I needed to change the VLAN IP address such as
172.0.0.2 with 172.0.0.1 for ease of use. As you know, Linux and
Unix-like operating system stores all IP addresses and config in plain
text files. This page explains my little adventure where I had to find
and find and replace ALL IP addresses with a new one on Linux.
What Does ‐‐ (double dash) Mean In SSH Shell Command?
This page explains the use of the double-dash ('‐‐') in Linux, macOS,
and Unix shell commands. For example: lxc exec container ‐‐ sh -c 'apt
update && apt -y upgrade'. First, let us see what it does and
when we might need it.
Cut command in Linux with examples
The Unix or Linux cut command is an extremely useful tool for filtering
information. Here is a brief overview for new Linux, macOS, *BSD and
Unix users.
Linux help command examples and syntax
You can use the help command to display help about built-in Bash
commands. A shell builtin is nothing but a command or a function, called
from a shell, that is executed directly in the shell itself.
How To: Linux Find Large Files in a Directory
There is no single command that can be used to list all large files.
But, with the help of find command command and shell pipes, you can
easily list all large files. This page explains how to find the largest
files and directories in Linux using various commands.
nixCraft Patreon supporters content: No ads. No tracking. Exclusive in-depth guides about Linux, Unix, *BSD, and other IT topics for nixCraft Patreon supporters:
How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
All Linux and Unix servers are managed manually or by automation tools
such as Ansible using ssh. For example, say you have a server at Linode
or AWS. Then you copy your public ssh key to a remote cloud server. Once
copied, you can now login to those servers without a password as long
as ssh keys are matched. It is the best practice. Unfortunately, you are
not protecting ssh keys stored on a local desktop or dev machine at
$HOME/.ssh/ directory. If your keys are stolen, an attacker can get
access to all of your cloud servers, including backup servers. To avoid
this mess, we can protect our ssh keys stored on local dev/desktop
machines using physical security keys such as YubiKey.