1017Finding and Deleting Files without Content

Finds all empty JPEGs at current directory:

find . -maxdepth 1 -name "*.jpg" -size 0

Finds and deletes all empty JPEGs at current directory:

find . -maxdepth 1 -name "*.jpg" -size 0 -delete

Finds and deletes all empty JPEGs in all sub-directories.

find . -maxdepth 2 -name "*.jpg" -size 0 -delete

Sources: 1, 2

997Flask – [Errno 48] Address already in use

Problem:

Stopping the flask server with ⌃-Z (CRTL-Z), instead of the correct ⌃-C (CRTL-C), results in the server still bound to port 5000:

OSError: [Errno 48] Address already in use

Problem: After Flask crash, the port can still be occupied.

Solution:

Check who is using port 5000

sudo lsof -i:5000
kill $PID
kill -9 $PID

Success:

[2]  + killed     flask run