Showing headlines posted by xmodulo
( 1 2 3 4 5 6 ... 13 ) Next »How to use indexed arrays in bash
Bash supports one-dimensional indexed arrays, which are essentially ordered lists, where you can access the values by their index (i.e., position in the list). This bash tutorial teaches you how to use indexed arrays in bash. Various usages of indexed arrays in bash are illustrated with examples.
How to use map, reduce and filter in Python
Functional programming approach in Python can be best illustrated by built-in functions called map(), filter(), and reduce(). This python tutorial teaches you how to use map(), filter() and reduce() functions with easy-to-follow examples.
Tcpdump cheat sheet with examples
Main power of tcpdump packet sniffing tool comes from its flexible packet filtering rules and versatile protocol dissector. As you may know, only the sky is the limit when it comes to packet-level monitoring with tcpdump. This post provides a comprehensive tcpdump cheat sheet with detailed examples.
How to use range and sequence expression in bash
This bash tutorial explains the bash's built-in brace expansion, and presents examples that illustrate how to use brace expansions to define a range or to generate a sequence of strings.
How to catch and handle errors in bash
Writing a robust, bug-free bash script is always challenging even for a seasoned system administrator. While you cannot prevent all errors in your bash script, at least you should try to handle potential error conditions in a more predictable and controlled fashion. This tutorial introduces basic tips to catch and handle errors in bash.
How to install ELK stack on Ubuntu 20.04
When many different services and applications are deployed across multiple servers, pulling all their logs and drawing meaningful operational insights from them are not an easy task. That is where the ELK stack comes to the rescue. This tutorial will help you get started with the ELK stack by showing how to configure the ELK stack on a single Ubuntu 20.04 development server.
Natural language processing with Python
Python has become the most preferred language for Natural Language Processing (NLP) because of its great library ecosystem, platform independence, and ease of use. In this post let's find out what are the common real-world uses of NLP and what open-source Python tools and libraries are available for the NLP tasks.
How to create virtual environments in Python 3 with venv module
A Python virtual environment allows you to create a logically isolated software environment for a particular Python project, and choose a version of Python interpreter as well as install any necessary libraries for the project. The idea is for every project to have its own virtual environment. This means that Python tools installed for different projects within their own virtual environments will not interfere with one another. This tutorial describes how to create virtual environments in Python 3 using the built-in venv module.
How to get started with Vagrant on Linux
Virtualization allows DevOps teams to easily and quickly replicate necessary OS environments to build, test and deploy their development system on. Vagrant is an open-source, command-line based tool that allows generating reproducible and sharable virtualized environments in an automated fashion. This tutorial will help you understand the power of Vagrant and to guide you to quickly develop hands-on skills with Vagrant.
How to get started with Git on Linux
Developing applications is not as easy as many might think. It requires coding skills and the use of productivity tools that make the development process fast and efficient. One of those handy coding tools is a version control system called Git. This tutorial provides a beginner's guide on how to get started with Git version control system on Linux environment.
How to measure elapsed time in bash
Elapsed time is the amount of wall-clock time that has passed between the beginning and the end of a particular event. This tutorial describes how to measure elapsed time with various resolutions (e.g., in seconds, in milliseconds, in microseconds) in bash.
How to wake up a sleeping bash script
Suppose you want to have a bash script that sleeps in the background normally, and wakes up to perform some task only when you send a signal to the script. Once the script completes the task, it then goes back to sleep. In this tutorial, let's find out how you can wake up a sleeping bash script by utilizing a named pipe.
How to manipulate strings in bash
All bash variables are by default treated as character strings. Therefore more often than not, you need to manipulate string variables in various fashions while working on your bash script. This bash tutorial presents a comprehensive list of useful string manipulation tips for bash scripting.
How to write a function in bash
This bash tutorial discusses all about bash functions, such as how to create and call a bash function, how to pass arguments to it, how to exit a bash function, and how to return a value from it.
How to read command line arguments in a bash script
A bash script rarely runs standalone. Rather, you often pass one or more arguments to the script from the command line to modify its run-time behavior. In more advanced cases, you may want to pass command-line options to your script (e.g., "-h" or "-f my.txt") to optionally change the default settings of the script. In this tutorial let's find out how you can pass command-line arguments and how you can handle command-line options in a bash shell script.
How to create an RPM package from a tarball
Creating RPM package files can be both as easy or complicated as you desire. If you're needing to create an RPM package from a tarball (.tar.gz) that a vendor sent you, this tutorial will be beneficial for you. In this tutorial, I will describe a step-by-step procedure for building an RPM package. The procedure includes creating the required directory structure, configuring a .spec file required for the rpmbuild process, and building and installing the RPM package. An additional step is added for those who may need to create more RPM packages in the future via a skeleton file.
How to embed a binary file in a bash shell script
You may have been in a situation where you want to embed a binary file in your shell script before sharing it with others. For example, you are working on an installation script that includes a tarball. Or you are writing a portable shell script that includes any external dependency. Find out find out how you can include a binary file in a bash script and how to retrieve it from the script.
How to read column data from a text file in a bash shell script
One common task in day-to-day shell scripting jobs is to read data line by line from a file, parse the data, and process it. The input file can be either a regular text file (e.g., logs or config files) where each line contains multiple fields separated by space, or a CSV file that is formatted with delimiter-separated values in each row. This bash tutorial describes how to read columns from a file and store them into separate variables for further processing.
How to use a key-value dictionary in bash
In any programming language, a dictionary is one of the most fundamental data structures that can store a set of objects in the form of key-value pairs. While bash is not a general-purpose programming language, a recent version of bash (starting from version 4) has star
ted to support dictionaries or associative arrays natively. This tutorial demonstrates how you can use a key-value dictionary in bash.
How to measure the average CPU utilization of a Linux process
Sometimes you may want to know the CPU usage of a particular Linux process. As the CPU usage of a process can fluctuate over its lifetime, you will want to measure the average CPU usage or CPU utilization of the process. For this purpose, a Linux tool set called sysstat may come in handy, which contains a collection of performance monitoring tools for Linux, reporting statistics on disk I/O, CPU, memory, networking, and other system activities.