Bash Delete Method

August 9th, 2016

I recently permanently delete some files because of habit using, rm -fr ./file.txt, ops.  So I looked into creating a bash function to delete files and just move them into a system temporary folder for auto delayed deletion.

There are multiply system temporary location on a mac,

/tmp – Used for short temp files.  This directory is available on system startup.  Some system are setup to use this directory in memory storage only.

/var/temp – Used for bigger files.  Because this is in the VAR directory it needs to be mounted and thus not available until then(after startup).

$TMPDIR – Is a temp directory variable, this is the recommended location to store temp files on OSX.

These directories are cleaned up differently on different systems.

Below is the line I added to my ~/.bash_profile
del() { mv $1 $TMPDIR; };

This will add a function called del that will move a file into the $TMPDIR.  This will allow the file to be queried for deletion, but also allows for a short recovery time.

View my sample .bash_profile:

https://github.com/johnfreier/scripts/blob/master/linux/.bash_profile

Twins Game

July 10th, 2016


via Instagram http://ift.tt/29rHFpl

Summer Time

August 16th, 2015


via Instagram http://ift.tt/1Mw59da

MCrypt

August 2nd, 2015

MCrypt is a library for C that contains a bunch of helpers for encryption and decryption.

Here is a sample project, https://github.com/johnfreier/mcrypt

 

Meow

June 21st, 2015


via Instagram http://ift.tt/1GBr65B