Prechádzať zdrojové kódy

Merge branch 'convmv-page' of github.com:joelhy/tldr into convmv-page

Joel Huang 9 rokov pred
rodič
commit
bd4c37658d
52 zmenil súbory, kde vykonal 538 pridanie a 72 odobranie
  1. 20 4
      CONTRIBUTING.md
  2. 13 4
      Makefile
  3. 9 7
      README.md
  4. 16 4
      pages/common/ar.md
  5. 23 0
      pages/common/bashmarks.md
  6. 6 2
      pages/common/cat.md
  7. 4 0
      pages/common/convert.md
  8. 15 0
      pages/common/cowsay.md
  9. 15 0
      pages/common/emacs.md
  10. 1 1
      pages/common/gem.md
  11. 4 0
      pages/common/git-diff.md
  12. 15 0
      pages/common/gradle.md
  13. 15 0
      pages/common/host.md
  14. 27 0
      pages/common/last.md
  15. 2 2
      pages/common/mysql.md
  16. 4 4
      pages/common/mysqldump.md
  17. 18 9
      pages/common/nmap.md
  18. 8 0
      pages/common/npm.md
  19. 27 0
      pages/common/parallel.md
  20. 4 4
      pages/common/passwd.md
  21. 3 7
      pages/common/pgrep.md
  22. 19 0
      pages/common/phpunit.md
  23. 12 0
      pages/common/pkill.md
  24. 5 1
      pages/common/psql.md
  25. 3 3
      pages/common/salt.md
  26. 1 2
      pages/common/sed.md
  27. 15 0
      pages/common/sl.md
  28. 19 0
      pages/common/strings.md
  29. 11 0
      pages/common/tac.md
  30. 3 3
      pages/common/touch.md
  31. 23 0
      pages/common/vagrant.md
  32. 16 0
      pages/common/virtualenv.md
  33. 7 0
      pages/common/whoami.md
  34. 15 0
      pages/linux/apt-cache.md
  35. 19 0
      pages/linux/dd.md
  36. 1 1
      pages/linux/hostname.md
  37. 4 0
      pages/linux/shutdown.md
  38. 11 0
      pages/linux/ssh-copy-id.md
  39. 19 0
      pages/linux/timedatectl.md
  40. 19 0
      pages/linux/ulimit.md
  41. 0 0
      pages/linux/useradd.md
  42. 0 0
      pages/linux/userdel.md
  43. 0 0
      pages/linux/usermod.md
  44. 23 0
      pages/linux/xrandr.md
  45. 1 1
      pages/linux/yum.md
  46. 19 0
      pages/osx/dd.md
  47. 0 4
      pages/osx/diskutil.md
  48. 15 0
      pages/osx/ditto.md
  49. 1 1
      pages/osx/hostname.md
  50. 2 2
      pages/osx/mdfind.md
  51. 1 1
      pages/osx/netstat.md
  52. 5 5
      pages/osx/open.md

+ 20 - 4
CONTRIBUTING.md

