While Bash does not explicitly support a set collection type, it can still perform set operations. We look at a few ways to achieve this with Bash and other Linux tools.
Also find me here:
Baeldung Editor
Ashley Frieze
I've been writing software since I was a kid, and have been doing it professionally since the days of dial-up internet. These days I'm a consultant, helping teams with full stack cloud projects in Java and TypeScript. When I'm not software engineering, I can be found performing as a stand-up comedian, or in musical theater.
Here's what I've reviewed (so far):
Baeldung on Linux
- All
- Files (16)
- Administration (15)
- Scripting (14)
- Processes (9)
- Installation (7)
- Filesystems (7)
- Security (5)
- Networking (4)
- File Viewing (3)
- File Editing (3)
- Search (2)
- Docker (2)
- Web (1)
- File Searching (1)
- File Permissions (1)
- File Conversion (1)
- File Compression (1)
- Building (1)
How to Configure Two-Finger Scrolling in Linux
Filed under Administration
Linux supports gestures such as two-finger scrolling. We look at how to configure this with xinput as well as the GUI.
Exploring GNU Gold Linker
Filed under Building
The gold linker is a faster alternative to the default linker in Linux. We look at its history, how to use it, and how it performs.
How to Compare Two Files With the Same Content but on Different Lines
Filed under Files
We look at how to compare files where the content may be in different orders, be it plaintext or structured formats such as XML or JSON.
How to Use an Android Tablet as a Second Display on Linux
Filed under Administration
We can use an Android tablet as a second display with our Linux desktop. We look at how to set this up.
Comparing Strings Using the diff Command
Filed under Scripting
Sometimes in Linux, we wish to compare text. We look at a few ways we can use the diff command to do this.
How to Get the Monitor Resolution in Linux
Filed under Administration
Explore how to find the current resolution of our attached monitors, or their supported resolutions.
How to Edit Spreadsheets Inside the Terminal
Filed under File Editing
Learn about spreadsheet editors available within a terminal and accessible via ssh.
Linux CLI Chat Over LAN
Filed under Administration, Networking
Learn how to create a simple Linux chat over the network using netcat and talk
Checking Whether Automatic Updates Are Enabled on Debian/Ubuntu
Filed under Administration, Security
Our Linux package manager may be able to keep our system up to date automatically. We look at how to enable this across a few common package managers.
How to Run poweroff and reboot as a Normal User
Filed under Administration
We may wish to provide non administrator users of our Linux systems with the permissions to power off and restart the host. We look at a few ways to achieve this.
How to Display Non-kernel Processes Using ps
Filed under Processes
Learn how to use the ps command to display only the non-kernel processes on our Linux system.
How to Create /dev/null
Filed under Administration
Accidentally deleting the system path /dev/null can cause us issues. We look at how to restore this path and what it's used for.
Copying Hidden Files Recursively
When copying files, we may wish to include hidden files in our archive. We look at a few ways to achieve this.
How to Setup Default YUM Repositories in RHEL
Filed under Installation
YUM helps us install packages in Red Hat Enterprise Linux. We look at how to set up the repositories that YUM uses.
Is Disabling SSL V3 a Solution for Poodle?
Filed under Security
We learn how a POODLE downgrade attack works and how to prevent it by disabling out-of-date versions of SSL.
The Default Sorting Order of the find Command
When listing files on the filesystem we may wish to apply different sort orders. We look at how to sort the output of the find command.
How to Unlock /var/lib/dpkg/ Directory?
Filed under Filesystems, Installation
When using the apt or dpkg installer we may encounter a lock error if an installation is running, or has been interrupted. We look at how to resolve this issue.
What Is DBus Practically Useful For?
Filed under Processes
DBus allows different processes to interoperate in Linux, regardless of language. We look at how it works and how it allows parts of the Linux GUI to communicate.
How to Remove and Disable Snap
Filed under Installation
The snap package manager may impose limitations on how certain software is installed. We can disable it from our system if needed. We look at how to do this.
Hiding the Output of expect
Filed under Scripting
When scripting tools that expect user input, we can use expect to replace terminal input. Learn how to suppress logging this information.
Install Dependencies Using dpkg, apt and gdebi
Filed under Installation
Sometimes, when we install a package, its dependencies are not installed automatically or may be missing. We look at how to install a package and its dependencies with some common Linux package managers.
How to Add an IP to a Hostname File
Filed under Administration, Networking
Sometimes we need to provide a mapping between host names and IP addresses. This can supplement DNS lookup or enable us to match a new hostname we’ve assigned. We look at how to use the hosts file.
How to Remove the Timeout From GRUB Menu
Filed under Administration
When using the GRUB boot loader, we may wish to reconfigure the timeout to make it easier to select the right boot option. We look at how this can be achieved.
Extracting Frames From a Video Using FFmpeg
Filed under Scripting
FFmpeg is the most common Linux tool for manipulating video files. We look at how to use it for frame extraction.
What Are the Differences Between Snap and Apt Package Management System?
Filed under Installation
APT and Snap are package managers we can use with Linux. We look at how they work and how they handle packages differently.
How to Change Desktop Wallpaper from the Terminal
Filed under Administration
We may wish to change our desktop wallpaper from the command line. We look at how to do this for some common Linux desktop environments.
How to Compile Code from Vim
Filed under Scripting
If we’re using vim as our code editor, then we may wish to compile files without dropping out to the command line. We look at how vim supports executing commands such as make.
Why Was 1 January 1970 Used as the Epoch Time?
Filed under Processes
1st January 1970 is known as the epoch time in Unix. It’s where all system clocks hit zero. We look at why this is the case and some alternatives that were considered.
Deleting Files Based on Their Sizes
Filed under Files
Learn how to delete files based on size using the find command.
How to Clear Word Highlighting in Vim
Filed under File Viewing
We can search for text within vim and see highlighting for all occurrences. We look at a few ways to clear this highlight.
Turning Off Buffer in Pipe With stdbuf
Filed under Processes
There is a buffer between piped processes on Linux. We look at how it works and how to reconfigure it.
Why Is There a Delay After Entering a Wrong Password at Login?
Filed under Security
For security reasons, Linux will delay before completing a login or sudo with an incorrect password. We look at why this is the case, and how to configure it.
Comparing Directory Structure Without Comparing Files
Filed under Files
We may wish to check similarities or differences between two directory structures, but Linux doesn’t support this directly. We look at a few tools that can help us.
PC Speaker Beep in Linux
Filed under Scripting
There are several ways to make sound from a shell. We look at a variety of tools that can be used to play everything from a beep to a full song.
How to Fix Docker’s No Space Left on Device Error
Filed under Docker
We look at ways to clean up unused resources and move Docker storage in order to avoid storage capacity errors.
How to Clear Logs in Linux
Filed under Administration
Learn how to can clear logs and configure the system not to keep them around for too long.
Continuously Sync Files One-Way on Linux
Filed under Files
Explore a few tools for a regular or real-time backup of parts of our Linux filesystem.
Configuration of Temporary Files with systemd-tmpfiles
Filed under Files, Filesystems
We can configure temporary files in Linux in a few different ways. Here, we look at how to make some common configurations.
How to Find the File System Type in Linux
Filed under Filesystems
Linux supports multiple file systems. We look at how to find out which file system is in use by a given device. We also explore loop devices, which can be used to try out different types of file system.
Is the /boot Partition Always Necessary?
Filed under Filesystems
The /boot partition can be found in some Linux systems. We discuss what the partition is, whether it is necessary, and when we might need it.
Analyze Disk Usage of a Docker Container
Filed under Docker, Filesystems
A Docker container mixes file system elements from images, volumes and its own read-write layers. We look at a few commands to help understand which space is taken by our Docker containers, and where it comes from.
Using Vim as a Diff Tool
Filed under File Viewing
vim
can be a useful tool for reviewing the differences between files in Linux. We look at how to use it, how it compares with diff, and how to integrate it with git.
How to Add Public Key to known_hosts File
Filed under Administration, Security
When we connect to a new host via SSH, we’re prompted to check its identity. We look at how to do this in advance of making an SSH connection in order to check hosts before using them, and to prevent scripts stalling at the prompt.
Where Are sudo Incidents Reported?
Filed under Administration
Learn how to find logs of failed sudo attempts.
How to Completely Remove a Package in Linux
Filed under Administration
Depending on how it was installed, there are a few ways to uninstall a Linux application and its files. We look at how to do this via package managers and manually.
The socat Command in Linux
Filed under Networking
The socat command can be used to relay input and output from one location to another. It can allow us to bridge between our terminal and a remote process, or to tunnel through our private networks. We look at how to use this command with a few use cases.
Resume Copying Files in Linux
Filed under Files
Copying files between Linux machines can get interrupted. SCP is not usually able to resume a stalled copy. We look at some alternatives for file copying and how to kick start SCP.
Convert Tab-Delimited File to CSV
Filed under File Conversion
We can convert files between different delimited formats using tools readily available in our Linux distros. We look at how to convert to CSV format using tr, awk, and sed.
Using grep While Excluding Binary Files
Filed under File Searching
When searching through our files using grep we may need to exclude binary files. We explore an example of how to do this and how grep works in this case.
Redirecting the Output of the time Command
Filed under Scripting
As the time command does not output to stdout, redirecting its output to a file is a little more complex than other commands. We look at a few ways to capture the output if this command in scripts.
View the Output of a Running Process in Another Bash Session
Filed under Processes
Sometimes we need to run a process in the background and check in on its progress from another Bash terminal. We look at a number of ways to monitor the output of a process.
Find Files Lacking Certain Permissions
Filed under Files
While the find command can help us find files by types and permissions they possess, sometimes we need to look for files which are missing certain permissions. We look at how to achieve this in a couple of different ways.
How Do I Use mktemp?
Filed under Files
The mktemp command can help us create a temporary file or directory in the correct location on a Linux system. We look at how it works and some tips for using it.
Automatically Capture Output of the Last Command Into a Variable Using Bash
Filed under Scripting
Let’s look at a few techniques for storing command output in variables in bash.
Compress Files Using Data from stdin
Filed under File Compression
We do not have to have something in a file to be able to compress it. We look at how to use the major compression tools with input from stdin, allowing us to compress the output of processes that are producing data.
Counting Hard Links Towards File Size With the du Command
Filed under Filesystems
We can use the du command to find the size of files and directories, but this behaves unexpectedly when we have hard links. We look at how to resolve this issue and why it behaves this way.
Flow Control in Bash Without Goto
Filed under Scripting
Bash provides several ways to manage flow control in a script, but it does not natively provide a goto statement. We look at how to simulate goto and how to use the other built in flow control techniques
Difference Between Resident Set Size and Virtual Memory Size
Filed under Processes
We sometimes need to check how much memory is consumed by processes in our system. We look at the meaning of resident set size and virtual memory size, and how to find out how much is in use.
Check if a Library Is 32-Bit or 64-Bit
Filed under Files
Our Linux distro may contain a mixture of 32 and 64 bit libraries. We can find out the architecture the library was built for by using a couple of commands. We explore how to do this for static and shared libraries.
Remove All Whitespace Characters From a Text File
Filed under File Editing
Find the Total Size of All Files in a Directory
Filed under Filesystems
We may sometimes wish to calculate the size of directories in our filesystem. We explore how to use the du command to achieve some common use cases.
Exclude grep From ps Results
Filed under Processes
When we use grep to filter the results of ps, it often finds itself as well as the desired process. We discover a couple of tricks to avoid this happening.
How to Create a crontab Through a Script
Filed under Scripting
We can script the addition of entries into the user and system crontab. We look at a few ways to achieve this to help with building installations.
fd: An Alternative to the Linux find Command
Filed under Files
fd
is a fast and easy to use alternative to the conventional find command. We explore some of the ways to use it.
Read the Source Code of Shell Commands
Filed under Processes
Learn how to find the source code for the common Linux tools.
Limiting Process Resource Consumption in Unix
Filed under Processes
Linux provides several ways to constrain the resources used by a process. We look at a few techniques for controlling the CPU, RAM and disk space that a process can access.
The Use of Swap Space in Modern Linux Systems
Filed under Installation
Swap space is useful even when a Linux system has more than enough RAM for all its tasks. Here we dig deeper into swap space and why using it can be preferable to keeping everything in RAM for most installations.
Fastest Method to Check If Two Files Have the Same Contents
Filed under Files
There are a few ways to tell whether we have duplicate files on our Linux filesystem. We explore a few options and compare their performance.
How to Evaluate Arithmetic Expressions in Bash
Filed under Scripting
We often need to perform numeric calculations in our bash scripts. We look at a few ways to execute these calculations inside and outside of the shell itself.
Guide to the Linux screen Command
Filed under Administration
Working with multiple terminals on Linux can get hard to manage, especially setting up the connections each time. The screen utility solves that for us.
How to Reverse the Order of Lines in a File in Linux
Filed under File Editing, Scripting
There are a few ways we can reverse the output of a file, or command. Here we look at some of the common methods and compare their performance.
ifconfig Command in Linux
Filed under Networking
Linux provides the ifconfig tool to help us review and modify the settings and state of network interfaces. We explore some common use cases.
Installing the AWS CLI on Linux
Filed under Installation
The AWS CLI allows us to control our AWS account from the command line. Here we look at how easy it is to install on our Linux system.
Transfer Files Between Linux Machines Over SSH
Filed under Files
We can securely copy data between machines using scp and rsync, which operate over a secure connection. We explore the tools’ similarities and differences.
Recursively Deleting Files With a Specific Extension
Filed under Files
Linux allows us to clean up files by deleting recursively from the current directory. Here we look at the commands and how to use them safely.
Renaming Linux Files in Batches
Filed under Files
Depending on the Linux distro and use case, there are a few available tools that can rename a batch of files. We explore some common use cases.
Differences Between more, less, and most in Linux
Filed under File Viewing
Linux provides several tools for scrolling through the contents of text files. We compare their capabilities and demonstrate the most common ways to use them.
Setting Permissions with chown and chmod
Filed under File Permissions, Security
Linux file permissions are determined by who owns the file and the visibility of that file to various users. Discover chmod and chown for configuring this.
Linux Commands Comparison: curl vs wget
Filed under Web
We can download and upload with both the linux curl and wget tools. In this tutorial we look at which tool is best suited for each type of task.
Linux Commands – Delete Files Older Than X
Tidying up files on our servers by age can be achieved with a simple command. We discuss find on Linux and how to avoid it going wrong.