commit 11264d9b19000734a2d35ecbdbdebc0b0b45aed9 Author: Romain Prieto Date: Sun Dec 8 19:56:16 2013 +1100 initial commit diff --git a/osx/curl.md b/osx/curl.md new file mode 100755 index 000000000..6a6bcb5bb --- /dev/null +++ b/osx/curl.md @@ -0,0 +1,20 @@ +# curl + +- Transfers data from or to a server +- Supports most protocols including HTTP, FTP, POP + +## Head request + +`curl --head http://localhost` + +## Send form-encoded data + +`curl --data name=bob http://localhost/form` + +## Send JSON data + +`curl -X POST -H "Content-Type: application/json" -d '{"name":"bob"}' http://localhost/login` + +## Specify an HTTP method + +`curl -X DELETE http://localhost/item/123` diff --git a/osx/grep.md b/osx/grep.md new file mode 100755 index 000000000..73962ec6f --- /dev/null +++ b/osx/grep.md @@ -0,0 +1,23 @@ +# grep + +- Matches patterns in input text +- Supports simple patterns and regular expressions + +## Search for an exact string +`grep something FILE` + +## Use a regex instead of a word + +`grep -e ^regex$ FILE` + +## See 3 lines of context + +`grep -C 3 something FILE` + +## Print the count of matches + +`grep -c something FILE` + +## Use the standard input instead + +`cat FILE | grep something` diff --git a/osx/less.md b/osx/less.md new file mode 100755 index 000000000..cf5dc8eb0 --- /dev/null +++ b/osx/less.md @@ -0,0 +1,25 @@ +# less + +- Opens a file for reading +- Allows movement and search +- Doesn't read the entire file (suitable for logs) + +## Open a file + +`less source_file` + +## Page up / down + +`d (next), D (previous)` + +## Start / end of file + +`g (start), G (end)` + +## Search for a string + +`/something then n (next), N (previous)` + +## Exit + +`q` diff --git a/osx/ps.md b/osx/ps.md new file mode 100755 index 000000000..425d0709d --- /dev/null +++ b/osx/ps.md @@ -0,0 +1,7 @@ +# ps + +- Information about running processes + +## List all running processes + +`ps aux` diff --git a/osx/scp.md b/osx/scp.md new file mode 100755 index 000000000..4968c70af --- /dev/null +++ b/osx/scp.md @@ -0,0 +1,20 @@ +# scp + +- Copies files between hosts on a network +- Works over a secure connection (SSH) + +## Uploading a file + +`scp local_file 10.0.0.1:/remote/path/filename` + +## Uploading a directory + +`scp -r local_folder 10.0.0.1:/remote/path/` + +## Downloading a file + +`scp 10.0.0.1:/remote/path/filename local_file` + +## Specifying credentials + +`scp local_file my_user@10.0.0.1:/remote/path` diff --git a/osx/tar.md b/osx/tar.md new file mode 100644 index 000000000..e26c6a2cd --- /dev/null +++ b/osx/tar.md @@ -0,0 +1,16 @@ +# tar + +- Archiving utility +- Supports tar / gzip / bzip + +## create an archive from files + +`tar cf target.tar file1 file2 file3` + +## create a gzipped archive + +`tar cfz target.tar.gz file1 file2 file3` + +## extract an archive in a target folder + +`tar xf source.tar -C folder`