Bash
-
Bash fc Command : Easily Wield the Bash Shell Like a Pro
Have you ever run a command in Bash and got an error because of a misspelled word? Or perhaps you forgot the last three commands you ran? Instead of re-writing or remembering previous commands, the Bash fc command can help make quick edits and re-execute previous commands. In this article, you will learn how to leverage fc to edit and re-execute commands from your command history. After reading this guide, you’ll be wielding fc like the command line warrior you…
-
Learn Multi-Threading Bash scripts with GNU Parallel
If you’re tired of your Bash scripts taking forever to run, this tutorial is for you. Often, you can Bash scripts in parallel, which can dramatically speed up the result. How? Using the GNU Parallel utility, also just called Parallel, with some handy GNU Parallel examples! Parallel executes Bash scripts in parallel via a concept called multi-threading. This utility allows you to run different jobs per CPU instead of only one, cutting down on time to run a script. In…
-
How to Rename Files in Linux
Are you new to the Linux operating system? If so, common tasks such as renaming files and folders may be different than what you are used to. But don’t fret. The concept of renaming files in Linux is similar to how it’s done in other operating systems. In this tutorial, you’ll learn many ways to rename single and multiple files in Linux, both via GUI and running commands in a terminal. Let’s get started! Prerequisites To follow along within this…
-
Using Bash Sort to Sort Files Like a Boss
Are you looking out for a way to organize your files and perform some operations on them? There are many instances in programming where you need to sort some data, such as a list of files. Sorting files with the Bash sort and ls commands will help you keep things organized. In this tutorial, you will learn the fundamentals of sorting files and file contents. Let’s get sorting! Prerequisites This tutorial uses Ubuntu 20.04, but any Linux distribution will work.…
-
How to Update Ubuntu IP and Hostname via Bash
There are several ways to manage your Ubuntu computer’s IP address and hostname. System admins have the nmcli, netplan, hostname, and hostnamectl tools at their disposal. While these tools do a fine job on their own, how can you include these tools to up your automation game? You can create a Bash script that will handle the configuration for you. In this article, you will learn how to set a new hostname and configure IP address information, all with a…
-
Learning Bash File Test Operators With Examples
Bash is incredibly flexible and offers various options for testing files. And if you’re looking for a way to test your files, the Bash file test operators will take you places. In this tutorial, you’ll learn different file test operators and how to use them to test whether a file exists, is readable, is empty, and so on. Read on and befriend the Bash file test operators! Prerequisites This tutorial will be a hands-on demonstration. If you’d like to follow…
-
Echo Command in Bash Shell : Discover the Many Uses
As an admin, you may regularly run the echo command in Bash when managing a Linux system. But is printing texts all the echo command can offer? In this tutorial, you will take a closer look at the echo command and learn some of its most useful practical examples. Ready? Stay tuned and reshape your idea of the echo command! Prerequisite This tutorial comprises hands-on demonstrations. To follow along, you only need an Ubuntu machine. This tutorial uses Ubuntu 20.04,…
-
Understanding Bash If Else and other Conditional Statements
Writing a Bourne Again Shell (Bash) script can be a rewarding experience, especially when you add logic to it, ensuring its robustness. One way to incorporate this logic, making your script smarter, is through the use of conditional statements, specifically ‘bash if else’. In this deep dive, you’re about to grasp the power and nuances of the Bash if-else and case statements. This will aid you in crafting error-free, intelligent Bash scripts. We’ll also sprinkle in some best practices to…