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

today's howtos

  • So this is why Deepin requires so much disk space for installation – LinuxBSDos.com

    Deepin is a desktop Linux distribution with roots in China. It is based on Debian, but ships with its own graphical interface called Deepin Desktop Environment and a set of Deepin-developed tools to go with it. The last version I installed was from 2015, so since I’m gradually coming back to writing for this blog, I decided to test drive the latest edition – Deepin 20.3, which was released on Nov. 25. For me that means installing it in a virtual environment using VirtualBox. For such installations I typically assign the virtual disk 20GB of disk space. And so it was with Deepin 20.3. But that didn’t end well because at some point the installation failed, with the message shown in Figure 2: “You need at least 64 GB of disk space to install Deepin. To get better performance, 128 GB.”

  • 13 exercises to boost your Linux skills | Enable Sysadmin

    Work through this Linux fundamentals checklist to make sure you're ready for whatever comes your way at home, at work, or on certification exams.

  • BASH 01 - Script Basics | Linux.org

    This article is the first in a series of articles to cover Bash Scripting. More articles will follow which will build on each other, so make sure you look over each article. It is preferable to read the articles in order (which is why I will number them). Scripting is a very useful ability for someone using Linux. Making scripts is especially useful for Administrators. Everyone should benefit from Bash Scripting. Bash is the most common shell interpreter on Linux systems. When you open a Terminal, you are in an interactive shell environment. To verify that your system is using the Bash shell using the command: 'echo "$SHELL"'.

  • What’s the Difference Between Exposing and Publishing a Docker Port? – CloudSavvy IT

    Exposed and Published container ports are two different but related concepts in Docker. Exposed ports are defined in your Dockerfile as simple metadata. You must publish them when your container starts if you want to enable outside access.

  • How to set up high-refresh rate monitors on Linux

    Do you have a high refresh rate monitor? Are you running Linux? Can’t quite figure out how to change the refresh rate? We can help! Follow along with this guide as we go over how to change the refresh rate on popular Linux desktop environments!

  • How to Install pgAdmin 4 on CentOS 8 – NextGenTips

    In this tutorial guide, I will be taking through the installation of pgAdmin 4 version 6.2 on CentOS 8 pgAdmin 4 is a free and open-source management tool for Postgres. Its desktop runtime written in NWjs allows it to run standalone for individual users, or the web applications code may be directly deployed on a web server for use by the web browser. pgAdmin 4 is a complete rewrite of pgAdmin, built using Python and Java.

  • How to Update to MATE Desktop 1.26 on Ubuntu 21.04

    Ubuntu MATE is a more retrospective version of Ubuntu, one that largely lets you continue using Ubuntu in the way it functioned over a decade ago. But despite how things may look, updates do continue to roll out for the MATE desktop environment that is Ubuntu MATE's namesake. The latest iteration is MATE 1.26. Here's how you can update the MATE desktop in Ubuntu 21.04 to the latest version.

  • How to Change a Users Shell in Linux - Unixcop the Unix / Linux the admins deams

    In this tutorial, we will show you how to change the shell of a user in Linux. The shell is a program that accepts and interprets commands. there are several shells such as bash, sh, ksh, zsh, fish and many other lesser known shells available on Linux. Bash is a Unix shell and command language for the GNU Project as a free software replacement for the Bourne shell. First released in 1989,it has been used as the default login shell for most Linux distributions.

  • How to use shutdown command with examples - Unixcop the Unix / Linux the admins deams

    “Shutdown” refers to the process of stopping and shutting down a computer or server. This involves cutting the power to the main components of the system using a controlled process. Applications are closed, active processes and protocols are saved to the hard drive, device drivers are removed, and user settings are saved in the process. There are several options to do so, including scheduling a shutdown at a specific time, shutting down immediately, broadcasting a unique message, and so on.

  • How to Install MySQL Database on Ubuntu 20.04 | RoseHosting

    MySQL is an open-source relational database management system (RDBMS), it’s widely used and part of the popular LAMP/LEMP stacks. The data is organized in one or more tables in which the data types may be related to each other and MySQL uses SQL Structured Query Language to manage its data. Considering its part of the LAMP/LEMP stack it is used by many database-driven web applications such as WordPress, Magento, Drupal, and Joomla. Today we will install MySQL on our server and create a database and user with chosen permissions on this database, let’s get started!

  • How to install deepin 20.3 - Invidious

    In this video, I am going to show how to install deepin 20.3

Dockeye - New Graphical App to Manage Docker Containers / Images in Linux

Running applications via Docker in Ubuntu Linux? Dockeye is a free open-source tool to manage your containers and images via a graphical user interface. Dockeye is written in Rust programming language. It provides a dark UI (light mode is also available) that list Docker containers and images in tabs. For each container, it provides options to control start, stop, pause, and remove operations. User may also check the detailed information about a container, including ID, image, maintainer, labels, environment, network info, CPU, Memory and other system resource usage. And, app running log is available in tab for debugging purpose. Read more

Raspberry Pi CM4-based panel PC offers DAQ inputs and M.2 NVMe

Sensoper’s 7-inch “SC-PC” HMI panel PC runs Linux on a Raspberry Pi CM4 and supplies GbE, M.2 for NVMe, RS-485, 3x USB, 8x digital inputs, 7x transistor outputs, and 8x analog inputs with a choice of 0-10V or 4-20mA ranges. Michigan-based Sensoper Controls has launched a 7-inch, industrial panel-PC in two variants: an SC-PC-AV8-TO7 model with 8x 0-10V analog inputs and an SC-PC-AM8-TO7 with 4-20mA analog inputs. The otherwise identical panel PCs run Raspbian (Raspberry Pi OS) Linux with pre-installed Node-RED on the Raspberry Pi Compute Module 4. Read more

Android Leftovers