Command-line tool
- Evergreen
- c.
Useful built-in (macOS) command-line tools with examples.
curl
Client for URLs. Basic usage is for transfering data to and from servers using URLs.
Example
Request the contents of example.com.
$ curl example.com
<!doctype html><html lang="en"><head><title>Example Domain</title><link rel="icon" href="data:,"><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p><p><a href="https://iana.org/domains/example">Learn more</a></p></div></body></html>dig
Domain information groper. Basic usage is for querying DNS records for a domain.
Example
Query A records for the domain example.com.
$ dig example.com A
;; ANSWER SECTION:example.com. 133 IN A 104.20.23.154example.com. 133 IN A 172.66.147.243grep
Global regular expression print. Basic usage is for searching for text in a file using a regular expression, and print any lines that contain a match.
Example
Search, ignoring case (-i), for any line that start with “hello” in the file greeting.txt.
$ grep -i "^hello" greeting.txtHello, world!