Merge remote-tracking branch 'upstream/master'
Conflicts: pages/common/touch.md
This commit is contained in:
19
pages/common/7za.md
Normal file
19
pages/common/7za.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# 7za
|
||||
|
||||
> A file archiver with high compression ratio
|
||||
|
||||
- compress directory or file
|
||||
|
||||
`7za a {{compressed.7z}} {{directory_or_file_to_compress}}`
|
||||
|
||||
- decompress an existing 7z file with original directory structure
|
||||
|
||||
`7za x {{compressed.7z}}`
|
||||
|
||||
- compress to zip format
|
||||
|
||||
`7za a -tzip {{compressed.zip}} {{directory_or_file_to_compress}}`
|
||||
|
||||
- create multipart 7zip file; `part_size` specifies part size in Bytes, Kilobytes, Megabytes or Gigabytes.
|
||||
|
||||
`7za -v{{part_size}}{{[b|k|m|g]}} {{compressed.7z}} {{directory_or_file_to_compress}}`
|
19
pages/common/adb.md
Normal file
19
pages/common/adb.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Android Debug Bridge
|
||||
|
||||
> Communicate with an Android emulator instance or connected Android devices
|
||||
|
||||
- Check whether the adb server process is running and start it
|
||||
|
||||
`adb start-server`
|
||||
|
||||
- Terminate the adb server process
|
||||
|
||||
`adb kill-server`
|
||||
|
||||
- Start a remote shell in the target emulator/device instance
|
||||
|
||||
`adb shell`
|
||||
|
||||
- Push an Android application to an emulator/device
|
||||
|
||||
`adb install -r {{apk.path}}`
|
20
pages/common/bash.md
Normal file
20
pages/common/bash.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# bash
|
||||
|
||||
> Bourne-Again SHell
|
||||
> `sh`-compatible command line interpreter.
|
||||
|
||||
- Start interactive command line interpreter
|
||||
|
||||
`bash`
|
||||
|
||||
- Execute command passed as parameter
|
||||
|
||||
`bash -c {{command}}`
|
||||
|
||||
- Run commands from file (script)
|
||||
|
||||
`bash {{file}}`
|
||||
|
||||
- Run commands from file and print them as they are executed
|
||||
|
||||
`bash -x {{file}}`
|
23
pages/common/bashmarks.md
Normal file
23
pages/common/bashmarks.md
Normal file
@@ -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}}`
|
15
pages/common/cowsay.md
Normal file
15
pages/common/cowsay.md
Normal file
@@ -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 ..."`
|
@@ -5,7 +5,7 @@
|
||||
|
||||
- Download a URL to a file
|
||||
|
||||
`curl "{{URL}}" -o filename`
|
||||
`curl "{{URL}}" -o {{filename}}`
|
||||
|
||||
- send form-encoded data
|
||||
|
||||
|
@@ -18,3 +18,11 @@
|
||||
- Stop a container
|
||||
|
||||
`docker stop {{container}}`
|
||||
|
||||
- Start a container from an image and get a shell inside of it
|
||||
|
||||
`docker run -it {{image}} bash`
|
||||
|
||||
- Run a command inside of an already running container
|
||||
|
||||
`docker exec {{container}} {{command}}`
|
||||
|
19
pages/common/enca.md
Normal file
19
pages/common/enca.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# enca
|
||||
|
||||
> Detect and convert encoding of text files
|
||||
|
||||
- detect file(s) encoding according to your system's locale
|
||||
|
||||
`enca {{file(s)}}`
|
||||
|
||||
- detect file(s) encoding; -L option tells enca the current language; language is in the POSIX/C locale format, e.g. zh_CN, en_US etc.
|
||||
|
||||
`enca -L {{language}} {{file(s)}}`
|
||||
|
||||
- convert file(s) to specified encoding
|
||||
|
||||
`enca -L {{language}} -x {{to_encoding}} {{file(s)}}`
|
||||
|
||||
- save original_file as new_file and convert new_file to specified encoding
|
||||
|
||||
`enca -L {{language}} -x {{to_encoding}} < {{original_file}} > {{new_file}}`
|
27
pages/common/fortune.md
Normal file
27
pages/common/fortune.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# fortune
|
||||
|
||||
> Print a random quotation (fortune-cookie style)
|
||||
|
||||
- Print a quotation
|
||||
|
||||
`fortune`
|
||||
|
||||
- Print a quotation from a given database
|
||||
|
||||
`fortune {{database}}`
|
||||
|
||||
- Print a list of quotation databases
|
||||
|
||||
`fortune -f`
|
||||
|
||||
- Print an offensive quotation
|
||||
|
||||
`fortune -o`
|
||||
|
||||
- Print a long quotation
|
||||
|
||||
`fortune -l`
|
||||
|
||||
- Print a short quotation
|
||||
|
||||
`fortune -s`
|
15
pages/common/git-svn.md
Normal file
15
pages/common/git-svn.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# git svn
|
||||
|
||||
> Bidirectional operation between a Subversion repository and Git
|
||||
|
||||
- clone an SVN repository
|
||||
|
||||
`git svn clone {{http://example.com/my_subversion_repo}} {{local_dir}}`
|
||||
|
||||
- update local clone from the upstream SVN repository
|
||||
|
||||
`git svn rebase`
|
||||
|
||||
- commit back to SVN repository
|
||||
|
||||
`git svn dcommit`
|
@@ -23,6 +23,10 @@
|
||||
|
||||
`grep -c {{something}} {{file_path}}`
|
||||
|
||||
- print line number for each match
|
||||
|
||||
`grep -n {{something}} {{file_path}}`
|
||||
|
||||
- use the standard input instead of a file
|
||||
|
||||
`cat {{file_path}} | grep {{something}}`
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# host
|
||||
|
||||
Lookup Domain Name Server
|
||||
> Lookup Domain Name Server
|
||||
|
||||
- Lookup A, AAAA, and MX records of a domain
|
||||
|
||||
|
17
pages/common/ionice.md
Normal file
17
pages/common/ionice.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# ionice
|
||||
|
||||
> Get or set program I/O scheduling class and priority.
|
||||
> Scheduling classes: 1 (realtime), 2 (best-effort), 3 (idle).
|
||||
> Priority levels: 0 (the highest) - 7 (the lowest).
|
||||
|
||||
- Set I/O scheduling class of a running process
|
||||
|
||||
`ionice -c {{scheduling_class}} -p {{pid}}`
|
||||
|
||||
- Run a command with custom I/O scheduling class and priority
|
||||
|
||||
`ionice -c {{scheduling_class}} -n {{priority}} {{command}}`
|
||||
|
||||
- Print the I/O scheduling class and priority of a running process
|
||||
|
||||
`ionice -p {{pid}}`
|
27
pages/common/last.md
Normal file
27
pages/common/last.md
Normal file
@@ -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`
|
@@ -10,10 +10,6 @@
|
||||
|
||||
`ln -sf {{path/to/new/original/file}} {{path/to/file/link}}`
|
||||
|
||||
- overwrite a symbolic link to a folder
|
||||
|
||||
`ln -sfT {{path/to/new/original/file}} {{path/to/folder/link}}`
|
||||
|
||||
- create a hard link to a file or folder
|
||||
- create a hard link to a file
|
||||
|
||||
`ln {{path/to/original/file}} {{path/to/link}}`
|
||||
|
27
pages/common/mailx.md
Normal file
27
pages/common/mailx.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# mailx
|
||||
|
||||
> Send and receive mail.
|
||||
|
||||
- To send mail, the content is typed after the command and ended with Control-D
|
||||
|
||||
`mailx -s "{{subject}}" {{to_addr}}`
|
||||
|
||||
- Send mail with short content.
|
||||
|
||||
`echo "{{content}}" | mailx -s "{{subject}}" {{to_addr}}`
|
||||
|
||||
- Send mail with content which written in a file.
|
||||
|
||||
`mailx -s "{{subject}}" {{to_addr}} < {{content.txt}}`
|
||||
|
||||
- Send mail to a recipient and CC to another address.
|
||||
|
||||
`mailx -s "{{subject}}" -c {{cc_addr}} {{to_addr}}`
|
||||
|
||||
- Send mail and set sender address.
|
||||
|
||||
`mailx -s "{{subject}}" -r {{from_addr}} {{to_addr}}`
|
||||
|
||||
- Send mail with an attachment.
|
||||
|
||||
`mailx -a {{file}} -s "{{subject}}" {{to_addr}}`
|
21
pages/common/make.md
Normal file
21
pages/common/make.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# make
|
||||
|
||||
> Task runner for rules described in Makefile.
|
||||
> Mostly used to control the compilation of an executable from source code.
|
||||
|
||||
- Call the all rule
|
||||
|
||||
`make`
|
||||
|
||||
- Call a specific rule
|
||||
|
||||
`make {{rule}}`
|
||||
|
||||
- Use specific Makefile
|
||||
|
||||
`make -f {{file}}`
|
||||
|
||||
- Execute make from another directory
|
||||
|
||||
`make -C {{directory}}`
|
||||
|
23
pages/common/mocha.md
Normal file
23
pages/common/mocha.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# mocha
|
||||
|
||||
> Execute Mocha JavaScript test runner
|
||||
|
||||
- Run tests with default configuration or as configured in `mocha.opts`
|
||||
|
||||
`mocha`
|
||||
|
||||
- Run tests contained at a specific location
|
||||
|
||||
`mocha {{folder/with/tests}}`
|
||||
|
||||
- Run tests that match a specific grep pattern
|
||||
|
||||
`mocha --grep {{^regex$}}`
|
||||
|
||||
- Run tests on changes to JavaScript files in the current directory and once initially
|
||||
|
||||
`mocha --watch`
|
||||
|
||||
- Run tests with a specific reporter
|
||||
|
||||
`mocha --reporter {{reporter}}`
|
@@ -13,3 +13,7 @@
|
||||
- Start server with a prefix for all relative paths in config file
|
||||
|
||||
`nginx -c {{config_file}} -p {{prefix/for/relative/paths}}`
|
||||
|
||||
- Test configuration without affecting the running server
|
||||
|
||||
`nginx -t`
|
||||
|
28
pages/common/pass.md
Normal file
28
pages/common/pass.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# pass
|
||||
|
||||
> safely store and read passwords or other sensitive data easily
|
||||
> all data is GPG-encrypted, and managed with a git repository
|
||||
|
||||
- initialize the storage using a gpg-id for encryption
|
||||
|
||||
`pass init {{gpg_id}}`
|
||||
|
||||
- save a new password (prompts you for the value without echoing it)
|
||||
|
||||
`pass insert {{path/to/data}}`
|
||||
|
||||
- copy a password (first line of the data file) to the clipboard
|
||||
|
||||
`pass -c {{path/to/data}}`
|
||||
|
||||
- list the whole store tree
|
||||
|
||||
`pass`
|
||||
|
||||
- generate a new random password with a given length, and copy it to the clipboard
|
||||
|
||||
`pass generate -c {{path/to/data}} {{num}}`
|
||||
|
||||
- run any git command against the underlying store repository
|
||||
|
||||
`pass git {{git-arguments}}`
|
@@ -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}}`
|
||||
|
12
pages/common/pkill.md
Normal file
12
pages/common/pkill.md
Normal file
@@ -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}}`
|
19
pages/common/sass.md
Normal file
19
pages/common/sass.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Sass
|
||||
|
||||
> Converts SCSS or Sass files to CSS
|
||||
|
||||
- Output converted file to stdout
|
||||
|
||||
`sass {{inputfile.(scss|sass)}}`
|
||||
|
||||
- Immediately convert SCSS or Sass file to CSS to specified output file
|
||||
|
||||
`sass {{inputfile.(scss|sass)}} {{outputfile.css}}`
|
||||
|
||||
- Watch SCSS or Sass file for changes and output or update CSS file with same filename
|
||||
|
||||
`sass --watch {{inputfile.(scss|sass)}}`
|
||||
|
||||
- Watch SCSS or Sass file for changes and output or update CSS file with specified filename
|
||||
|
||||
`sass --watch {{inputfile.(scss|sass)}}:{{outputfile.css}}`
|
15
pages/common/sl.md
Normal file
15
pages/common/sl.md
Normal file
@@ -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`
|
@@ -17,7 +17,7 @@
|
||||
|
||||
- run a command on a remote server
|
||||
|
||||
`ssh {{remote_host}} "{{command -with -flags}}"`
|
||||
`ssh {{remote_host}} {{command -with -flags}}`
|
||||
|
||||
- ssh tunneling: dynamic port forwarding (SOCKS proxy on localhost:9999)
|
||||
|
||||
|
11
pages/common/su.md
Normal file
11
pages/common/su.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# su
|
||||
|
||||
> switch shell to another user
|
||||
|
||||
- Switch to user {{username}} (password required):
|
||||
|
||||
`su {{username}}`
|
||||
|
||||
- Switch to superuser (admin password required):
|
||||
|
||||
`su`
|
@@ -14,9 +14,9 @@
|
||||
|
||||
`tcpdump host {{www.example.com}}`
|
||||
|
||||
- capture the traffic from a specific interface, source, destination and port
|
||||
- capture the traffic from a specific interface, source, destination and destination port
|
||||
|
||||
`tcpdump -i {{eth0}} src {{192.168.1.1}} dest {{192.168.1.2}} and port 80`
|
||||
`tcpdump -i {{eth0}} src {{192.168.1.1}} and dst {{192.168.1.2}} and dst port 80`
|
||||
|
||||
- capture the traffic of a network
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
> 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}}`
|
||||
|
||||
|
19
pages/common/unrar.md
Normal file
19
pages/common/unrar.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# unrar
|
||||
|
||||
> Extract RAR archives
|
||||
|
||||
- extract files with original directory structure
|
||||
|
||||
`unrar x {{compressed.rar}}`
|
||||
|
||||
- extract files into current directory, losing directory structure in the archive
|
||||
|
||||
`unrar e {{compressed.rar}}`
|
||||
|
||||
- test integrity of each file inside the archive file
|
||||
|
||||
`unrar t {{compressed.rar}}`
|
||||
|
||||
- list files inside the archive file without decompressing it
|
||||
|
||||
`unrar l {{compressed.rar}}`
|
@@ -1,19 +0,0 @@
|
||||
# useradd
|
||||
|
||||
> Create a new user
|
||||
|
||||
- Create new user
|
||||
|
||||
`useradd {{name}}`
|
||||
|
||||
- Create new user with a default home directory
|
||||
|
||||
`useradd -m {{name}}`
|
||||
|
||||
- Create new user with specified shell
|
||||
|
||||
`useradd -s {{/path/to/shell}} {{name}}`
|
||||
|
||||
- Create new user with supplementary groups (mind the lack of whitespace)
|
||||
|
||||
`useradd -G {{group1,group2}} {{name}}`
|
@@ -1,7 +0,0 @@
|
||||
# userdel
|
||||
|
||||
> Remove a user
|
||||
|
||||
- Remove a user and their home directory
|
||||
|
||||
`userdel -r {{name}}`
|
@@ -1,15 +0,0 @@
|
||||
# usermod
|
||||
|
||||
> Modifies a user account
|
||||
|
||||
- Change a user's name
|
||||
|
||||
`usermod -l {{newname}} {{user}}`
|
||||
|
||||
- Add user to supplementary groups (mind the whitespace)
|
||||
|
||||
`usermod -a -G {{group1,group2}} {{user}}`
|
||||
|
||||
- Create a new home directory for a user and move their files to it
|
||||
|
||||
`usermod -m -d {{/path/to/home}} {{user}}`
|
23
pages/common/vagrant.md
Normal file
23
pages/common/vagrant.md
Normal file
@@ -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`
|
@@ -1,6 +1,6 @@
|
||||
# vim
|
||||
|
||||
> Vi IMproved, a programmers text editor
|
||||
> Vi IMproved, a programmer's text editor
|
||||
|
||||
- open a file with cursor at the given line number
|
||||
|
||||
|
Reference in New Issue
Block a user