Compress

xz -zk myfile.txt

will produce myfile.txt.xz in the same directory

Decompress

xz -dkc myfile.txt.xz > myfile.txt