From 8e7a0eff791e5bf808e5a3622c54f703d4107bd3 Mon Sep 17 00:00:00 2001 From: Romain Prieto Date: Mon, 9 Dec 2013 22:12:16 +1100 Subject: [PATCH] Markdown format closer to the output + highlight replacable tokens --- osx/curl.md | 20 ++++++++++---------- osx/grep.md | 25 +++++++++++++------------ osx/less.md | 20 ++++++++++---------- osx/ps.md | 4 ++-- osx/scp.md | 22 ++++++++++------------ osx/tar.md | 16 ++++++++-------- 6 files changed, 53 insertions(+), 54 deletions(-) diff --git a/osx/curl.md b/osx/curl.md index 6a6bcb5bb..fd01697da 100755 --- a/osx/curl.md +++ b/osx/curl.md @@ -1,20 +1,20 @@ # curl -- Transfers data from or to a server -- Supports most protocols including HTTP, FTP, POP +> Transfers data from or to a server +> Supports most protocols including HTTP, FTP, POP -## Head request +- send form-encoded data -`curl --head http://localhost` +`curl --data {{name=bob}} {{http://localhost/form}}` -## Send form-encoded data +- send JSON data -`curl --data name=bob http://localhost/form` +`curl -X POST -H "Content-Type: application/json" -d {{'{"name":"bob"}'}} {{http://localhost/login}}` -## Send JSON data +- specify an HTTP method -`curl -X POST -H "Content-Type: application/json" -d '{"name":"bob"}' http://localhost/login` +`curl -X {{DELETE}} {{http://localhost/item/123}}` -## Specify an HTTP method +- head request -`curl -X DELETE http://localhost/item/123` +`curl --head {{http://localhost}}` diff --git a/osx/grep.md b/osx/grep.md index 73962ec6f..738066ba1 100755 --- a/osx/grep.md +++ b/osx/grep.md @@ -1,23 +1,24 @@ # grep -- Matches patterns in input text -- Supports simple patterns and regular expressions +> Matches patterns in input text +> Supports simple patterns and regular expressions -## Search for an exact string -`grep something FILE` +- search for an exact string + +`grep {{something}} {{file_path}}` -## Use a regex instead of a word +- use a regex -`grep -e ^regex$ FILE` +`grep -e {{^regex$}} {{file_path}}` -## See 3 lines of context +- see 3 lines of context -`grep -C 3 something FILE` +`grep -C 3 {{something}} {{file_path}}` -## Print the count of matches +- print the number of matches -`grep -c something FILE` +`grep -c {{something}} {{file_path}}` -## Use the standard input instead +- use the standard input instead of a file -`cat FILE | grep something` +`cat {{file_path}} | grep {{something}}` diff --git a/osx/less.md b/osx/less.md index cf5dc8eb0..5e4e03c6b 100755 --- a/osx/less.md +++ b/osx/less.md @@ -1,25 +1,25 @@ # less -- Opens a file for reading -- Allows movement and search -- Doesn't read the entire file (suitable for logs) +> Opens a file for reading +> Allows movement and search +> Doesn't read the entire file (suitable for logs) -## Open a file +- open a file -`less source_file` +`less {{source_file}}` -## Page up / down +- page up / down `d (next), D (previous)` -## Start / end of file +- go to start / end of file `g (start), G (end)` -## Search for a string +- search for a string -`/something then n (next), N (previous)` +`/{{something}} then n (next), N (previous)` -## Exit +- exit `q` diff --git a/osx/ps.md b/osx/ps.md index 425d0709d..6f472f5e5 100755 --- a/osx/ps.md +++ b/osx/ps.md @@ -1,7 +1,7 @@ # ps -- Information about running processes +> Information about running processes -## List all running processes +- list all running processes `ps aux` diff --git a/osx/scp.md b/osx/scp.md index 4968c70af..af7681e98 100755 --- a/osx/scp.md +++ b/osx/scp.md @@ -1,20 +1,18 @@ # scp -- Copies files between hosts on a network -- Works over a secure connection (SSH) +> Copies files between hosts on a network +> Works over a secure connection (SSH) -## Uploading a file +- upload a file or directory -`scp local_file 10.0.0.1:/remote/path/filename` +`scp {{/local/file}} {{10.0.0.1}}:{{/remote/path/}}` +`scp {{/local/file}} {{10.0.0.1}}:{{/remote/path/newname}}` +`scp -r {{/local/folder}} {{10.0.0.1}}:{{/remote/path/}}` -## Uploading a directory +- download a file (reversed) -`scp -r local_folder 10.0.0.1:/remote/path/` +`scp {{10.0.0.1}}:{{/remote/path/filename}} {{/local/file}}` -## Downloading a file +- specify credentials -`scp 10.0.0.1:/remote/path/filename local_file` - -## Specifying credentials - -`scp local_file my_user@10.0.0.1:/remote/path` +`scp {{/local/file}} {{my_user}}@{{10.0.0.1}}:{{/remote/path/}}` diff --git a/osx/tar.md b/osx/tar.md index 2c66b6e1f..82f178819 100644 --- a/osx/tar.md +++ b/osx/tar.md @@ -1,16 +1,16 @@ # tar -- Archiving utility -- Optional compression with gzip / bzip +> Archiving utility +> Optional compression with gzip / bzip -## create an archive from files +- create an archive from files -`tar cf target.tar file1 file2 file3` +`tar cf {{target.tar}} {{file1 file2 file3}}` -## create a gzipped archive +- create a gzipped archive -`tar cfz target.tar.gz file1 file2 file3` +`tar cfz {{target.tar.gz}} {{file1 file2 file3}}` -## extract an archive in a target folder +- extract an archive in a target folder -`tar xf source.tar -C folder` +`tar xf {{source.tar}} -C {{folder}}`