Month: April 2022

Ramdisks: Why You Might Enjoy One, Plus a Performance Puzzler

A ramdisk – or if you prefer, RAMdisk – is a method of taking a section of memory and treating it as disk.  If you think about it for a moment, the pros/cons should be obvious: RAM is much faster than even the fastest disk, so operations on the ramdisk are much faster…

Source: Ramdisks: Why You Might Enjoy One, Plus a Performance Puzzler – LowEndBox

How to use the scp Command in Linux

SCP is short for secure copy protocol and is used to copy files and directories between multiple Linux machines over a network. The data transferred using SCP is encrypted to protect your data against nefarious agents.

The SCP command uses SSH for data transfer and thus uses all the same usernames and passwords you would use for SSH. As a result, it is an extremely useful command for transferring files securely without too much added complexity.

Source: How to use the scp Command in Linux – Pi My Life Up

Here Today, Gone When You Exit: Proper Tempfiles in Shell Scripts

In the course of my career, I’ve periodically come across code like this in shell scripts:

TEMP_FILE=/tmp/tempfile

Or sometimes, slightly more elegantly:

TEMPFILE=/tmp/tempfile.$$

The problems with the first example are obvious, especially if it appears in many different scripts. The second is better. The “$$” means “my process ID”, who if whatever script had a process ID of 5309, the TEMPFILE variable would be set to /tmp/tempfile.5309. This makes collisions between scripts extremely unlikely, but is still suboptimal. What if there is a file called /tmp/tempfile.5309 and it’s owned by another user, or what if you don’t have permission to write to /tmp? It’d be better to find out immediately than many lines later when you try to write something. …

Source: Here Today, Gone When You Exit: Proper Tempfiles in Shell Scripts – LowEndBox

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez