Linux / UNIX: Convert Epoch Seconds To the Current Time

In Linux/UNIX, you can use the date command to convert epoch seconds to the current time. Here’s an example: #!/bin/bash # Set epoch seconds to a variable epoch_seconds=”1632718301″ # Use the date command to convert epoch seconds to human-readable time formatted_time=$(date -d @$epoch_seconds) echo “Epoch seconds: $epoch_seconds” echo “Formatted time: $formatted_time” In this example, we … Read more

Linux Kernel Recompile: Do I Have To Recompile All Installed Applications

No, you do not have to recompile all installed applications after recompiling the Linux kernel. When you recompile the Linux kernel, you are essentially creating a new kernel image file that contains the new kernel code and configuration options. This new kernel image file is then used when the system boots up. Most user-level applications … Read more

Bash Shell: Trim Leading White Space From Input Variables

In Bash, you can use parameter expansion to trim leading white space from input variables. Here’s an example: #!/bin/bash input=” hello world” trimmed=${input#”${input%%[![:space:]]*}”} echo “Original input: \”$input\”” echo “Trimmed input: \”$trimmed\”” In this example, the input variable is assigned a value with leading white space. The trimmed variable uses parameter expansion to remove the leading … Read more

mod_setenv: Lighttpd Send Custom Headers

In Lighttpd, you can use the mod_setenv module to send custom headers to the client. Here’s how you can do it: Enable the mod_setenv module: If the mod_setenv module is not already enabled, you’ll need to enable it in your Lighttpd configuration file. Add the following line to the file: server.modules += (“mod_setenv”) Set the … Read more