Posts Tagged ‘Shell’

My Favorite ‘find’ Command Uses

Find files edited within the last 10 minutes, good for when you install something or update something to see what changed. find / -mmin -10 Find files last modified older than 2 years ago. Good for cleaning out old files. find / -mtime +730 -print Find files modified more than 2 years ago and delete [...]

How Do I Add A User To A Group Using the Command Line?

After some research this is what I found: dscl . -append /Groups/group-name GroupMembership user-name

How Can I Delete Files From My Trash Older Than x Months

Just want to see what will be deleted?: find /Users/username/.Trash/* -mtime +730 -print Actually delete the files (This can’t be undone): find /Users/username/.Trash/* -mtime +730 -exec rm -f {} \;  Keep in mind, you must substitute ’username’ with your actual username. find/Users/username/.Trash/* finds all the files in the given directory -mtime +730 finds files modified greater than [...]