From 11264d9b19000734a2d35ecbdbdebc0b0b45aed9 Mon Sep 17 00:00:00 2001 From: Romain Prieto Date: Sun, 8 Dec 2013 19:56:16 +1100 Subject: [PATCH] initial commit --- osx/curl.md | 20 ++++++++++++++++++++ osx/grep.md | 23 +++++++++++++++++++++++ osx/less.md | 25 +++++++++++++++++++++++++ osx/ps.md | 7 +++++++ osx/scp.md | 20 ++++++++++++++++++++ osx/tar.md | 16 ++++++++++++++++ 6 files changed, 111 insertions(+) create mode 100755 osx/curl.md create mode 100755 osx/grep.md create mode 100755 osx/less.md create mode 100755 osx/ps.md create mode 100755 osx/scp.md create mode 100644 osx/tar.md diff --git a/osx/curl.md b/osx/curl.md new file mode 100755 index 00000000000000..6a6bcb5bb7177a --- /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 00000000000000..73962ec6f21d77 --- /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 00000000000000..cf5dc8eb07912f --- /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 00000000000000..425d0709dfbc9d --- /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 00000000000000..4968c70af94312 --- /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 00000000000000..e26c6a2cd7671e --- /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`