In the past I have already worked with a project that consisted of multiple Git repositories in a common project folder. For tracking each repository’s individual state together, Google’s repo tool was used. I ended up using mostly its powerful repo forall subcommand to execute various bash or git commands over the whole or subset of those projects.
Now, I was faced with the same situation, but without repo already in place. Could I get some of that forall feeling back, but without installing that (relatively) giant tool? It turns out, 9 lines of bash give me most of what I missed:
Continue reading “How to manage multiple Git repositories with a simple bash function”
The following bash function (e.g. stored in your
Continue reading “Bash: How to find all files modified on a certain day”
~/.bash_aliases) finds all files within a directory that was changed on a specific date. I use this to retroactively check on all my activities throughout a day. For code-related changes, a filtered git log certainly is better, but this includes file downloads, modified text documents in one search query, if aimed at my home directory.
Just a note to myself, as I always have a hard time understanding the
find manpages. To list the directories and subdirectories up to a certain depth, “simply” enter:
find . -maxdepth 2 -type d
Option maxdepth states how deep the subdirectories should be listed, option type restricts output to directories (
If a directory listing including size is required, this much shorter snippet does the trick, using
du (disk usage), the counterpart to the often-used
df (disk free):
du -hd 1
h triggers human-readable output, replacing size byte count (5820) with SI prefixed numbers (5.8K), while
d limits the recursion depth like before.
Note to self, it’s deceptively simple, once one manages to read the manpages properly:
du -hd 1 /path/to/directory
If directory is the current folder, this shortens to:
du -hd 1