@@ -82,7 +82,7 @@ Detailed explanation:
    git checkout -b <topic-branch-name>
    ```
 
-5. Run `make lint` to check that your page(s) are correct.
+5. Run `make lint` to check that your page(s) are correct. Try to run the commands you are describing to ensure the syntax is correct.
 
 6. Please use the following commit message format: 
    `<command>: type of change`.
@@ -102,15 +102,31 @@ Detailed explanation:
 
 8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
     with a clear title and description.
+    
+    If page is not about a standard Unix/Linux tool, please include a link to the tool home page.
+    
+    If you are changing something non-trivial, not just adding a page for a new tool, please describe why you are doing this.
 
 9. Use Git's
    [interactive rebase](https://help.github.com/articles/interactive-rebase)
    feature to tidy up your commits before making them public.
+   
+   If you are not familiar with `git rebase`, it might be helpful to check out these video tutorials:
+   - [Git Rebase: squash last commits](https://www.youtube.com/watch?v=qh9KtjfjzCU)
+   - [Learning Git Tutorial: Interactive Rebasing](https://www.youtube.com/watch?v=NW46XmvJh5Q)
+   
    In most cases it is better to squash commits before submitting a pull request.
 
-10. If you are asked to amend your changes before they can be merged in, please
-   use `git commit --amend` and force push to your remote feature branch.
-   You may also be asked to squash commits.
+10. If you do not want to do a rebasing, you can overwrite your last commit in pull request, while you have only a single commit. You can achieve this with `git commit --amend` command.
+
+   ```bash
+   # When you are on topic branch of your pull request
+   # Fix your files
+   
+   git add .              # Register edited files
+   git commit --amend     # Do amended commit
+   git push --force       # Overwrite your branch
+   ```
 
 
 ## Licensing

+ 13 - 4
Makefile

@@ -1,7 +1,5 @@
 default: lint
 
-all: setup index
-
 index:
 	@echo "WARNING!"
 	@echo "Index rebuilding is deprecated."
@@ -10,7 +8,18 @@ index:
 	@TLDRHOME=`pwd` ./scripts/build_index.rb
 	@echo "Index rebuilt."
 
-setup: hooks deps
+setup: prerequisites hooks deps
+
+prerequisites:
+	@echo
+	@echo "IMPORTANT!"
+	@echo "Before setting up hooks, make sure you have read Contributing Guidelines"
+	@echo "https://github.com/tldr-pages/tldr/blob/master/CONTRIBUTING.md#submitting-a-pull-request"
+	@echo
+	@echo "TL;DR:"
+	@echo "1. Install Ruby suitable for your system"
+	@echo "2. Run 'gem install bundler'"
+	@echo
 
 hooks:
 	@cp ./scripts/pre-commit .git/hooks
@@ -24,4 +33,4 @@ deps:
 lint:
 	@bundle exec mdl --style ./scripts/markdown-style.rb pages
 
-.PHONY: default index setup hooks deps lint
+.PHONY: default index setup prerequisites hooks deps lint

+ 9 - 7
README.md

@@ -41,21 +41,23 @@ for the most common UNIX / Linux / OSX / SunOS commands.
 You can access these pages on your computer using one of the following clients:
 
 - [Node.js client](https://github.com/tldr-pages/tldr-node-client) : `npm install -g tldr`
-- [Python client](https://github.com/tldr-pages/tldr-python-client) : `pip install tldr`
-- [Python client](https://github.com/lord63/tldr.py): `pip install tldr.py`
+- Python clients:
+  - [tldr-python-client](https://github.com/tldr-pages/tldr-python-client) : `pip install tldr`
+  - [tldr.py](https://github.com/lord63/tldr.py): `pip install tldr.py`
 - [Go client](https://github.com/pranavraja/tldr): `go get github.com/pranavraja/tldr`
-  or [platform binaries](https://github.com/pranavraja/tldr/releases)
-- [Elixir client](https://github.com/tldr-pages/tldr_elixir_client): binaries available soon
+  (or [platform binaries](https://github.com/pranavraja/tldr/releases))
+- [Elixir client](https://github.com/tldr-pages/tldr_elixir_client) (binaries not yet available)
 - [C++ client](https://github.com/tldr-pages/tldr-cpp-client): `brew tap tldr-pages/tldr && brew install tldr`
-- Android client:
+- Android clients:
   - [tldr-viewer](https://github.com/gianasista/tldr-viewer), available on
     [Google Play](https://play.google.com/store/apps/details?id=de.gianasista.tldr_viewer)
   - [tldroid](https://github.com/hidroh/tldroid), available on
     [Google Play](https://play.google.com/store/apps/details?id=io.github.hidroh.tldroid)
 - [Ruby client](https://github.com/YellowApple/tldrb): `gem install tldrb`
+- [Rust client](https://github.com/rilut/rust-tldr): `cargo install tldr`
 - [R client](https://github.com/kirillseva/tldrrr): `devtools::install_github('kirillseva/tldrrr')`
-- [Web client](https://github.com/ostera/tldr.js): try tldr on your browser
-  [here](https://ostera.github.io/tldr.js)!
+- [Dart client](https://github.com/hterkelsen/tldr): `pub global activate tldr`
+- [Web client](https://github.com/ostera/tldr.jsx): https://ostera.github.io/tldr.jsx
 
 Let us know if you are building one and we can add it to this list!
 

+ 16 - 4
pages/common/ar.md

@@ -2,10 +2,22 @@
 
 > Create, modify, and extract from archives (.a .so .o)
 
-- Extract members of the archive
+- Extract all members from an archive
 
-`ar -x libfoo.a`
+`ar -x {{libfoo.a}}`
 
-- List the content (files) of libfoo.a
+- List the members of an archive
 
-`ar -t libfoo.a`
+`ar -t {{libfoo.a}}`
+
+- Replace or add files to an archive
+
+`ar -r {{libfoo.a}} {{foo.o}} {{bar.o}} {{baz.o}}`
+
+- Insert an object file index (equivalent to using `ranlib`)
+
+`ar -s {{libfoo.a}}`
+
+- Create an archive with files and an accompanying object file index
+
+`ar -rs {{libfoo.a}} {{foo.o}} {{bar.o}} {{baz.o}}`

+ 23 - 0
pages/common/bashmarks.md

@@ -0,0 +1,23 @@
+# bashmarks
+
+> Save and jump to commonly used directories using 1 character commands.
+
+- List available bookmarks
+
+`l`
+
+- Save the current folder as "bookmark_name"
+
+`s {{bookmark_name}}`
+
+- Go to a bookmarked folder
+
+`g {{bookmark_name}}`
+
+- Print a bookmarked folder's contents
+
+`p {{bookmark_name}}`
+
+- Delete a bookmark
+
+`d {{bookmark_name}}`

+ 6 - 2
pages/common/cat.md

@@ -2,10 +2,14 @@
 
 > Print and concatenate files.
 
-- Print the contents of *file1* to the standard output
+- Print the contents of a file to the standard output
 
-`cat {{file1}}`
+`cat {{file}}`
 
 - Concatenate several files into the target file.
 
 `cat {{file1}} {{file2}} > {{target-file}}`
+
+- Append serveral files into the target file.
+
+`cat {{file1}} {{file2}} >> {{target-file}}`

+ 4 - 0
pages/common/convert.md

@@ -10,6 +10,10 @@
 
 `convert {{image.png}} -resize 50% {{image2.png}}`
 
+- Scale an image keeping the original aspect ratio to a maximum dimension of 640x480.
+
+`convert {{image.png}} -resize 640x480 {{image2.png}}`
+
 - Horizontally append images
 
 `convert {{image1.png}} {{image2.png}} {{image3.png}} +append {{image123.png}}`

+ 15 - 0
pages/common/cowsay.md

@@ -0,0 +1,15 @@
+# cowsay
+
+> Generate an ASCII character like a cow or sheep saying or thinking something
+
+- Print an ASCII cow saying "Hello world!"
+
+`cowsay "Hello world!"`
+
+- Print an ASCII dragon saying "Hello!"
+
+`echo "Hello!" | cowsay -f dragon`
+
+- Print a stoned thinking ASCII cow
+
+`cowthink -s "I'm just a cow, not a great thinker ..."`

+ 15 - 0
pages/common/emacs.md

@@ -0,0 +1,15 @@
+# emacs
+
+> The extensible, customizable, self-documenting, real-time display editor
+
+- Open emacs in console mode (without X window)
+
+`emacs -nw`
+
+- Open a file in emacs
+
+`emacs {{filename}}`
+
+- Exit emacs
+
+`C-x C-c`

+ 1 - 1
pages/common/gem.md

@@ -8,7 +8,7 @@
 
 - Install specific version of a gem
 
-`gem install -v={{0.0.15}}`
+`gem install {{gemname}} -v {{1.0.0}}`
 
 - Update a gem
 

+ 4 - 0
pages/common/git-diff.md

@@ -13,3 +13,7 @@
 - Output a condensed summary of extended header information.
 
 `git diff --summary {{PATHSPEC}}`
+
+- Show staged (added, but not yet committed) changes only.
+
+`git diff --staged`

+ 15 - 0
pages/common/gradle.md

@@ -0,0 +1,15 @@
+# Gradle
+
+> Gradle is the official build system for Android Studio
+
+- Compile a package
+
+`gradle build`
+
+- Clear the build folder
+
+`gradle clean`
+
+- Compile and Release package
+
+`gradle assembleRelease`

+ 15 - 0
pages/common/host.md

@@ -0,0 +1,15 @@
+# host
+
+> Lookup Domain Name Server
+
+- Lookup A, AAAA, and MX records of a domain
+
+`host {{domain}}`
+
+- Lookup a field (CNAME, TXT,...) of a domain
+
+`host -t {{field}} {{domain}}`
+
+- Reverse lookup an IP
+
+`host {{ip_address}}`

+ 27 - 0
pages/common/last.md

@@ -0,0 +1,27 @@
+# last
+
+> View the last logged in users
+
+- view last logins, their duration  and other information as read from /var/log/wtmp
+
+`last`
+
+- specify how many of the last logins to show
+
+`last -n {{login_count}}`
+
+- view full login times and dates
+
+`last -F`
+
+- view the last login by a specific user
+
+`last {{user_name}}`
+
+- view the last reboot (last login of the pseudo user reboot)
+
+`last reboot`
+
+- view the last shutdown (last login of the pseudo user shutdown)
+
+`last shutdown`

+ 2 - 2
pages/common/mysql.md

@@ -6,9 +6,9 @@
 
 `mysql {{database_name}}`
 
-- Connect to a database using credentials
+- Connect to a database, user will be prompted for a password
 
-`mysql -u {{user}} -p{{password}} {{database_name}}`
+`mysql -u {{user}} --password {{database_name}}`
 
 - Execute SQL statements in a script file (batch file)
 

+ 4 - 4
pages/common/mysqldump.md

@@ -2,10 +2,10 @@
 
 > Backups mysql databases
 
-- creating a backup
+- Create a backup, user will be prompted for a password
 
-`mysqldump -u {{user}} -p{{password}} {{database_name}} > {{filename.sql}}`
+`mysqldump -u {{user}} --password {{database_name}} > {{filename.sql}}`
 
-- restoring a backup
+- Restoring a backup, user will be prompted for a password
 
-`mysql -u {{user}} -p{{password}} {{database_name}} < {{filename.sql}}`
+`mysql -u {{user}} --password {{database_name}} < {{filename.sql}}`

+ 18 - 9
pages/common/nmap.md

@@ -1,19 +1,28 @@
 # nmap
 
-> Network exploration tool and security / port scanner
+> Network exploration tool and security / port scanner.
+> Some features only activate when Nmap is run with privileges.
 
-- scan open ports of a single host
+- Try to determine whether the specified hosts are up and what are their names.
 
-`nmap {{192.168.0.1}}`
+`nmap -sn {{ip_or_hostname}} {{optional_another_address}}`
 
-- discover hosts in the 192.168.0.X area (no port scan)
+- Like above, but also run a default 1000-port TCP scan if host seems up.
 
-`nmap -sn {{192.168.0.1/24}}`
+`nmap {{ip_or_hostname}} {{optional_another_address}}`
 
-- faster scan of a single host (scans for common ports)
+- Also enable service detection, OS fingerprinting and traceroute.
 
-`nmap -F {{192.168.0.1}}`
+`nmap -A {{address_or_addresses}}`
 
-- faster scan of a subnet (scans for common ports)
+- Assume good network connection and speed up execution:
 
-`nmap -F {{192.168.0.1/24}}`
+`nmap -T4 {{address_or_addresses}}`
+
+- Scan a specific list of ports (use -p- for all ports 1-65535)
+
+`nmap -p {{port1,port2,...,portN}} {{address_or_addresses}}`
+
+- Perform TCP and UDP scanning (use -sU for UDP only, -sZ for SCTP, -sO for IP):
+
+`nmap -sSU {{address_or_addresses}}`

+ 8 - 0
pages/common/npm.md

@@ -10,6 +10,10 @@
 
 `npm install`
 
+- Download and install a module globally
+
+`npm install -g {{module_name}}`
+
 - Download a given dependency, and add it to the package.json
 
 `npm install {{module_name}}@{{version}} --save`
@@ -21,3 +25,7 @@
 - Publish the current project
 
 `npm publish`
+
+- Cleanup packages (removes packages which are installed but are not listed in `package.json`)
+
+`npm prune`

+ 27 - 0
pages/common/parallel.md

@@ -0,0 +1,27 @@
+# GNU Parallel
+
+> Run commands on multiple CPU cores
+
+- gzip several files at once, using all cores
+
+`parallel gzip ::: {{file1}} {{file2}} {{file3}}`
+
+- read arguments from stdin, run 4 jobs at once
+
+`ls *.txt | parallel -j4 gzip`
+
+- Convert JPG images to PNG using replacement strings
+
+`parallel convert {} {.}.png ::: *.jpg`
+
+- parallel xargs, cram as many args as possible onto one command
+
+`{{args}} | parallel -X {{command}}`
+
+- break stdin into ~1M blocks, feed each block to stdin of new command
+
+`cat {{bigfile.txt}} | parallel --pipe --block 1M {{command}}`
+
+- run on multiple machines via SSH
+
+`parallel -S {{machine1}},{{machine2}} {{command}} ::: {{arg1}} {{arg2}}`

+ 4 - 4
pages/common/passwd.md

@@ -2,18 +2,18 @@
 
 > passwd is a tool used to change a user's password.
 
-* Change the password of the current user
+- Change the password of the current user
 
 `passwd {{new password}}`
 
-* Change the password of the specified user
+- Change the password of the specified user
 
 `passwd {{username}} {{new password}}`
 
-* Get the current statuts of the user
+- Get the current statuts of the user
 
 `passwd -S`
 
-* Make the password of the account blank (it will set the named account passwordless)
+- Make the password of the account blank (it will set the named account passwordless)
 
 `passwd -d`

+ 3 - 7
pages/common/pgrep.md

@@ -4,16 +4,12 @@
 
 - return PIDs of any running processes with a matching command string
 
-`pgrep {{Finder}}`
+`pgrep {{process_name}}`
 
 - search full command line with parameters instead of just the process name
 
-`pgrep -f "{{ssh root}}"`
+`pgrep -f "{{process_name}} {{parameter}}"`
 
 - search for process run by a specific user
 
-`pgrep -u root {{firefox}}`
-
-- kill all processes which match
-
-`pkill -9 {{Finder}}`
+`pgrep -u root {{process_name}}`

+ 19 - 0
pages/common/phpunit.md

@@ -0,0 +1,19 @@
+# phpunit
+
+> PHPUnit command-line test runner
+
+- Run tests in the current direcotry. Note: Expects you to have a 'phpunit.xml'
+
+`phpunit`
+
+- Run tests in a specific file.
+
+`phpunit {{path/to/TestFile.php}}`
+
+- Run tests annotated with the given group.
+
+`phpunit --group {{name}}`
+
+- Run tests and generate a coverage report in HTML.
+
+`phpunit --coverage-html {{directory}}`

+ 12 - 0
pages/common/pkill.md

@@ -0,0 +1,12 @@
+# pkill
+
+> Signal process by name
+> Mostly used for stopping processes
+
+- kill all processes which match
+
+`pkill -9 {{process_name}}`
+
+- send SIGUSR1 signal to processes which match
+
+`pkill -USR1 {{process_name}}`

+ 5 - 1
pages/common/psql.md

@@ -6,10 +6,14 @@
 
 `psql {{database}}`
 
-- Connect to *database* on given server *host* running on given *port* with *username* given
+- Connect to *database* on given server *host* running on given *port* with *username* given, no password prompt
 
 `psql -h {{host}} -p {{port}} -U {{username}} {{database}}`
 
+- Connect to *database*, user will be prompted for password
+
+`psql -h {{host}} -p {{port}} -U {{username}} -W {{database}}`
+
 - Run single *query* against the given *database*. Note: useful in shell scripts
 
 `psql -c '{{query}}' {{database}}`

+ 3 - 3
pages/common/salt.md

@@ -8,12 +8,12 @@
 
 - Execute a highstate on all connected minions:
 
-`salt '*' state.highstate
+`salt '*' state.highstate`
 
 - Upgrade packages using the OS package manager (apt, yum, brew) on a subset of minions
 
