Configuring Environment Variables in Linux
Setting Environment Variables in Linux
Linux offers two approaches for configuring environment variables: temporary and permanent.
Temporary Configuration
Variables set this way disappear when the terminal closes. Use the export command directly:
export APP_VAR="Hello World"
export PATH=$PATH:/opt/myapp/bin
Alternatively, assign firs ...
Posted on Thu, 11 Jun 2026 18:27:02 +0000 by blacksmoke26
Essential Linux CLI Shortcuts and Debian Package Management
Terminal Interaction and Directory Navigation
Adjusting the terminal font size can be done quickly using Ctrl + Shift + +.
To toggle between the current working directory and the previous one, use cd -. For instance, if you navigate from /var/log to /etc/nginx using cd /etc/nginx, running cd - will instantly return you to /var/log. Executing it ...
Posted on Thu, 11 Jun 2026 18:08:52 +0000 by mickd
Shell Script Functions: Definition, Usage, and Advanced Patterns
Shell Functions
Defining Functions
Functions in shell scripts encapsulate reusable blocks of code. There are two common syntax styles:
# Style 1: Using the function keyword
function my_function {
commands
}
# Style 2: Bash-compatible parentheses syntax
my_function() {
commands
}
Inspecting Defined Functions
The declare builtin provide ...
Posted on Wed, 03 Jun 2026 16:55:32 +0000 by cesy
Understanding Shell Session Types: Interactive vs. Login Modes
The Shell acts as the interface between the Linux kernel and the user, serving as the primary mechanism for system management and communication. Depending on the initialization method, a Shell session operates in one of four distinct modes, defined by two criteria: authentication status (Login or Non-login) and interactivity (Interactive or Non ...
Posted on Mon, 01 Jun 2026 17:49:41 +0000 by spasm37
Automated Service Monitoring and Management Strategies in Shell
Effective system administration relies on robust monitoring scripts. This guide explores best practices for implementing service health checks and automated recovery using Bash conditional logic.
1. System Resource Monitoring
To monitor system memory and alert administartors, we can leverage the free utility. The following script checks if avai ...
Posted on Wed, 27 May 2026 21:41:09 +0000 by webdes03
Converting Bash Scripts to Windows Batch Files for GMT
Most community-contributed GMT plotting scripts are written as Linux bash scripts, which can be challenging for Windows users unfamiliar with bash syntax. This guide explains how to adapt bash scripts for use on Windows by converting them to batch (.bat) files.
The core differences between bash and batch scripts are straightforward:
Comments: ...
Posted on Tue, 26 May 2026 18:23:50 +0000 by dragongamer
Shell Variables in Bash Scripting
Positional Parameters
Positional parameters allow scripts to accept command-line arguments:
$0 - Name of the currently executing script
$n - nth argument passed to the script (use braces for n > 10, e.g., ${10})
$# - Number of arguments passed to the script
$* - All arguments as a single string
$@ - All arguments as separate string ...
Posted on Mon, 25 May 2026 23:25:23 +0000 by shanewang
Bash Conditional Expressions and Operators
Conditional Expression Syntax
Bash supports four syntax forms for condition testing:
Syntax
Description
test expression
Uses the test command
[ expression ]
Single brackets, functionally identical to test
[[ expression ]]
Double brackets, enhanced version of the above
((expression))
Double parentheses, typically used with if statem ...
Posted on Mon, 25 May 2026 19:41:41 +0000 by True`Logic
Shell Script Arithmetic and Conditional Testing
Arithmetic Operations
Script files must begin with #!/bin/bash. Comment are denoted by #. Code should be properly indented with whitespace.
Arithmetic operations support: +, -, *, /, **, %.
Evaluation methods:
# Method 1
let VAR=arithmetic-expression
# Method 2
VAR=$[arithmetic-expression]
# Method 3
VAR=$((arithmetic-expression))
# Method 4 ...
Posted on Fri, 22 May 2026 16:35:20 +0000 by stanleyg
Fundamentals of Shell Scripting
Script Structure and Execution
Shell scripts require a shebang line at the beginning to specify the interpreter:
#!/bin/bash
#!/usr/bin/python3
Comments use the # symbol and are single-line only. To execute a script:
chmod +x script.sh
./script.sh
Input and Output
Reading input with read:
read input_var
read -p "Enter value: " pro ...
Posted on Mon, 18 May 2026 04:51:00 +0000 by BIOSTALL