π Command line tools
On this page
Keyboard shortcuts Jump to heading
ctrl-r
- Search previously used commandsctrl-t
- Invoke FZF fuzzy file finder (see below)ctrl-l
- Clear the terminal screenctrl-k
- Clears the terminal screen but no-scroll back. Basically wipes thectrl-w
- Cut one word backwards using white space as delimiteresc-t
- Swap the last two words before the cursor
Commands Jump to heading
cal Jump to heading
Show a calendar
β― cal February 2020 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
date Jump to heading
Show the date
β― date Sat 7 Sep 2019 09:22:28 BST
tree Jump to heading
Show directory contents as a tree
β― tree -L 1
.
βββ README.md
βββ example
βββ gatsby-theme-code-notes
βββ node_modules
βββ package.json
βββ yarn.lock
List global packages Jump to heading
# with yarn
β― yarn global list
# with npm
β― npm -g ls --depth=0
Flush DNS cache Jump to heading
1. Clear OS-level DNS cache Jump to heading
On Mac OS, run this in the terminal:
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
On Windows:
ipconfig /flushdns
2. Clear DNS cache via Chrome Jump to heading
Go to chrome://net-internals/#dns and click Clear host cache.
This button sounds like it should clear the OS-level cache, but my experience just doing this isnβt enough by itself.
3. Close existing server connections Jump to heading
Go to chrome://net-internals/#sockets and click Flush socket pools.
Then reload the page youβre testing and you should see the DNS lookup again, as well as the time spent on establishing the TCP connection.
Custom packages Jump to heading
Autojump Jump to heading
https://github.com/wting/autojump
autojump is a faster way to navigate your filesystem. It works by maintaining a
database of the directories you use the most from the command line.
β― j code
exa Jump to heading
A modern version of ls
β― exa -l
β― exa -T -L 2 # like tree
FZF Jump to heading
https://github.com/junegunn/fzf
Fuzzy find files. Use ctrl+t
to access it
serve Jump to heading
Static file serving and directory listing
emma Jump to heading
https://github.com/maticzav/emma-cli
Search for npm packages. Run emma to initialise the search, then enter your search criteria
ibrew Jump to heading
https://github.com/mischah/ibrew
Interactive search CLI for Homebrew
Run ibrew
to initialise the search, then enter your search criteria
yalc Jump to heading
https://github.com/whitecolor/yalc
Work with yarn/npm packages locally like a boss.
hub Jump to heading
# clone one of your GitHub repos
β― hub clone dotfiles
# Same as β git clone git://github.com/YOUR_USER/dotfiles.git
# clone another project's repo
β― hub clone github/hub
# β git clone git://github.com/github/hub.git
# open the current project's issues page
β― hub browse -- issues
# β open https://github.com/github/hub/issues
# open another project's wiki
β― hub browse mojombo/jekyll wiki
List the current repoβs PRs Jump to heading
# this is an alias
alias prs 'hub pr list -L 20 -b develop --format="%t%n - Branch: [%H]%n - %U%n - %l%n%n"'
# e.g. β― prs
Create a branch and switch to it Jump to heading
# FYI This is a fish shell function
function branch
git branch {$argv} && git checkout {$argv}
end
# e.g. β― branch feature/WL-88-hello
standup Jump to heading
https://github.com/kamranahmedse/git-standup
Shows a list of commits for the past 24 hours
β― standup /Users/zander/code/fairfx/fx-holiday-money-app 5315f033 - build(multi): HM-925 Improve perf for a couple of pages (16 hours ago) <Zander Martineau> 4b41c048 - index on feature/HM-925-improve-performance: 1b854d84 fix(ci): AWS-99 Remove builds/deployments associated (#845) (17 hours ago) <Zander Martineau>
cross-port-killer Jump to heading
https://github.com/milewski/cross-port-killer
Kill a process running on a particular port
β― kill-port 9001
doctoc Jump to heading
https://github.com/thlorenz/doctoc
Generated markdown table of contents
β― doctoc README.md --github
fx Jump to heading
https://github.com/antonmedv/fx
Command-line JSON processing tool
β― fx package.json
jq Jump to heading
https://stedolan.github.io/jq/
jq is like sed
for JSON data - you can use it to slice and filter and
map and transform structured data with the same ease that sed
, awk
,
grep
and friends let you play with text.
# use jq to extract just the first commit from a repos list
β― curl 'https://api.github.com/repos/stedolan/jq/commits?per_page=5' | jq '.[0]'
npq Jump to heading
https://github.com/lirantal/npq
Safely* install packages with npm or yarn by auditing them as part of your install process
# with npm β― npq install express # with yarn, set an alias like so:alias npq="NPQ_PKG_MGR=yarn npq-hero"
β― npq add express
youtube-dl Jump to heading
# install
β― brew install youtube-dl
# use
β― youtube-dl d2qfa3tlgH8
https://blog.balthazar-rouberol.com/text-processing-in-the-shell
← Back home