← all posts

OSX Terminal Tricks

9 March, 2013 · 1,236 views

Here’s my list of tricks I use in the OSX terminal to work faster since switching from PC to Mac.

SHOW FILE CONTENTS IN BASH

cat filename

ZIP A FILE

zip filename

UNZIP A FILE

unzip filename

CONNECT TO TELNET SERVER IN TERMINAL

ssh username@hostname

DOWNLOAD FILES VIA SSH

scp [email protected]:foobar.txt /some/local/directory

MOVE TO BEGINNING OR END OF LINE IN SHELL

Fn-Cursor Left and Fn-Cursor Right (since Cmd-Left and Cmd-Right don’t work in the shell)

RUN SHELL COMMAND ASYNCHRONOUS/IN BACKGROUND

Do not wait for output until continueing
command &
e.g. curl http://google.com &

RUN APACHE WEB SERVER ON OSX
Apache is pre-installed (!) on OSX. Insane. You can activate it in the terminal:

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

Apache’s config files are located in:

/private/etc/apache2/httpd.conf

EDITING YOUR HOSTS FILE
It’s located at:

/private/etc/hosts

FLUSH YOUR DNS CACHE AFTER EDITING YOUR HOSTS FILE

sudo killall -HUP mDNSResponder

CREATE SYMBOLIC LINKS (Fake folders that mirror other folders, e.g. like Substr on Windows/DOS)

ln -s /users/username/photos /photos

P.S. I'm on 𝕏 too if you'd like to follow more of my stories. And I wrote a book called MAKE about building startups without funding. See a list of my stories or contact me. To get an alert when I write a new blog post, you can join 13,143 subscribers below:

Subscribing you...
Subscribed! Check your inbox to confirm your email.