Bash History Display Date And Time For Each Command

By default, the history command in Bash shows a list of recently executed commands with their respective line numbers. However, it does not display the date and time when each command was executed. (www.utahcnacenters.com) To show the date and time for each command in the Bash history, you can set the HISTTIMEFORMAT environment variable. Here’s … Read more

AIX UNIX: Enabling Jumbo Frames

To enable jumbo frames on an AIX UNIX system, you can follow these steps: Check if your network adapter supports jumbo frames: To enable jumbo frames, you need to have a network adapter that supports it. You can check if your adapter supports jumbo frames by running the following command: entstat -d en0 | grep … Read more

Bash Shell Read a Line Field By Field

In Bash shell, you can use the read command to read input line by line, and then use the IFS (Internal Field Separator) variable to specify the delimiter character(s) that separate the fields. Here is an example script that reads input from a file called data.txt and extracts the fields delimited by commas: #!/bin/bash # … Read more

socat: Linux / UNIX TCP Port Forwarder

socat is a powerful and versatile utility that can be used for a wide range of network-related tasks, including TCP port forwarding. To use socat for TCP port forwarding, you can use the following command: $ socat TCP-LISTEN:local_port,fork TCP:remote_host:remote_port In this command, replace local_port with the port number on your local machine that you want … Read more

nginx: Send Custom HTTP Headers

In Nginx, you can send custom HTTP headers to the client by using the add_header directive. Here is an example configuration that adds a custom X-My-Header HTTP header to all responses: server { listen 80; server_name example.com; location / { # Set the content of the custom header add_header X-My-Header “Hello, world!”; # … other … Read more

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