GNU time is a really handy utility available in the repositories of every Linux distribution: we can use it to retrieve information about the “real”, “user”, and “system” execution times of a command, and, more generally, to check the amount of system resources used by it.
bash
How to use bash array in a shell script
In this tutorial, we will see how to use Bash arrays and perform fundamental operations on them. Bash, the Bourne Again Shell
, is the default shell on practically all major Linux distributions: it is really powerful and can also be considered as a programming language, although not as sophisticated or feature-reach as Python or other “proper” languages. Furthermore, Bash scripting is a must-have skill for any Linux system administration job.
Exit code 127 error status in Bash script
Are you receiving a exit code 127
error when trying to execute a Bash script? This means that your Linux system was not able to find the command referenced inside of the script, which could indicate that the path to the command is not valid, or the command is not installed at all. In this tutorial, we’ll explain what causes this “command not found” error and show you how to fix it.
How to check kernel version on Raspberry Pi
Every Linux system – including all Raspberry Pi models with Raspberry Pi OS installed – is running a Linux kernel, which serves as the foundation for a fully packaged operating system. As technology evolves, the Linux kernel receives updates to accommodate new hardware, features, and security patches. These updates grant the Raspberry Pi new abilities, or patch out problems that get reported and fixed with newer kernel versions.
How to autostart Bash script on startup on Raspberry Pi
Many users want their Raspberry Pi to perform tasks unattended, as part of automating the Raspberry Pi. This cuts down on repetitive tasks that usually fall on the administrator’s lap. A common way to trigger automatic events is when the Raspberry Pi first boots up. Such a configuration allows us to start a Bash script automatically every time the Raspberry Pi first boots up.
How to use xargs to build command lines from standard input
Even the most basic installation of any Linux distribution comes with a set of really useful utilities: “xargs” is undoubtedly one of those. By using xargs we can build and execute command lines using items from standard input as arguments of a command. This is especially useful when dealing with programs which don’t read standard input directly.
How to embed documentation in Bash scripts
Documenting how an application works, its purpose, and its intended usage is really important, even if it is just a simple shell script we are talking about. To ease code maintenance in the most basic cases, documentation can be embed directly inside scripts. In this tutorial we learn how to include Pearl’s Plain Old Documentation syntax (POD) in bash scripts, and how to convert it to various formats using pod2 utilities such as pod2man and pod2html.
Linux EOF explained
An EOF (end of file) condition is used to indicate the end of a file or data stream. It is a marker that tells the operating system it has reached the end of the data which it is reading. A Linux system utilizes an EOF marker whenever it is reading data, and users can also manually specify an EOF with various Linux commands like cat
. In this tutorial, we will explain EOF in Linux and see examples of how to utilize it ourselves via the Heredoc function in Bash.
How to use xclip on Linux
The xclip tool can be used to interact with the system clipboard from the command line. This can come in handy in instances where you want to send information directly to the user’s clipboard, without requiring that they highlight and copy the text themselves. It also works in the other direction, so the xclip
command can check the contents of the clipboard.
Creating a Bootable USB for Windows 10 and 11 on Linux
Creating a bootable USB drive is often necessary when you want to install or repair an operating system. This guide provides detailed steps on how to create a bootable USB drive for Windows 10 or 11 using Linux (both Debian and RPM-based distributions).
Our handy script does all the heavy lifting, making this task a breeze. The script operates by formatting the USB drive, and then copying the ISO file to the USB drive.
Linux hard link vs. soft link
Soft links and hard links are the two types of links that can be created on a Linux system. Without realizing it, you have undoubtedly interacted with tons of hard links on your own system. And, most likely, you have encountered some soft links (also called symbolic links or symlinks), too. That is because the files you work with on your system every day are either hard links or soft links that point to data on your hard drive. What we usually think of as a “file” is actually an inode that points to a data block on our hard drive, and the hard link is how we interact with it.
How to check command version on Linux
When working with various Linux commands, you may be wondering what version of the command you are using. Of course, the version relates to the binary executable file itself, and traditionally is maintained by the system package manager, which is responsible for checking on updated versions and installing them at the user’s discretion. Commands in Linux typically undergo slow, subtle changes. Some commands have not changed much at all since the 70s, when they were introduced on Unix. Others have new versions developed regularly, and you need to check your version to know which features it has. In this tutorial, you will learn how to check the version of a command on a Linux system.