Browsing the archives for the bash tag

Sorting files by datestamp in Bash

You would think there were a function in Linux already that would do this.  The following command will sort all files in a directory and all subdirectories for the past 14 days by datestamp. bash$ find . -mtime -14 -type f | while read line; do echo -n `ls -l –time-style=’+%s %F %T’ “$line” | […]

No Comments Posted in bash, Security
Tagged , ,
Simple Bash Loop Constructs

Many times it is useful to write an ad-hoc program within bash to accomplish a task. Most of an ad-hoc script is composed of text formatting as well as a loop to get things running. The most useful loop structure that I find in my experience is a do while loop as follows: bash$ ls […]

No Comments Posted in bash
Tagged ,