Tag Archives: linux

Disable Nginx Version Number in HTTP Headers

security

By default, Nginx sends the version number in the HTTP response. Hackers can use this information to try and exploit any known vulnerabilities in Nginx, especially if you are running a version with known vulnerabilities. Security wise, it’s a good practice to not reveal versions numbers of the HTTP server.

Linux: Clear Memory Cache

unix linux

The Linux kernel uses unused main memory as a cache to keep page cache, filesystem dentries and inodes. The use of the cache or buffer memory accelerates access to files stored on non volatile storage such as hard disks. The cached items can be cleared from memory by sending a signal to the Linux kernel using the /proc filesystem or the sysctl command.

Linux: How to Monitor File System for Changes

unix linux

The Filesystem notification APIs allows applications to watch certain files and be notified when they are opened, modified, deleted, or renamed. This greatly aids the applications, because before such filesystem event monitoring tools existed, such applications would have to read the disk repeatedly to detect any changes, which resulted in high disk and CPU usage.

Linux: Check CPU for 64-bit Support

unix linux

To check for a 64-bit capable CPU on a x86 system running on Linux, we can make use the /proc/cpuinfo file. Note that this will not determine if the OS is 64-bit or not. It will only determine if the CPU is capable of running a 64-bit OS. To check if the Linux OS is running 32-bit or 64-bit, you can refer to this article instead.

Linux: How to Check If Linux Kernel is 32 or 64 Bit

unix linux

When writing configure scripts, it’s good to check if we are running on a 32-bit or 64-bit kernel or OS on a x86 system. There are a few ways to determine the machine architecture of a Linux system.

Linux: IO Performance Tuning with noatime, nodiratime, relatime

unix linux

The POSIX standard mandates that operating systems maintain file system metadata that records when each file was last accessed. This timestamp is known as atime and atime comes with a performance penalty – every read operation on a filesystem generates a write operation.

Unix / Linux: Run Cron Jobs on Last Day of Month

unix linux

Cron jobs can be scheduled based on minute, hour, day of month, month or by the day of the week. Flexible as it may seem, there is actually no simple way to schedule a job to be run on the last day of every month.

Shell Script: Get Epoch Time

shell script

Unix time, POSIX time or Epoch time is defined as the number of seconds that have elapsed since 00:00:00 January 1, 1970 UTC. There are a few methods to retrieve the Epoch time on Unix and Linux.

Linux: Swap Usage per Process

unix linux

You run the free command on a Linux machine and it reports that swap space is being used. How do you determine if a process is using swap memory? Or how do you determine which processes are using swap memory? The short answer is to use the procfs or /proc filesystem.