A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool linux/: apt-get, shutdown osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler Edits to existing pages: curl: Added simple download example find: Added iname and size exmaples grep: Edited -c description ps: Added wide lines example ssh: edited -D description, added simple port forwarding example unzip: added list option
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
> Transfers data from or to a server
|
||||
> Supports most protocols including HTTP, FTP, POP
|
||||
|
||||
- Download a URL to a file
|
||||
|
||||
`curl "{{URL}}" -o filename`
|
||||
|
||||
- send form-encoded data
|
||||
|
||||
`curl --data {{name=bob}} {{http://localhost/form}}`
|
||||
|
||||
15
common/dig.md
Normal file
15
common/dig.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# dig
|
||||
|
||||
> DNS Lookup utility
|
||||
|
||||
- Lookup the IP(s) associated with a hostname (A records)
|
||||
|
||||
``dig +short {{hostname.com}}
|
||||
|
||||
- Lookup the mail associated with a given domain name (MX records)
|
||||
|
||||
``dig +short {{hostname.com}} MX
|
||||
|
||||
- Specify an alternate DNS server to query (8.8.8.8 is google's public DNS)
|
||||
|
||||
`dig @8.8.8.8 {{hostname.com}}`
|
||||
@@ -15,3 +15,9 @@
|
||||
- find files modified since a certain time
|
||||
|
||||
`find {{root_path}} -name {{'*.py'}} -mtime {{-1d}}`
|
||||
|
||||
- find files using case insensitive name matching, of a certain size
|
||||
|
||||
`find {{root_path}} -size +120k -iname {{'*.dOC'}} `
|
||||
`find {{root_path}} -size -100M -iname {{'*.moV'}} `
|
||||
`find {{root_path}} -size -1.2T -size +800G -iname {{'*.TaR.gZ'}} `
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
`grep -C 3 {{something}} {{file_path}}`
|
||||
|
||||
- print the number of matches
|
||||
- print the count of matches instead of the matching text
|
||||
|
||||
`grep -c {{something}} {{file_path}}`
|
||||
|
||||
|
||||
23
common/gzip.md
Normal file
23
common/gzip.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# gzip
|
||||
|
||||
> Compress/uncompress files with gzip compression (LZ77)
|
||||
|
||||
- compress a file, replacing it with a gzipped compressed version
|
||||
|
||||
`gzip {{file.ext}}
|
||||
|
||||
- decompress a file, replacing it with the original uncomrpessed version
|
||||
|
||||
`gzip -d {{file.ext.gz}}
|
||||
|
||||
- compress a file specifying the output filename
|
||||
|
||||
`gzip -c {{file.ext}} > compressed-file.ext.gz
|
||||
|
||||
- uncompress a gzipped file specifying the output filename
|
||||
|
||||
`gzip -c -d {{file.ext.gz}} > uncompressed-file.ext
|
||||
|
||||
- specify the compression level. 1=Fastest (Worst), 9=Slowest (Best), Default level is 6
|
||||
|
||||
`gzip -9 -c {{file.ext}} > compressed-file.ext.gz`
|
||||
@@ -5,3 +5,7 @@
|
||||
- list all running processes
|
||||
|
||||
`ps aux`
|
||||
|
||||
- list all running processes including the full command string
|
||||
|
||||
`ps auxww`
|
||||
|
||||
15
common/rm.md
Normal file
15
common/rm.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# rm
|
||||
|
||||
> Remove files or directories
|
||||
|
||||
- Remove files from arbitrary
|
||||
|
||||
`rm {{/path/to/file}} {{/otherpath/to/file2}}`
|
||||
|
||||
- Remove recursively a directory and all it's subdirectories
|
||||
|
||||
`rm -r {{/path/to/folder}}`
|
||||
|
||||
- Prompt before every removal
|
||||
|
||||
`rm -i *`
|
||||
15
common/sort.md
Normal file
15
common/sort.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# sort
|
||||
|
||||
> sort lines of text files
|
||||
|
||||
- Sort a file in ascending order
|
||||
|
||||
`sort {{filename}}`
|
||||
|
||||
- Sort a file in descending order
|
||||
|
||||
`sort -r {{filename}}`
|
||||
|
||||
- Sort passwd file by the 3rd field
|
||||
|
||||
`sort -t: -k 3n /etc/passwd `
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
`ssh {{username}}@{{remote_host}} -P {{2222}}`
|
||||
|
||||
- ssh tunneling
|
||||
- ssh tunneling: dynamic port forwarding (SOCKS proxy on localhost:9999)
|
||||
|
||||
`ssh -D {{9999}} -C {{username}}@{{remote_host}}`
|
||||
|
||||
- ssh tunneling: forward a specific port (localhost:9999 to slashdot.org:80)
|
||||
|
||||
`ssh -L {{9999}}:slashdot.org:80 {{username}}@{{remote_host}}`
|
||||
|
||||
@@ -9,3 +9,7 @@
|
||||
- extract zip files(s) to given path
|
||||
|
||||
`unzip {{files(s)}} -d {{/path/to/put/extracted/files}}`
|
||||
|
||||
- list the contents of a zip file without extracting
|
||||
|
||||
`unzip -l {{file}}
|
||||
|
||||
27
common/zfs.md
Normal file
27
common/zfs.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# zfs
|
||||
|
||||
> Manage ZFS filesystems
|
||||
|
||||
- List all available zfs filesystems
|
||||
|
||||
`zfs list`
|
||||
|
||||
- Create a new ZFS filesystem
|
||||
|
||||
`zfs create poolname/newfsname`
|
||||
|
||||
- Delete a ZFS filesystem
|
||||
|
||||
`zfs destroy {{poolname/newfsname}}`
|
||||
|
||||
- Create a Snapshot of a ZFS filesystem
|
||||
|
||||
`zfs snapshot {{poolname/filesystem@snapshot-name}}
|
||||
|
||||
- Enable compression on a filesystem
|
||||
|
||||
`zfs set compression=on {{poolname/fileystem}}
|
||||
|
||||
- Change mountpoint for a filesytem
|
||||
|
||||
`zfs set mountpoint={{/my/mount/path}} {{poolname/filesystem}}
|
||||
@@ -1,6 +1,6 @@
|
||||
# zip
|
||||
|
||||
> package and compress (archive) files into zip file
|
||||
> Package and compress (archive) files into zip file
|
||||
|
||||
- package and compress multiple directories & files
|
||||
|
||||
|
||||
33
common/zpool.md
Normal file
33
common/zpool.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# zpool
|
||||
|
||||
> Manage ZFS pools
|
||||
|
||||
- Show the configuration and status of all ZFS zpools
|
||||
|
||||
`zpool status [{{poolname}}]`
|
||||
|
||||
- Check a ZFS pool for errors (verifies the checksum of EVERY block). Very CPU and disk intensive.
|
||||
|
||||
`zpool scrub {{poolname}}`
|
||||
|
||||
- List zpools available for import
|
||||
|
||||
`zpool import`
|
||||
|
||||
- Import a zpool, optionally specifying a new name
|
||||
|
||||
`zpool import {{poolname}}`
|
||||
`zpool import {{poolname}} {{newpoolname}}`
|
||||
|
||||
- Export a zpool (unmount all filesystems)
|
||||
|
||||
`zpool export {{poolname}}`
|
||||
|
||||
- Show the history of all pool operations
|
||||
|
||||
`zpool histrory {{poolname}}`
|
||||
|
||||
- Create a mirrored pool.
|
||||
|
||||
`zpool create {{poolname}} mirror {{disk1}} {{disk2}}`
|
||||
`zpool create {{poolname}} mirror {{disk1}} {{disk2}} mirror {{disk3}} {{disk4}}`
|
||||
Reference in New Issue
Block a user