Language Selection

English French German Italian Portuguese Spanish

New bash programming articles

Filed under
Development
  • How to use bash aliases

    Most of the users like to use shortcuts for running commands. There are many commands in Ubuntu that we need to execute regularly. It will be very helpful for us if we can run those common commands by typing shortcut commands. Using bash aliases, Ubuntu users can easily create shortcut commands of the large commands those are used frequently. Bash aliases not only make the task easier but also save the time of the users. The user can declare alias temporary or permanently. The temporary aliases can be used as long as the session of the user exists. If the user wants to use shortcut commands every time the session starts, then he or she has to create permanent alias by using ~/.bashrc and ~/.bash_profile files. This tutorial shows how you can create and use bash aliases in Ubuntu by using some examples.

  • Bash Arithmetic Operation

    Using bash aliases, Ubuntu users can easily create shortcut commands of the large commands those are used frequently. Bash aliases not only make the task easier but also save the time of the users. The user can declare alias temporary or permanently. How to use bash aliases is explained in this article.

  • How to use arrays in Bash

    When you want to use multiple data using a single variable in any programming language, you have to use array variables. The list of data can be assigned and used using an array variable. Bash is a weakly typed language that does not require defining any data type for declaring the variable. Array declaration in bash is a little bit different from other standard programming languages. Two types of the array can be declared in bash. Numeric array and associative array. If the index of an array is numeric, then it is called a numeric array, and if the index of an array is a string, it is called an associative array. How you can declare a numeric array, associative array, and iterate elements of the array using for loop are described with examples in this tutorial.

  • Bash Head and Tail Command

    Many types of commands are available in bash to show the content of a file. Most commonly used commands are ‘cat’, ‘more’, ‘less’, ‘head’ and ‘tail‘ commands. To read the entire file, ‘cat’, ‘more’, and ‘less‘ commands are used. But when the specific part of the file is required to read then ‘head‘ and ‘tail‘ commands are used to do that task.

    ‘head‘ command is used to read the file from the beginning and the ‘tail‘ command is used to read the file from the ending. How you can use ‘head‘ and ‘tail‘ commands with different options to read the particular portion of a file is shown in this tutorial.

    You can use any existing file or create any new file to test the functions of ‘head‘ and ‘tail‘ commands. Create two text files named products.txt and employee.txt with the following content to show the use of ‘head‘ and ‘tail‘ commands.

  • Bash Range

    You can iterate the sequence of numbers in bash in two ways. One is by using the seq command, and another is by specifying the range in for loop. In the seq command, the sequence starts from one, the number increments by one in each step, and print each number in each line up to the upper limit by default. If the number starts from the upper limit, then it decrements by one in each step. Normally, all numbers are interpreted as a floating-point, but if the sequence starts from an integer, the decimal integers will print. If the seq command can execute successfully, then it returns 0; otherwise, it returns any non-zero number. You can also iterate the sequence of numbers using for loop with range. Both seq command and for loop with range are shown in this tutorial by using examples.

  • Bash Script User Input

    In the seq command, the sequence starts from one, the number increments by one in each step, and print each number in each line up to the upper limit by default. If the seq command can execute successfully, then it returns 0; otherwise, it returns any non-zero number. Two ways to generate the sequence of numbers are shown with examples in this article.

  • BASH while loop examples

    Three types of loops are used in bash programming. While loop is one of them. Like other loops, a while loop is used to do repetitive tasks. This article shows how you can use a while loop in a bash script by using different examples.

Bash Wildcard

  • Bash Wildcard

    When we need to search for anything using shell commands then we need to define a pattern for searching. Wildcard characters are used to define the pattern for searching or matching text on string data in the bash shell. Another common use of wildcard characters is to create regular expressions. How you can use different types of wildcard characters for searching files is shown in this tutorial.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

More in Tux Machines

Windows box won't boot? SystemRescue 9 may help

The latest version of an old friend of the jobbing support bod has delivered a new kernel to help with fixing Microsoft's finest. It used to be called the System Rescue CD, but who uses CDs any more? Enter SystemRescue, an ISO image that you can burn, or just drop onto your Ventoy USB key, and which may help you to fix a borked Windows box. Or a borked Linux box, come to that. SystemRescue 9 includes Linux kernel 5.15 and a minimal Xfce 4.16 desktop (which isn't loaded by default). There is a modest selection of GUI tools: Firefox, VNC and RDP clients and servers, and various connectivity tools – SSH, FTP, IRC. There's also some security-related stuff such as Yubikey setup, KeePass, token management, and so on. The main course is a bunch of the usual Linux tools for partitioning, formatting, copying, and imaging disks. You can check SMART status, mount LVM volumes, rsync files, and other handy stuff. Usefully, there's also a full local copy of the website and all documentation, including a console-mode web browser to read it with. Read more

GNOME Shell ’Extensions Manager’ App Gets a Big Ol’ Update

Remember that new app for installing GNOME extensions I wrote about earlier this month? Well, it just got its first major update. And it adds a ton of much-requested features. For those unfamiliar with it, Extension Manager is a desktop app that lets you search, browse, manage, and install GNOME extensions without having to use a web browser. The app is built in GTK4 and libadwaita and is available to install from Flathub. Read more