-`salt '*.domain.com' pkg.upgrade
+`salt '*.domain.com' pkg.upgrade`
 
 - Execute an arbitrary command on a particular minion:
 
-`salt '{{minion_id}}' cmd.run "ls "
+`salt '{{minion_id}}' cmd.run "ls "`

+ 1 - 2
pages/common/sed.md

@@ -6,8 +6,7 @@
 
 `sed 's/{{find}}/{{replace}}/g' {{filename}}`
 
-- replace all occurrences of a string in a file, and overwrite the file
-  contents
+- replace all occurrences of a string in a file, and overwrite the file contents
 
 `sed -i 's/{{find}}/{{replace}}/g' {{filename}}`
 

+ 15 - 0
pages/common/sl.md

@@ -0,0 +1,15 @@
+# sl
+
+> Steam locomotive running through your terminal.
+
+- Let a steam locomotive run through your terminal.
+
+`sl`
+
+- The train burns, people scream.
+
+`sl -a`
+
+- Let the train fly.
+
+`sl -F`

+ 19 - 0
pages/common/strings.md

@@ -0,0 +1,19 @@
+# strings
+
+> Find printable strings in an object file or binary
+
+- Print all strings in a binary
+
+`strings {{file}}`
+
+- Limit results to strings at least *length* characters long
+
+`strings -n {{length}} {{file}}`
+
+- Prefix each result with its offset within the file
+
+`strings -t d {{file}}`
+
+- Prefix each result with its offset within the file in hexadecimal
+
+`strings -t x {{file}}`

