Table of Contents

Linux File Operations

Find Directories Containing Specified File Glob

For example, find directories containing Python source files.

find /c/home/db/ -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq

Find all the directories containing *.py files modified in the last 15 minutes.

find /c/home/db/ -mmin -15 -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq

Find all the directories containing *.py files modified in the last 7 days.

find /c/home/db/ -mtime -7 -type f -name '*.py' | sed -r 's|/[^/]+$||' | sort | uniq

List all directories modified in the last 7 days.

find ./ -mtime -7 -type d

Limit the recursion to only show directories in the current directory.

find ./ -maxdepth 1 -mtime -7 -type d
find ./ -maxdepth 1 -type d -mtime -7 | xargs -I {} ls -dhl {}

Mount CIFS/SMB Share

sudo mount -t cifs -o username=admin,rw,iocharset=utf8,file_mode=0755,dir_mode=0755 //10.0.0.1/documents /mnt/win