Found 1436 Articles for Linux

The Meaning of IFS in Bash Scripting on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 15:07:52

10K+ Views

Introduction In Bash scripts on Linux, the "IFS" (Internal Field Separator) variable plays an important role in controlling how fields in a string are separated. IFS defaults to a space, tab, and newline character, which means that, by default, fields in a string are separated by any combination of these characters. However, the IFS value can be changed to meet the specific needs of a script. In this article, we will explore the meaning of IFS in Bash scripting and how it can be used in various scenarios. Linux IFS is a special variable in Bash which is used to ... Read More

Using the find -exec Command Option on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 15:02:13

6K+ Views

Introduction The find command in Linux is a versatile and powerful tool for finding files and directories on a file system. The “-exec” option is a useful addition to the find command that allows you to execute a command on any file or directory it finds. This can be useful for tasks like finding specific files and then performing an action on them, like deleting, moving, or editing. In this article, we will discuss the syntax and usage of the find -exec command option and provide examples of how it can be used. Syntax and Usage The basic syntax of ... Read More

Using Vim Registers on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:58:48

265 Views

Introduction Vim is a powerful text editor widely used on Linux systems. One of the features that makes Vim so powerful is its support for registers. registers are essentially notes that allow you to quickly and easily store and retrieve text. In this article, we will discuss the basics of using registers in Vim in detail, including how to copy and paste text using registers, how to display register contents, and how to manipulate register contents. We'll also look at some advanced uses of registers and examples to help you understand how to use them effectively. Understanding Registers Before we ... Read More

Ensure Only One Instance of a Bash Script Is Running on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:55:35

2K+ Views

Introduction When running a bash script on Linux, it's important to ensure that only one instance of the script is running at a time. This is especially important for scripts that perform critical tasks, such as scripts that update databases or scripts that send email. Running multiple instances of the same script simultaneously can cause conflicts, data loss, and other errors. In this article, we will discuss different methods to ensure that only one instance of a bash script runs on Linux. Using Flock One way to ensure that only one instance of a bash script runs on Linux is ... Read More

Pass the Output of a Command as an Argument for Another on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:51:39

1K+ Views

Introduction When working with the Linux command line, we often use multiple commands that take important data as arguments. In this tutorial, we'll explore various scenarios on how to use the output of one command as an argument to another. We will create an environment to test our strategies and use examples to illustrate each scenario. Preparing Sample Files To get started, we need to create a directory called "dir_example" and another called "target". These directories will be used to store the files that will be used as examples in this tutorial. $ mkdir dir_example target Next, we will ... Read More

How to Kill a Detached screen Session on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:48:43

2K+ Views

Introduction Separate screen sessions are an excellent way to perform background processes on a Linux machine. However, sometimes it may be necessary to kill a separate screen session that is no longer necessary. In this article, we will show you how to remove a separate screen session on Linux using the command line. When using the GNU screen tool, we can sometimes end up with separate sessions that need cleaning up. In this quick tutorial, we'll look at some options for deleting a disconnected screen session. List of Sessions Before we start discussing how to end existing sessions, let's first ... Read More

Filtering Files Copied When Using rsync on Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:44:20

525 Views

Introduction The Linux command-line utility rsync is a powerful and flexible tool for synchronizing files and directories across different computers and locations. It is commonly used for a variety of tasks including backups, file transfers and data replication. One of the main features of rsync is its ability to filter files based on various criteria such as file type, size and modification time. In this article, we will explore in detail how to use rsync filters to selectively copy files during directory synchronization on a Linux system. Rsync Overview Rsync is a powerful and efficient file transfer tool that allows ... Read More

Calculate an MD5 Checksum of a Directory in Linux

Pradeep Jhuriya
Updated on 20-Jan-2023 14:26:11

3K+ Views

Introduction During our daily use of Linux, we may want to check if there are any changes to any of the files in a directory. Or we might want to confirm that the contents of one directory are the same as those of another directory on a different location, disk, or system. In this tutorial we will learn how to compute an MD5 checksum of an entire directory tree on Linux. We will compute a single hash value of all directory contents for comparison purposes. Get the list of all files in a directory tree To find out the collective ... Read More

Keeping SSH session alive on Linux

Pradeep Jhuriya
Updated on 17-Jan-2023 17:13:39

12K+ Views

Introduction Secure Shell (SSH) is a network protocol that allows secure remote connections between two systems. It is commonly used to access and manage Linux servers remotely. However, one of the problems with using SSH is that your session can be terminated due to downtime or network outages. This can be frustrating, especially if you're working on a long-running task that requires an uninterrupted connection. In this article, we will discuss various methods of keeping an SSH session alive on Linux. Using the ClientAlive Interval Option One way to prevent an SSH session from closing due to inactivity is to ... Read More

Writing Text to File Using Linux Cat Command

Pradeep Jhuriya
Updated on 17-Jan-2023 17:12:20

41K+ Views

Introduction The Linux cat command is a powerful utility that allows users to concatenate, view and create files. One of its useful features is the ability to write text to a file, either by appending it to the end of the file or by overwriting the existing content of the file. In this article, we'll explore how to use the cat command to write text to a file in Linux, covering the various options and flags that can be used to customize the behavior of the command. Introduction to the Linux Cat Command The cat command is a simple yet ... Read More

Advertisements