+ 11 - 0
pages/common/tac.md

@@ -0,0 +1,11 @@
+# tac
+
+> Print and concatenate files in reverse.
+
+- Print the contents of *file1* reversed to the standard output
+
+`tac {{file1}}`
+
+- Concatenate several files reversed into the target file.
+
+`tac {{file1}} {{file2}} > {{target-file}}`

+ 3 - 3
pages/common/touch.md

@@ -2,14 +2,14 @@
 
 > Change a file access and modification times (atime, mtime)
 
-- Create a new empty file(s) or change the times for existing file(s) to current time.`
+- Create a new empty file(s) or change the times for existing file(s) to current time
 
 `touch {{filename}}`
 
 - Set the times on a file to those specified
 
-`touch -t 201412250801.59 {{filename}}
-`touch -t {{YYYYMMDDHHMM.SS}} {{filename}}
+`touch -t 201412250801.59 {{filename}}`
+`touch -t {{YYYYMMDDHHMM.SS}} {{filename}}`
 
 - Set the times on a file to match those on second file
 

+ 23 - 0
pages/common/vagrant.md

@@ -0,0 +1,23 @@
+# vagrant
+
+> Manage lightweight, reproducible, and portable development environments
+
+- Create Vagrantfile in current folder with the base Vagrant box
+
+`vagrant init`
+
+- Create Vagrantfile with the Ubuntu 14.04 (Trusty Tahr) box from HashiCorp Atlas
+
+`vagrant init ubuntu/trusty32`
+
+- Start and provision the vagrant environment
+
+`vagrant up`
+
+- Suspend the machine
+
+`vagrant suspend`
+
+- Connect to machine via SSH
+
+`vagrant ssh`

+ 16 - 0
pages/common/virtualenv.md

@@ -0,0 +1,16 @@
+# virtualenv
+
+> Create virtual isolated Python environments
+
+- Create a new environment
+
+`virtualenv {{path/to/venv}}`
+
+- Start (select) the environment
+
+`source {{path/to/venv}}/bin/activate`
+
+- Stop the environment
+
+`deactivate`
+

+ 7 - 0
pages/common/whoami.md

@@ -0,0 +1,7 @@
+# whoami
+
+> Show the username of the current user
+
+- Display currently logged user name
+
+`whoami`

+ 15 - 0
pages/linux/apt-cache.md

@@ -0,0 +1,15 @@
+# apt-cache
+
+> Debian and Ubuntu package query tool
+
+- Search for a package in your current sources
+
+`apt-cache search {{query}}`
+
+- Show information about a package
+
+`apt-cache show {{package}}`
+
+- Show whether a package is installed and up to date
+
+`apt-cache policy {{package}}`

+ 19 - 0
pages/linux/dd.md

@@ -0,0 +1,19 @@
+# dd
+
+> convert and copy a file
+
+- Make a bootable usb drive from an isohybrid file (such like archlinux-xxx.iso)
+
+`dd if={{file.iso}} of=/dev/{{usb_drive}}`
+
+- Clone a drive to another drive with 4MB block and ignore error
+
+`dd if=/dev/{{source_drive}} of=/dev/{{dest_drive}} bs=4M conv=noerror`
+
+- Generating a file of 100 random bytes by using kernel random driver
+
+`dd if=/dev/urandom of={{random_file}} bs=100 count=1`
+
+- Benchmark the write performance of a disk
+
+`dd if=/dev/zero of={{file_1GB}} bs=1024 count=1000000`

+ 1 - 1
pages/linux/hostname.md

@@ -1,6 +1,6 @@
 # hostname
 
-Show or set the system's host name
+> Show or set the system's host name
 
 - Show current host name
 

+ 4 - 0
pages/linux/shutdown.md

@@ -14,6 +14,10 @@
 
 `shutdown -r +{{5}} &`
 
+- Shutdown at 1:00 pm (Uses 24h clock)
+
+`shutdown -h 13:00`
+
 - Cancel a pending shutdown/reboot operation
 
 `shutdown -c`

+ 11 - 0
pages/linux/ssh-copy-id.md

@@ -0,0 +1,11 @@
+# ssh-copy-id
+
+> Install your public key in a remote machine's authorized_keys.
+
+- Copy the given public key to the remote
+
+`ssh-copy-id -i {{path/to/certificate}} {{username}}@{{remote_host}}`
+
+- Copy the given public key to the remote with specific port
+
+`ssh-copy-id -i {{path/to/certificate}} -p {{port}} {{username}}@{{remote_host}}`

+ 19 - 0
pages/linux/timedatectl.md

@@ -0,0 +1,19 @@
+# timedatectl
+
+> Control the system time and date
+
+- To check the current system clock time
+
+`timedatectl`
+
+- To set the local time of the system clock directly
+
+`timedatectl set-time {{"yyyy-MM-dd hh:mm:ss"}}`
+
+- To list available timezones
+
+`timedatectl list-timezones`
+
+- To change timezones
+
+`timedatectl set-timezone {{timezone}}`

+ 19 - 0
pages/linux/ulimit.md

@@ -0,0 +1,19 @@
+# ulimit
+
+> Get and set user limits
+
+- get the properties of all the user limits
+
+`ulimit -a`
+
+- get hard limit for the number of simultaneously opened files
+
+`ulimit -H -n`
+
+- get soft limit for the number of simultaneously opened files
+
+`ulimit -S -n`
+
+- set max per-user process limit
+
+`ulimit -u 30`

+ 0 - 0
pages/common/useradd.md → pages/linux/useradd.md


+ 0 - 0
pages/common/userdel.md → pages/linux/userdel.md


+ 0 - 0
pages/common/usermod.md → pages/linux/usermod.md


+ 23 - 0
pages/linux/xrandr.md

@@ -0,0 +1,23 @@
+# xrandr
+
+> Set the size, orientation and/or reflection of the outputs for a screen
+
+- Display the current state of the system (known screens, resolutions, ...)
+
+`xrandr --query`
+
+- Disable disconnected outputs and enable connected ones with default settings
+
+`xrandr --auto`
+
+- Change the resolution and update frequency of DisplayPort 1 to 1920x1080, 60Hz
+
+`xrandr --output {{DP1}} --mode {{1920x1080}} --rate {{60}}`
+
+- Set the resolution of HDMI2 to 1280x1024 and put it on the right of DP1
+
+`xrandr --output {{HDMI2}} --mode {{1280x1024}} --right-of {{DP1}}`
+
+- Disable the VGA1 output
+
+`xrandr --output {{VGA1}} --off`

+ 1 - 1
pages/linux/yum.md

@@ -10,7 +10,7 @@
 
 `yum install {{package}}`
 
-- Install a new package and assume yes to all questions (Also works with update, great for automated updates)
+- Install a new package and assume yes to all questions (also works with update, great for automated updates)
 
 `yum -y install {{package}}`
 

+ 19 - 0
pages/osx/dd.md

@@ -0,0 +1,19 @@
+# dd
+
+> convert and copy a file
+
+- Make a bootable usb drive from an isohybrid file (such like archlinux-xxx.iso)
+
+`dd if={{file.iso}} of=/dev/{{usb_drive}}`
+
+- Clone a drive to another drive with 4MB block and ignore error
+
+`dd if=/dev/{{source_drive}} of=/dev/{{dest_drive}} bs=4m conv=noerror`
+
+- Generating a file of 100 random bytes by using kernel random driver
+
+`dd if=/dev/urandom of={{random_file}} bs=100 count=1`
+
+- Benchmark the write performance of a disk
+
+`dd if=/dev/zero of={{file_1GB}} bs=1024 count=1000000`

+ 0 - 4
pages/osx/diskutil.md

@@ -6,10 +6,6 @@
 
 `diskutil list`
 
-- Repair permissions on a volume
-
-`diskutil repairPermissions {{/Volumes/Name}}`
-
 - Repair the file system data structures of a volume
 
 `diskutil repairVolume {{/dev/diskX}}`

+ 15 - 0
pages/osx/ditto.md

@@ -0,0 +1,15 @@
+# ditto
+
+> Copy files and folders
+
+- Overwrites contents of destination folder with contents of source folder
+
+`ditto {{path/to/source}} {{path/to/destination}}`
+
+- print a line to the Terminal window for every file that’s being copied
+
+`ditto -V {{path/to/source}} {{path/to/destination}}`
+
+- copy a given file or folder, while retaining the original file permissions.
+
+`ditto -rsrc {{path/to/source}} {{path/to/destination}}`

+ 1 - 1
pages/osx/hostname.md

@@ -1,6 +1,6 @@
 # hostname
 
-Show or set the system's host name
+> Show or set the system's host name
 
 - Show current host name
 

+ 2 - 2
pages/osx/mdfind.md

@@ -2,11 +2,11 @@
 
 > List files matching a given query
 
-- Find a file by it's name
+- Find a file by its name
 
 `mdfind -name {{file}}`
 
-- Find a file by it's content
+- Find a file by its content
 
 `mdfind {{query}}`
 

+ 1 - 1
pages/osx/netstat.md

@@ -18,6 +18,6 @@
 
 `netstat -p {PROTOCOL}`
 
-- List information continiously
+- List information continuously
 
 `netstat -c`

+ 5 - 5
pages/osx/open.md

@@ -4,11 +4,11 @@
 
 - Open a file with the associated application
 
-`open filename.ext`
+`open {{file.ext}}`
 
 - Run a graphical MacOSX application
 
-`open /Applications/iTunes.app`
+`open /Applications/{{Application.app}}`
 
 - Open the current directory in Finder
 
@@ -16,8 +16,8 @@
 
 - Reveal a file in finder
 
-`open -R /path/dir/file`
+`open -R /path/dir/{{file}}`
 
-- Open all the word docs in the current directory with Microsoft Word
+- Open all the files of a given extension in the current directory with the associated application
 
-`open *.doc`
+`open {{*.ext}}`