l show in long format
l a all directories (including dots)

l h show unit suffixes

l t sort by time modified
l t r reverse time sort order
l S sort by size
l S r reverse size sort order

ls -lat
ls -latr

l d list directories as plain files

Good for limiting the scope of a wildcard search to the current directory
ls -lahd *dev*


Zip and unzip different files and directories as a Text ARchive file using different compression methods.

c create
x extract
z gzip compress
v verbosely
f to file
C to a non-current directory
u update

.tar no compression
.tar.gz gzip compression
.tar.bz2 bzip2 compression


Create tarchive from source directory
.tar -cvf filename.tar source_directory/
.tar -cvzf filename.tar.gz source_directory/
.tar -cvjf filename.bz2 source_directory/

Trailing slash on source directory is essential for tarchiving Solr schemas on a Mac

tar -czvf myhiwayschema.tar.gz myhiwayschema/


List all files in tarchive
tar -tvf filename.tar /source_file_directory


Extract file into current working directory as folder called "filename"
tar -xvf filename.tar
tar -xvzf filename.tar.gz
tar -xvjf filename.bz2

Extract file into some other already created directory
tar -xvf filename.tar -C /other/directory/

Don't overwrite or replace
tar -xvkf filename.tar

Extract specific file(s)
tar -xvf filename.tar filename_1 filename_2


Secure Shell access to a remote console


Securely copy a file between hosts. Direction is always source -> target, independent of what host you're currently on.
scp source target

Remote host can be source or target

scp user@remote:a.png a.png
scp a.png user@remote:a.png

On a Mac, spell out the whole local path /Users/username/Desktop/a.png

Copy more than one file to directory

scp *.png user@remote:/directory/

Copy directory to directory

scp -r thisdirectoryhere user@remote:/home/user/

To a specific host port (note the capital -P)

scp -r -P 44444 /Users/username/Desktop/this.png

scp -r -P 44444 user@remote:/home/user/images/this.png /Users/username/Desktop/