mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-11-10 11:29:59 +03:00
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:
parent
3962b799d2
commit
e4118b1585
@ -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}}`
|
24
linux/apt-get.md
Normal file
24
linux/apt-get.md
Normal file
@ -0,0 +1,24 @@
|
||||
# apt-get
|
||||
|
||||
> Debian and Ubuntu package management utility
|
||||
|
||||
- Synchronize list of packages and versions available. This should be run first, before running subsequent apt-get commands.
|
||||
|
||||
`apt-get update`
|
||||
|
||||
- install a new package
|
||||
|
||||
`apt-get install {{package}}`
|
||||
|
||||
|
||||
- remove a package
|
||||
|
||||
`apt-get remove {{package}}`
|
||||
|
||||
- Upgrade installed packages to newest available versions
|
||||
|
||||
`apt-get upgrade`
|
||||
|
||||
- Upgrade installed packages (like `apt-get upgrade`) including removing obsolete packages and installing additional packages to meet new package dependencies.
|
||||
|
||||
`apt-get dist-upgrade`
|
16
linux/shutdown.md
Normal file
16
linux/shutdown.md
Normal file
@ -0,0 +1,16 @@
|
||||
# shutdown
|
||||
|
||||
> Shutdown and reboot the system
|
||||
|
||||
- Reboot or poweroff (halt) the system immediately
|
||||
|
||||
`shutdown -r now`
|
||||
`shutdown -h now`
|
||||
|
||||
- Reboot in 5 minutes.
|
||||
|
||||
`shutodwn -r +5 &`
|
||||
|
||||
- Cancel a pending shutdown/reboot operation
|
||||
|
||||
`shutdown -c`
|
15
osx/airport.md
Normal file
15
osx/airport.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Airport
|
||||
|
||||
> Airport utility
|
||||
|
||||
- Create a symlink so you can easily run 'airport' without specifying a path.
|
||||
|
||||
`sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport`
|
||||
|
||||
- Scan for available wireless networks
|
||||
|
||||
`airport -s`
|
||||
|
||||
- Disassociate from current airport network
|
||||
|
||||
`sudo airport -z`
|
13
osx/caffeinate.md
Normal file
13
osx/caffeinate.md
Normal file
@ -0,0 +1,13 @@
|
||||
# caffeinate
|
||||
|
||||
> Prevent a system from sleeping
|
||||
|
||||
- Prevent mac from sleeping for 1 hour (3600 seconds)
|
||||
|
||||
`caffeinate -u -t 3600`
|
||||
|
||||
- Prevent mac from sleeping until a command completes
|
||||
|
||||
`caffeinate -s {{command}}`
|
||||
|
||||
|
23
osx/diskutil.md
Normal file
23
osx/diskutil.md
Normal file
@ -0,0 +1,23 @@
|
||||
# diskutil
|
||||
|
||||
> Utility to manage local disks and volumes
|
||||
|
||||
- List all currently available disks, partitions and mounted volumes.
|
||||
|
||||
`diskutil list`
|
||||
|
||||
- Repair permissions on a volume
|
||||
|
||||
`diskutil repairPermissions {{/Volumes/Name}}`
|
||||
|
||||
- Repair the file system data structures of a volume
|
||||
|
||||
`diskutil repairVolume {{/dev/diskX}}
|
||||
|
||||
- Unmount a volume
|
||||
|
||||
`diskutil unmountDisk {{/dev/diskX}}`
|
||||
|
||||
- Eject a CD/DVD (unmount first)
|
||||
|
||||
`diskutil eject {{/dev/disk1}}
|
12
osx/drutil.md
Normal file
12
osx/drutil.md
Normal file
@ -0,0 +1,12 @@
|
||||
# drutil
|
||||
|
||||
> Interact with DVD burners
|
||||
|
||||
- Eject a disk from the drive
|
||||
|
||||
`drutil eject`
|
||||
|
||||
- Burn a folder as an ISO9660 filesystem onto a DVD. Don't verify and eject when complete.
|
||||
|
||||
`drutil burn -noverify -eject -iso9660`
|
||||
|
15
osx/lookupd.md
Normal file
15
osx/lookupd.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Airport
|
||||
|
||||
> Airport utility
|
||||
|
||||
- Create a symlink so you can easily run 'airport' without specifying a path.
|
||||
|
||||
`sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport`
|
||||
|
||||
- Scan for available wireless networks
|
||||
|
||||
`airport -s`
|
||||
|
||||
- Disassociate from current airport network
|
||||
|
||||
`sudo airport -z`
|
19
osx/networksetup.md
Normal file
19
osx/networksetup.md
Normal file
@ -0,0 +1,19 @@
|
||||
# networksetup
|
||||
|
||||
> Configuration tool for Network System Preferences
|
||||
|
||||
- List available network service providers (Ethernet, Wi-Fi, Bluetooth, etc)
|
||||
|
||||
`networksetup -listallnetworkservices`
|
||||
|
||||
- Show network settings for a particular networking device
|
||||
|
||||
`networksetup -getinfo {{"Wi-Fi"}}`
|
||||
|
||||
- Get currently connected Wi-Fi network name (Wi-Fi device usually en0 or en1)
|
||||
|
||||
`networksetup -getairportnetwork {{en0}}`
|
||||
|
||||
- Connect to a particular Wi-Fi network
|
||||
|
||||
`networksetup -setairportnetwork {{en0}} {{"Airport Network SSID"}} {{password}}
|
23
osx/open.md
Normal file
23
osx/open.md
Normal file
@ -0,0 +1,23 @@
|
||||
# open
|
||||
|
||||
> Opens files, directories and applications
|
||||
|
||||
- Open a file with the associated application
|
||||
|
||||
`open filename.ext`
|
||||
|
||||
- Run a graphical MacOSX application
|
||||
|
||||
`open /Applications/iTunes.app`
|
||||
|
||||
- Open the current directory in Finder
|
||||
|
||||
`open .`
|
||||
|
||||
- Reveal a file in finder
|
||||
|
||||
`open -R /path/dir/file`
|
||||
|
||||
- Open all the word docs in the current directory with Microsoft Word
|
||||
|
||||
`open *.doc`
|
15
osx/pgrep.md
Normal file
15
osx/pgrep.md
Normal file
@ -0,0 +1,15 @@
|
||||
# pgrep
|
||||
|
||||
> Find or signal process by name
|
||||
|
||||
- return PIDs of any running processes with a matching command string
|
||||
|
||||
`pgrep {{Finder}}`
|
||||
|
||||
- case insensitive greping
|
||||
|
||||
`pgrep -i {{fireFOx}}
|
||||
|
||||
- kill all processes which match
|
||||
|
||||
`pkill -9 {{Finder}}
|
11
osx/qlmanage.md
Normal file
11
osx/qlmanage.md
Normal file
@ -0,0 +1,11 @@
|
||||
# qlmanage
|
||||
|
||||
> QuickLook server tool
|
||||
|
||||
- displays QuickLook for one or multiple files
|
||||
|
||||
`quicklook -p {{filename}} {{filename2}}`
|
||||
|
||||
- Compute 300px wide PNG thumbnails of all JPEGs in the current directory and put them in a directory.
|
||||
|
||||
`quicklook *.jpg -t -s 300 {{/existing//thumbnail/directory}}
|
14
osx/say.md
Normal file
14
osx/say.md
Normal file
@ -0,0 +1,14 @@
|
||||
# say
|
||||
|
||||
> Uses text to speech to speak through the default sound device
|
||||
|
||||
- Speak a phrase aloud
|
||||
|
||||
`say "I like to ride my bike.`
|
||||
|
||||
- Speak a file aloud
|
||||
|
||||
`say -f {{filename}}`
|
||||
|
||||
- Create an AAC compressed audio file with the spoken text
|
||||
`say -o {{filename.m4a}} "Everyone loves iTunes"`
|
13
osx/shutdown.md
Normal file
13
osx/shutdown.md
Normal file
@ -0,0 +1,13 @@
|
||||
# shutdown
|
||||
|
||||
> Shutdown and reboot the system
|
||||
|
||||
- Reboot, poweroff (halt) or sleep immediately
|
||||
|
||||
`shutdown -r now`
|
||||
`shutdown -h now`
|
||||
`shutdown -s now`
|
||||
|
||||
- Reboot in 5 minutes.
|
||||
|
||||
`shutodwn -r +5`
|
24
osx/sysctl.md
Normal file
24
osx/sysctl.md
Normal file
@ -0,0 +1,24 @@
|
||||
# sysctl
|
||||
|
||||
> Access kernel state information
|
||||
|
||||
- Show all available variables and their values
|
||||
|
||||
`sysctl -a`
|
||||
|
||||
- Show Apple model identifier
|
||||
|
||||
`sysctl -n hw.model`
|
||||
|
||||
- Show CPU model
|
||||
|
||||
`sysctl -n machdep.cpu.brand_string`
|
||||
|
||||
- Show available CPU features (MMX, SSE, SSE2, SSE3, AES, etc)
|
||||
|
||||
`sysctl -n machdep.cpu.feature`
|
||||
|
||||
- Set a changeable kernel state variable
|
||||
|
||||
`sysctl -w name=value`
|
||||
`sysctl -w kern.maxfiles=15000`
|
15
osx/system_profiler.md
Normal file
15
osx/system_profiler.md
Normal file
@ -0,0 +1,15 @@
|
||||
# system_profiler
|
||||
|
||||
> Report system hardware and software configuration
|
||||
|
||||
- Display a full system profiler report which can be opened by System Profiler.app
|
||||
|
||||
`system_profiler -xml > MyReport.spx`
|
||||
|
||||
- Display a hardware overview (Model, CPU, Memory, Serial, etc)
|
||||
|
||||
`system_profiler SPHardwareDataType`
|
||||
|
||||
- Print the system serial numebr
|
||||
|
||||
`system_profiler SPHardwareDataType|grep "Serial Number (system)" |awk '{print $4}'`
|
24
osx/systemsetup.md
Normal file
24
osx/systemsetup.md
Normal file
@ -0,0 +1,24 @@
|
||||
# systemsetup
|
||||
|
||||
> Configure System Preferences machine settings
|
||||
|
||||
- Enable remote login (SSH)
|
||||
|
||||
`systemsetup -setremotelogin on`
|
||||
|
||||
- Specify TimeZone, NTP Server and enable network time
|
||||
|
||||
`systemsetup -settimezone {{US/Pacific}}`
|
||||
`systemsetup -setnetworktimeserver {{us.pool.ntp.org}}`
|
||||
`systemsetup -setusingnetworktime on`
|
||||
|
||||
- Make the machine never sleep; restart on freeze & power failure
|
||||
|
||||
`systemsetup -setsleep off`
|
||||
`systemsetup -setrestartpowerfailure on`
|
||||
`systemsetup -setrestartfreeze on`
|
||||
|
||||
- List valid startup disks, specify a new startup disk
|
||||
|
||||
`systemsetup -liststartupdisks`
|
||||
`systemsetup -setstartupdisk {{path}}`
|
Loading…
Reference in New Issue
Block a user