today's howtos

  • Hosting my static sites with nginx

    Originally I thought that running my own servers would require a lot of maintenance and be a huge pain, but I was chatting with Wesley about what kind of maintainance their servers require, and they convinced me that it might not be that bad. So I decided to try out moving all my static sites to a $5/month server to see what it was like. Everything in here is pretty standard but I wanted to write down what I did anyway because there are a surprising number of decisions and I like to see what choices other people make.

  • How To Install Wireshark on Debian 11 - idroot

    In this tutorial, we will show you how to install Wireshark on Debian 11. For those of you who didn’t know, Wireshark is a free and open source software (FOSS) allows users to easily capture and analyze packets. In real scenarios Wireshark was useful to detect anomalies in network traffic. Wireshark can be also used to sniff traffic. Wireshark is a cross-platform software that is available for various Linux/UNIX distributions, Mac-OS, Solaris, BSD & Windows, etc. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of the Wireshark network protocol analyzer on a Debian 11 (Bullseye).

  • How to Install Python 3.10 (or 3.11) on CentOS - Linux Stans

    In this tutorial, we’re going to show you how to install Python (the latest version) on CentOS with step-by-step instructions. This tutorial includes instructions for Python 3.10 and Python 3.11 on CentOS 7 and CentOS 8.

  • How to Route Traffic to Docker Containers With Traefik Reverse Proxy – CloudSavvy IT

    Traefik is a leading reverse proxy and load balancer for cloud-native operations and containerized workloads. It functions as an edge router that publishes your services to the internet. Traefik routes requests to your containers by matching request attributes such as the domain, URL, and port. The proxy incorporates automatic service discovery so you can add new containers in real-time, without restarting the Traefik service. In this guide, we’ll put together a simple Traefik v2 deployment that will publish multiple Docker containers. This lets you use one Docker installation to provide several services over the same port, such as a web application, API, and administration panel.

  • How to convert Centos 8 Linux to Alma Linux 8

    CentOS Linux 8 was discontinued at the end of 2021. Check out more information about that in this in this article CentOS Linux 8 will end in 2021 and shifts focus to CentOS Stream. The team at CentOS decided to shift focus to CentOS stream, an upstream version of RHEL. CentOS stream places itself between Fedora Linux and RHEL. It is not 100% RHEL clone but ahead of RHEL development. Other distros that are 100% compatible with RHEL 8 have come up including Rocky Linux and Alma Linux. In this guide, we will learn how to convert an existing CentOS 8 distribution into Alma Linux without reinstalling a new operating system. The Alma Linux team provides an automated script for this purpose. An in-place upgrade does not require formatting of hard disk and due to that fact all settings, programs, and files on your current CentOS 8 system will be preserved.

  • LFCS – Creating LDAP on Ubuntu | Linux.org

    I hope you have looked over the previous article to set up OpenLDAP on CentOS 7 system found here. This will build on that article somewhat. We are going to install and configure OpenLDAP on Ubuntu and create an initial database. I did not do some things done here in the previous article, so you may learn something useful here for CentOS or Ubuntu.

Proprietary Software and DRM

  • Best Free and Open Source Alternatives to Atlassian Bitbucket

    Atlassian Corporation Plc is a software company founded in 2002 that develops products for software developers, project managers and other software development teams. It employs over 7,000 people and is headquartered in Sydney, Australia. Atlassian produces a range of proprietary software including software for collaboration, development, and issue tracking software for teams. Atlassian dominates several markets where it still has intense competition. Broadly speaking, they offer software in three large buckets: These are software development tools; help desk software, or IT service management; and workflow management software. When you think of Atlassian, think project management and collaboration tools. Many of their programs use a number of open source components. And their GitHub repositories hold lots of open source code. But their main range of software is proprietary. This series looks at free and open source alternatives to Atlassian’s products.

  • Obsidian is a Notion Alternative for Hardcore Markdown Users for Creating Knowledge Graph of Notes [Ed: Why does a site that calls itself "It's FOSS" so enthusiastically promote non-FOSS? And not the first time, either]

    Initially, I thought that Obsidian was an open source software. It was only when I was looking for their source code repository (after I finished writing this article) that I realized it is free-to-use application but not FOSS (free and open source software). Which is a shame because it’s a damn good application and hence I continued to feature it here.

  • Digital Right to Repair Coalition Letter of Support: SMART

    On behalf of the Digital Right to Repair Coalition (“The Repair Association”), an organization representing over 400 member companies across a variety of industries, I’m writing to ask for your support of consumer choice and right to repair by advancing H.R.3664 – Save Money on Auto Repair Transportation (SMART) Act. The Repair Association is centered around a simple principle: consumers should have the right to repair the products they own. We believe that competition is an essential component of any market, including automotive repairs, and is better for consumers. We are dedicated to fighting against anti-competitive practices that stifle innovation, restrict small businesses, and disadvantage consumers, regardless of industry. Right to repair is a growing, consumers-first movement that is expanding as more people recognize that the law should put consumers first. The growing momentum around repair restrictions for electronics and consumer appliances has spurred companies like Microsoft and Apple to commit to taking action to expand their repair offerings. There’s much more work to be done. According to a new national survey from the CAR Coalition, an overwhelming majority (78%) of vehicle-owning voters support the federal right to repair legislation that protects against design patent abuse in the automotive industry, such as the SMART Act, and makes vehicle data more readily available. The Repair Association believes the SMART Act is an essential step forward in answering consumers’ call for stronger right to repair protections in the automotive repair industry and would serve as an example to other industries.