Move OS X and Linux pages into pages/common

This commit is contained in:
Zlatan Vasović
2014-01-29 22:58:24 +01:00
parent 003659bb99
commit 521ebdc1da
21 changed files with 1 additions and 1 deletions

View File

@@ -1,19 +0,0 @@
# chown
> Change the owning user/group of the specified files
- change the user of a file
`chown {{user}} {{path/to/file}}`
- change the user and group of a file
`chown {{user}}:{{group}} {{path/to/file}}`
- recursively change the owner of an entire folder
`chown -R {{user}} {{path/to/folder}}`
- change the owner of a symbolic link
`chown -h {{user}} {{path/to/symlink}}`

View File

@@ -1,20 +0,0 @@
# curl
> Transfers data from or to a server
> Supports most protocols including HTTP, FTP, POP
- 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}}`
- head request
`curl --head {{http://localhost}}`

View File

@@ -1,12 +0,0 @@
# df
> gives an overview of the file system disk space usage
- display all file systems and their disk usage
`df`
- display all file systems and their disk usage in human readable form
`df -h`

View File

@@ -1,19 +0,0 @@
# du
> Estimate file space usage
- get file sizes of directory's content
`du {{file/directory}}`
- get total size in human readable form
`du -sh {{file/directory}}`
- get recursively, individual file/folder sizes in human readable form
`du -ah {{directory}}`
- get file sizes till a specified depth
`du --max-depth=1`

View File

@@ -1,20 +0,0 @@
# find
> Find files under the given directory tree, recursively
- find files by extension
`find {{root_path}} -name {{'*.py'}}`
- run a command for each file
- use {} within the command to access the filename
`find {{root_path}} -name {{'*.py'}} -exec {{command}} \;`
- find files modified since a certain time
`find {{root_path}} -name {{'*.py'}} -mtime {{-1d}}`
- remove files recursively
`find {{root_path}} -name {{'*.py'}} -exec rm {} \;`

View File

@@ -1,23 +0,0 @@
# git stash
> Stash local Git changes in a temporary area
- stash current changes (except new files)
`git stash {{optional_stash_name}}`
- include new files in the stash (leaves the index completely clean)
`git stash -u {{optional_stash_name}}`
- list all stashes
`git stash list`
- re-apply the latest stash
`git stash pop`
- re-apply a stash by name
`git stash apply {{stash_name}}`

View File

@@ -1,28 +0,0 @@
# grep
> Matches patterns in input text
> Supports simple patterns and regular expressions
- search for an exact string
`grep {{something}} {{file_path}}`
- search recursively in current directory for an exact string
`grep -r {{something}} .`
- use a regex
`grep -e {{^regex$}} {{file_path}}`
- see 3 lines of context
`grep -C 3 {{something}} {{file_path}}`
- print the number of matches
`grep -c {{something}} {{file_path}}`
- use the standard input instead of a file
`cat {{file_path}} | grep {{something}}`

View File

@@ -1,25 +0,0 @@
# 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)`
- go to start / end of file
`g (start), G (end)`
- search for a string
`/{{something}} then n (next), N (previous)`
- exit
`q`

View File

@@ -1,26 +0,0 @@
# ls
> List directory contents
- List all files, even hidden
`ls -a`
- Sorting by size
`ls -s`
- List all files with their rights, groups, owner
`ls -ls`
- List all files with a prefix/suffix
`ls {{prefix}}*` or `ls *{{suffix}}`
- Sort files by time
`-t` for last modified
`-U` for date of creation
`-r` reverses the list
`ls -tr`

View File

@@ -1,15 +0,0 @@
# lsof
> Lists open files and the corresponding processes
- find the processes that have a given file open
`lsof {{/path/to/file}}`
- find the process that opened a local internet port
`lsof -i :{{8080}}`
- only output the process PID (e.g. to pipe into kill)
`lsof -t {{/path/to/file}} | xargs kill -9`

View File

@@ -1,11 +0,0 @@
# mkdir
> Creates a directory
- creates a directory in current folder or given path
`mkdir {{directory}}`
- creates directories recursively (useful for creating nested dirs)
`mkdir -p {{path}}`

View File

@@ -1,7 +0,0 @@
# ps
> Information about running processes
- list all running processes
`ps aux`

View File

@@ -1,21 +0,0 @@
# rsync
> Transfers a file either to or from a remote host
> Does not allow transfer between two remote hosts
> Can transfer single files or files matched by pattern
- transfer file from local to remote host
`rsync {{path_to_file}} {{remote_host_name}}:{{remote_host_location}}`
- transfer file from remote host to local
`rsync {{remote_host_name}}:{{remote_file_location}} {{local_file_location}}`
- transfer all *.js files in current directory to host 'devbox' as user 'mike'
`rsync *.js mike@devbox:~/projects/cakeStore/styles/`
- transfer a directory and all its children from a remote to local
`rsync -r mike@devbox:~/projects/cakeStore /Users/mike/devProjects/`

View File

@@ -1,18 +0,0 @@
# scp
> Copies files between hosts on a network
> Works over a secure connection (SSH)
- upload a file or directory
`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/}}`
- download a file (reversed)
`scp {{10.0.0.1}}:{{/remote/path/filename}} {{/local/file}}`
- specify credentials
`scp {{/local/file}} {{my_user}}@{{10.0.0.1}}:{{/remote/path/}}`

View File

@@ -1,16 +0,0 @@
# sed
> Run replacements based on regular expressions
- replace all occurrences of a string in a file, and print the result
`sed 's/{{find}}/{{replace}}/g' {{filename}}`
- replace all occurrences of a string in a file, and overwrite the file
contents
`sed -i '' 's/{{find}}/{{replace}}/g' {{filename}}`
- replace all occurrences of an extended regular expression in a file
`sed -E 's/{{regex}}/{{replace}}/g' {{filename}}`

View File

@@ -1,23 +0,0 @@
# svn
> Subversion command line client tool
- Check out a working copy from a repository
`svn co {{url/to/repository}}`
- Bring changes from the repository into the working copy
`svn up`
- Put files and directories under version control, scheduling them for addition to repository. They will be added in next commit.
`svn add PATH...`
- Send changes from your working copy to the repository
`svn ci -m {{commit log message}} {{[PATH...]}}`
- Show detailed help
`svn help`

View File

@@ -1,16 +0,0 @@
# tar
> Archiving utility
> Optional compression with 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}}`

View File

@@ -1,8 +0,0 @@
# tldr
> Simplified man pages
- get typical usages of a command
- ps: this is how you got here :)
`tldr {{command}}`

View File

@@ -1,11 +0,0 @@
# unzip
> Extract compressed files in a ZIP archive
- extract zip file(s) (for multiple files, seperate file paths by spaces)
`unzip {{file(s)}}`
- extract zip files(s) to given path
`unzip {{files(s)}} -d {{/path/to/put/extracted/files}}`

View File

@@ -1,16 +0,0 @@
# wc
> Count words, bytes, or lines
- count lines in file
`wc -l {{file}}`
- count bytes in file
`wc -c {{file}}`
- count characters in file (taking multi-byte character sets into account)
`wc -m {{file}}`

View File

@@ -1,7 +0,0 @@
# zip
> package and compress (archive) files into zip file
- package and compress multiple directories & files
`zip -r {{compressed.zip}} {{/path/to/dir1 /path/to/dir2 /path/to/file}}`