Seeing hidden or dotfiles in MacOS Finder and iTerm Copy Mode

OK, this has always annoyed me, MacOS to be safe for ordinary people doesn’t by default does not let you look at so called dotfiles (like .bashrc) or hidden system files in Finder. This is usually fine, but there are some times when you need it. For instance if you want to drag and drop a file into github issues (this is a really cool thing, when you drag onto a Github issue, it automagically copies the file up and stuffs the URL in as well!).

So it took literally five years to figure it out, but there is a simple command in Finder to do this which is ⌃-⌘-. or written in English, Shift-Command-. (the period key) which makes some sense. Turns out you can also turn this on and off by changing some defaults:

defaults write com.apple.finder AppleShowAllFiles YES

Which is kind of handy to know when you are searching

iTerm Copy Mode

Related to this, is what if you want to take some text and just copy it all. Well, you can use selection in a window with a Shift click and then drag up, but you can go to copy mode which let’s you use keyboard shortcuts to do the same which is called iTerm Copy Mode.

# Enter copy mode with a Shift Command C
⇧-⌘-C
# Now enter selection mode 
Control-Space
# You can now move around the screen with vi-like command and this gets selected
h, left arrow
j, down arrow
k, up arrow
l, right arrow
# Or by words using the wor mode
b back a word
w forward a word
# vi-like move on a screen
H to top
M to middle
L to low
# this will start the copy mode
Arrows
# keep arrowing to select what you want and then type to stop
Control-Space
# copy into the clipboard
Command-X
# To stop hit
ESC or q or Ctrl-C or Ctrl g

# you can also do a rectanglular selection like vi's visual mode
Ctrl-v
Space or v 
V to get a line

Copy the MacOS system clipboard into Vim

On a related note, suppose you want to do the reverse, that is copy the clipboard into a vi session, well, you can do a ⌘-v of course, but there is a register called *y that let’s you do this so this command means gg or go to the end of the document. Then ” means output a register and the register magic name is *y and then G to the end to see what you’ve copied

gg"*yG

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect