Helpful Unix and Mac commands

Published:

I am for the most part a Windows user. I was kind of moving towards Linux, Ubuntu in particular, but that ship pretty much sailed when I got my hands on Windows 7. Awesome, awesome operating system. But, I still have to use some Unix and Mac systems once in a while. And then there are certain commands that I often use, but always forget since it usually goes a bit of time between times I do it. So, what follows is basically just a list of commands that I keep forgetting, but keep having to look up again.

Remove .DS_Store files

Removes all those stupidannoying DS_Store files that Mac litters around wherever it goes. Works in the current directory and downwards.

find . -name *DS_Store -delete

Compress and decompress files

# Compress
tar czvf archive.tar.gz filedir filedir
tar cjvf archive.tar.bz2 filedir filedir

# List
tar tvf archive.tar

# Decompress
tar xzvf archive.tar.gz
tar xjvf archive.tar.bz2

Find open files

lsof filename