Skip to content

Instantly share code, notes, and snippets.

@pricees
Last active December 15, 2015 20:00
Show Gist options
  • Save pricees/b19dab5f584ab340a7b5 to your computer and use it in GitHub Desktop.
Save pricees/b19dab5f584ab340a7b5 to your computer and use it in GitHub Desktop.
Command Line Tools for that Macintosh

Command Line Tools for that Macintosh

15 Commands in 300 seconds


tee - Copy STDIN to STDOUT


caffeinate - Keep your computer awake

$ caffeinate -u -t 300 # keep awake for a 5 mins
$ caffeinate -s wget http://example.net/bigfile.xz # keep awake till big file d/l


lsof - list open files

$ lsof -i # list [i] internet files


sed - A stream editor

$ cat foo | sed '2,3d; s/Chicago/Los Angeles/g'


opendiff - gui to view/merge two files


top / htop - Process / resource monitor


awk - Language for scanning and processing text

$ cat ../foo | awk '{ print $2 }' | sort | uniq


cut - extract characters, fields, etc from input

$ cut -c 2-4 foo and $ cut -d "," -f 1 foo


paste - join files horizontally to standard output

$ paste -d ":" names ages


join - Join two sorted text files along a common field

$ join ages locales


nc - Tool for reading a writing to network connections. "The Swiss Army Knife" of tcp/udp

$ nc -l 3000
$ while true ; do nc -l 3000 < index.html; done
$ curl -X POST -d "Hello=world" "http://0.0.0.0:3000"


fold - Break a line of text

$ fold -w 10 lorem # break lines from lorem on 10th character


comm - Complimentary of diff

$ comm foo bar


yes - repeats "y" to standard out, good for installs

$ yes $ yes Centro


nohup - No "hangup"

$ nohup long_command_on_remote_server &


BONUS

banner - Create a banner of text

$ banner David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment