Bash Shell Generate Random Numbers

In Bash shell, you can generate random numbers using the built-in “RANDOM” variable or the “shuf” command. Here’s how to do it: Using the RANDOM variable: Use the “$RANDOM” variable to generate a random number between 0 and 32767: echo $RANDOM This will output a random number each time you run the command. Use the … Read more

Linux / UNIX: Run Multiple X Sessions

In Linux or UNIX, you can run multiple X sessions (graphical sessions) simultaneously by using different virtual terminals (VTs). Here’s how to do it: Press “Ctrl + Alt + F2” (or any other function key from F2 to F7) to switch to the second virtual terminal. This opens a new login prompt. Log in with … Read more

Linux / UNIX: Displaying Today’s Files Only

To display only today’s files in Linux or UNIX, you can use the “find” command with the “-daystart” and “-ctime” options. Here’s how to do it: find /path/to/files -daystart -ctime 0 This command searches for files in the specified directory (/path/to/files in the example) that were created or modified within the last 24 hours. The … Read more

Linux: Check For Memory Leaks In Programs

Memory leaks can be a common problem for long-running programs, and they can cause performance issues and system crashes over time. Fortunately, Linux provides tools to check for memory leaks in programs. Here are some steps to do so: Install the valgrind tool: Valgrind is a popular tool for detecting memory leaks and other memory-related … Read more

HowTo: OpenBSD Mount an NTFS File System

OpenBSD includes support for mounting NTFS file systems, but you need to install the ntfs-3g package to mount them. Here’s how to mount an NTFS file system on OpenBSD: Install the ntfs-3g package: The ntfs-3g package provides the tools necessary to mount NTFS file systems on OpenBSD. You can install it using the package manager … Read more

How To – Linux / UNIX Create a Manpage

A manpage is a documentation file that provides detailed information about a specific command, program or function on a Linux/UNIX system. Here are the steps to create a manpage: Choose a name for your manpage: Typically, the name of the manpage should be the same as the name of the command or program you want … Read more