Day 8: Design Changes are not a Priority

So I had intended on working on improving the CSS for the blog post pages to save myself some time when editing posts but I realized that’s not as important as finishing what I’m currently stuck on. Sooo… I went through a few videos on the find program and what a difference it made! I went from frustrated to excited in a few minutes because I found a great explanation. What a time to be alive!

TLDR;

Okay, so here are the highlights of what I did:

  • Simplified some of my find program notes after watching a few videos on YouTube.
  • Played around with the design of my blog’s WordPress theme (Realized how poorly structured I was when putting it together).

The find Program

So rather than writing about what I learned I should just share some of my notes below, so check it out:

Basics

If find is called with no options or arguments then it will by default print all the files and sub-directories found in the current directory find was called in.

$ find
.
./test.html
./folder1
./folder1/test2.html

The find command has many options that make it so useful. You can see some examples below but I will first divide them into categories before explaining each option in detail. Some examples:

# Find all directories named src
find . -name src -type d
# Find all python files that have a folder named test in their path
find . -path '*/test/*.py' -type f
# Find all files modified in the last day
find . -mtime -1
# Find all zip files with size in range 500k to 10M
find . -size +500k -size -10M -name '*.tar.gz'

Syntax

There are a few quirks to be aware of when using the find program but the general syntax can be seen below.

$ find [Core Options] [starting-point...] [expression]

Core Options

There are 5 core options that are listed for the find program. These options must appear before the first path name, if at all. They are:

OptionDefaultDescription
-PYesNever follow symbolic links.
-LNoFollow symbolic links.
-HNoDo not follow symbolic links, except while processing the command line arguments.
-DNoPrint diagnostic information; this can be helpful to diagnose problems with why find is not doing what you want.
-OlevelNoEnables query optimisation. The find program reorders tests to speed up execution while preserving the overall effect.

-P , -L , and -H which overwrite one another when more than one is provided to the find program. The last one appearing on the command line takes effect. Since it is the default, the -P option should be considered to be in effect unless either -H or -L is specified.

The starting-point

The starting point is simply the directory you want the find program to start it’s search in. By default this value is the current directory the find program was called from. Multiple starting-points can be listed here separated by a white space.

$ find [Core Options] [starting-point...] [expression]

# Examples

# Find all files and directories in the current directory

$ find

# Find all files and directories in the Documents directory

$ find ./Documents

# Find all files and directories in the Documents directory and the Pictures directory.

$ find ./Documents ./Pictures

Conclusion

That’s all for today! Btw if you are interested in the MIT course you can check out the video lecture I’m currently doing the exercises for. The lecture is helpful but isn’t sufficient by itself. Anyways, until next time PEACE!

YouTube player