How to Split a String by Delimiter in Bash
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore the Programming Academy
Continue Learning Explore the Programming Academy
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore more in the Linux Essentials Path
Continue Learning Explore more in the Linux Essentials Path
Java has several solid REPL implementations available. Here are the main options and how to use them. jshell (Official) The best choice for most users is jshell, included in JDK 9+. It’s the official interactive shell for Java and comes with every modern Java installation. Start it immediately: jshell Basic usage: jshell> long ts =…
When working with Hadoop Distributed File System (HDFS), files containing spaces in their names require special handling during the hdfs dfs -put command. Without proper escaping or quoting, the shell interprets spaces as delimiters, splitting the filename into multiple arguments. Direct Upload with Quoting The simplest approach is to wrap the filename in quotes: hdfs…
Disabling a user account is a common administrative task. Whether you’re offboarding an employee, removing an unused service account, or securing a compromised account, there are several approaches depending on your requirements. Lock the account with usermod The simplest method is to lock the password hash: sudo usermod -L username This prepends an exclamation mark…
EncFS is a FUSE-based encrypted filesystem that lets you create an encrypted directory without a separate partition. Installation approaches vary depending on your distribution version and repository availability. Using Distribution Repositories On modern RHEL-based systems (CentOS Stream, Rocky Linux 9+, AlmaLinux 9+), EncFS is typically available in the EPEL repository: sudo dnf install epel-release sudo…
The default TeX Live packages available through standard repositories are often outdated and incomplete. The official TeX Live installer provides access to current versions and the full package collection, though it requires around 4-5GB of disk space. Prerequisites Before starting, ensure you have the required dependencies installed: sudo yum groupinstall -y “Development Tools” sudo yum…
When trying to mount an encrypted EncFS directory as a normal user, you may encounter this error: $ encfs -s ~/t/.enc ~/t/enc EncFS Password: fuse: failed to exec fusermount: Permission denied fuse failed. Common problems: – fuse kernel module not installed (modprobe fuse) – invalid options — see usage message Even though the same command…
The most common need is collapsing multi-line records into single lines. Here are the practical approaches: Using tr to remove newlines The simplest method removes all newlines: tr -d ‘\n’ < input.txt > output.txt This works well for data without embedded line breaks you want to preserve. For CSV or structured data where you need…
The bottom panel in GNOME Classic displays the window list via the “Window List” extension. If you don’t use it, there are several ways to remove it depending on your approach. Method 1: Context menu removal (Recommended) The simplest approach if your GNOME version supports it: Hover over a blank area of the bottom panel…
The tee command by default reads from stdin and writes to both stdout and files. To capture only stderr, you need to explicitly redirect it. Basic stderr redirection to tee The straightforward approach is to redirect stderr to stdout, then pipe to tee: command 2>&1 | tee output.log This captures both stdout and stderr. If…
Temporary files are essential for any non-trivial Bash script. Whether you’re processing data, staging changes, or handling inter-process communication, you need reliable ways to create uniquely-named files that won’t collide with other processes. Using mktemp The standard and most reliable approach is mktemp, which generates a cryptographically random temporary filename: tmpfile=$(mktemp) echo “Temporary file created…
Spaces in file and directory paths are a common source of rsync failures. When paths contain spaces, the shell interprets them as argument separators unless you properly escape or quote them. Here’s how to handle this correctly. The core issue When rsync receives an unquoted path with spaces, the shell splits it at each space….
Sending output to stderr keeps error messages separate from normal program output, making it easier to redirect and filter logs in shell scripts and pipelines. Basic Approach with fmt The simplest method uses fmt.Fprintln() with os.Stderr: package main import ( “fmt” “os” ) func main() { fmt.Fprintln(os.Stderr, “This is an error message”) } This writes…