Open Source Articles

Page 35 of 123

Find all links for a specific file on Linux

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 749 Views

In Linux, finding all links for a specific file is a common administrative task. A link in Unix/Linux systems is an association between two different files or directories. When you create a link, it creates a new name for the original file. There are two types of links: hard links (multiple names for the same inode) and symbolic links (shortcuts that point to another file path). Setup Example Let's start with a practical example. We have a file1.txt document and several symbolic links pointing to it from different locations: [tpoint@server1:~/test]$ ls -lrth total 12K -rw-r--r-- 1 tpoint ...

Read More

Create bash alias that accepts parameters

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 973 Views

When working with Bash scripts or Unix/Linux command line tools, we often write the same command lines over and over again. Often, these command lines are long and must be repeated multiple times. For instance, when logging into a remote server daily, copying a local folder to the remote server, or searching for hidden files or directories within a directory. You can create aliases using the alias command. In this guide, I will show you how to create an alias that accepts parameters on Linux. This is useful if you want to run a single command repeatedly without having ...

Read More

Command chaining: Inline or Already running process

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 488 Views

Command chaining allows you to run multiple commands sequentially in Linux. This is useful when you need to execute a series of related operations, such as downloading a file, extracting it, and then cleaning up. Command chaining can be done inline when starting commands or applied to processes that are already running. Inline Command Chaining Bash provides several operators for chaining commands together. The general syntax is: ... Common Chaining Operators ; (semicolon) − Executes commands sequentially regardless of success or failure & (ampersand) − Runs the ...

Read More

How to Clear Linux terminal screen?

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 2K+ Views

The Linux terminal is an essential tool for system administration and daily tasks. During extended terminal sessions, the screen can become cluttered with output from various commands, making it difficult to focus on current work. Clearing the terminal screen helps maintain a clean workspace and improves productivity. Linux provides several methods to clear the terminal screen, each with different behaviors and use cases. Let's explore the most effective approaches. Using the clear Command The clear command is the most common method to clear the terminal screen. It removes all visible text and positions the cursor at the ...

Read More

How to solve "Unary operator expected" errors?

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 10K+ Views

The "unary operator expected" error is a common syntax error in Bash scripting that occurs when a conditional expression lacks the required operands. This typically happens when variables are empty or undefined, causing the shell to receive fewer arguments than expected for comparison operations. What Causes the Error? The error occurs when Bash encounters a comparison operator with missing or empty operands. Let's examine a script that demonstrates this issue − #!/bin/bash read -p "Enter the input: " num1 if [ $num1 -eq 1 ] then echo "Number entered is 1" else ...

Read More

What happens to Open File Handle if file is Moved or Deleted?

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 427 Views

When working with files that have open handles, understanding how operating systems behave during file operations like deletion, moving, or replacement is crucial. This behavior depends on how filesystems manage inodes and file references internally. Understanding Files and Inodes In Linux filesystems, files are tracked using inode numbers rather than filenames. A filename is essentially a hard link that points to an inode containing the actual file data and metadata. $ touch inode_example $ stat inode_example File: inode_example Size: 0 ...

Read More

Build complete path in Linux by concatenate two strings?

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 924 Views

In Linux systems, path concatenation is a common task when building complete file paths from separate directory and filename components. This process involves joining two or more path segments while handling special cases like trailing slashes, empty strings, and relative paths. Basic String Concatenation for Paths The simplest approach to combine paths is using variable substitution. Let's examine a practical example: $ my_home_dir="/home/shubh/baeldung/" $ repo_path="tutorials/linux-bash/command-line-arguments/src/main/bash" $ file_path="$my_home_dir$repo_path" $ echo $file_path /home/shubh/baeldung/tutorials/linux-bash/command-line-arguments/src/main/bash However, this basic approach can create issues with multiple consecutive slashes: $ file_path="$my_home_dir/$repo_path" $ echo $file_path /home/shubh/baeldung//tutorials/linux-bash/command-line-arguments/src/main/bash While Linux ...

Read More

Copy a directory to an existing directory Linux?

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 1K+ Views

Copying directories is one of the most common operations in Linux system administration. The cp command is typically used for this purpose, but copying a directory into an existing directory requires specific techniques to handle content merging properly. This article explores different methods to recursively copy directory contents into an existing target directory, both with and without overwriting existing files. Understanding the Problem When copying a directory to an existing directory, we need to distinguish between two scenarios: Copying directory contents − Merge files from source into target Copying the entire directory − Create a ...

Read More

20 Things to Do After Installing Ubuntu 22.04 LTS (Focal Fossa)

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 51K+ Views

Ubuntu 22.04 LTS (Jammy Jellyfish) is the latest long-term support release of Ubuntu, which means that it will be supported for five years with security updates and bug fixes. If you have just installed Ubuntu 22.04 LTS, congratulations! You are now ready to explore the world of Ubuntu and take advantage of its many features and tools. In this article, we will discuss 20 essential things you can do after installing Ubuntu 22.04 LTS to optimize your new operating system. These include updating your system, customizing your desktop, installing essential software, configuring security settings, and more. 1. Update ...

Read More

Configure sendmail with Gmail on Ubuntu

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 13K+ Views

Sendmail is a popular mail transfer agent used to send emails from one computer to another. It is often installed by default on Ubuntu, making it a convenient option for sending emails from a server. If you use Gmail, you can configure sendmail to send emails through your Gmail account. In this article, we will show you the process of configuring sendmail with Gmail on Ubuntu. Requirements Before starting, there are a few requirements needed to configure sendmail with Gmail on Ubuntu − A Gmail account An Ubuntu server Sendmail installed on your Ubuntu server ...

Read More
Showing 341–350 of 1,225 articles
« Prev 1 33 34 35 36 37 123 Next »
Advertisements