Terminal Mac Check For Hacker

Welcome back to Coding Corner! Today, we're going to go over some great interface and user tweaks you can execute to customize your Mac. These tricks are often simple and can help you spruce up your Mac far beyond what the System Preferences window allows.

Make Terminal windows stand out with profiles. When you’re logged in to several servers, unique background colors and window titles specified in profiles help you easily spot the right Terminal window. Use profiles built into Terminal, or create your own custom profiles. How to create profiles for Terminal. Check your MAC address to find out! Run the command line terminal. To do this, On Windows 10 – click on the magnifying glass pictogram near the “Start” button, enter “cmd” in the search dialog and press Enter, or click on the “Start” button, then select “Windows System” “Command Prompt”. Terminal provides a command line interface to control the UNIX-based operating system that lurks below macOS (or Mac OS X). Here's everything you need to know about Terminal, and what it can do.

So, without further ado, 15 great tricks you can execute in Terminal.

Tweak the Finder

Want to see hidden files, or copy Quick Look text? There are quite a few 'defaults' commands that let you alter how the Finder looks or acts.

1. Show hidden files and folders

Want to see all the hidden files and folders OS X has to offer — or you simply can't find a file you hid? Just use this command in Terminal:

defaults write com.apple.finder AppleShowAllFiles -bool TRUE
killall Finder

To re-hide all your files, just change the TRUE to FALSE.

2. View any file's contents

If you've had a file get corrupted or you suspect there's something hidden inside its package, you can force Terminal to open it. Just use the following command:

cat ~/enter/file/path

Fair warning: If you try to open a photo or pretty much any non-text document, you'll likely just see text gibberish.

3. Copy the contents of a folder from one place to another

Sure, you can Option-drag any file to a new location to make a copy of it, but if you want to simplify the process and automatically copy the entire contents of one folder to another, check out this simple Terminal trick.

ditto -V ~/original/folder/ ~/new/folder/

4. Download files outside of your browser

Have the URL to a file but don't want to use Safari, Firefox, or Chrome to download it? You can go through Terminal with the following commands:

cd ~/Downloads/
curl -O http://www.thefilename.com/thefile/url.mp3

The first command moves your current Terminal location to your Downloads folder; the second downloads it from the web to that folder.

Modifying screenshots

Want to change how your screenshots look? Here are some commands to help you do just that.

5. Change your screenshot's file format

This Terminal command lets you change the file format of your screenshots. By default, they're saved as PNGs, but you can also save them as PDFs, JPGs, and more.

defaults write com.apple.screencapture type jpg

6. Disable drop shadows on a screenshot

Here's another good one if you tend to take a lot of screenshots: This command will disable drop-shadow on your screenshots, only displaying the window you've snapped.

$ defaults write com.apple.screencapture disable-shadow -bool TRUE
killall SystemUIServer

7. Create a new default name scheme for screenshots

Don't like the phrase Apple uses to save your screenshots? Traditionally, it's 'Screen Shot - [date] - [time]', but you can change 'Screen Shot' to any word you please.

defaults write com.apple.screencapture name 'New Screen Shot Name'
killall SystemUIServer`

Get bored of your new name scheme? Go back to the default by typing as follows:

Terminal Codes For Mac

defaults write com.apple.screencapture name '
killall SystemUIServer

8. Change the location of your screenshots

Your screenshots, by default, save to the Desktop. But if you'd prefer they save elsewhere, it's an easy Terminal trick to make it so.

defaults write com.apple.screencapture location ~/your/location/here
killall SystemUIServer

You can also drag the folder of your choice on top of the Terminal window after typing 'location' if you don't want to manually type out the file path.

System changes

If you're looking for broader OS X-level changes, these commands might help you get started.

9. Create a custom login message

Whether you want to troll your friends or add useful 'in case of loss' contact information, you can add a personalized message to your login screen with this Terminal command.

sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText 'In case of loss, call 555-555-5555.'

10. How long has my Mac been running?

Is your Mac acting sluggishly? It might be in need of a good restart. You can check to see just how long your Mac's been active by checking its uptime with this Terminal command:

uptime

11. Keep your Mac awake

If you need to prevent your Mac from going to sleep — say, you're running an extensive task, or recording your screen — there's an all-too-amusing command for that:

caffeinate

Once you enter this command, your Mac's digital eyes will be pried open and prevented from going to sleep until you end it by pressing Control-C.

If you don't want to rely on being the one to end your poor Mac's suffering, you can also create a set a number of seconds before your Mac sleeps:

caffeinate -u -t 5400

The above command will keep your Mac awake for an hour and a half.

12. Make your Mac automatically restart after a crash

We've all had our Mac freeze up or crash at least once in its lifetime. If you want to skip the crying and the yelling at the screen and get back to work, you can enter this Terminal command, which will make OS X reboot as soon as it senses a full system freeze.

sudo systemsetup -setrestartfreeze on

Modify your Dock

Want to make your Dock look different? Check out these Terminal tweaks.

13. Add spacers to your Dock

You can organize your Dock's many icons by adding in blank spaces with this handy terminal command:

defaults write com.apple.dock persistent-apps -array-add '{'tile-type'='spacer-tile';}'
killall Dock

Repeat this command for each spacer you'd like for your Dock. To remove a spacer, you can drag it out to the right until you see the poof icon.

14. Dull hidden apps in the Dock

Not sure which apps are visible on your screen? You can make this information extra pertinent by using this Terminal command, which lowers the opacity on icons for hidden apps in the Dock. It's a great way to see what you haven't used lately, as well as what's cluttering up your screen.

defaults write com.apple.Dock showhidden -bool TRUE
killall Dock

15. Hide non-active apps in your Dock

Terminal

If lowering the opacity of hidden apps appeals to you, you might like this Terminal command even better: It hides any closed app from your Dock at all times.

defaults write com.apple.dock static-only -bool TRUE
killall Dock

Your favorites?

Have a Terminal command you love that we didn't mention? Drop it below in the comments.

We may earn a commission for purchases using our links. Learn more.

exposure notification

National COVID-19 server to use Apple and Google's API, hosted by Microsoft

The Association of Public Health Laboratories has announced it is working with Apple, Google, and Microsoft to launch a national server that will securely store COVID-19 exposure notification data.

by Caleb Taylor

You are a hacker. Your home is the terminal. You know every key stroke is valuable. If something is less than 100% efficient, you will spend hours figuring out the right tool to save yourself seconds. Because it’s always worth it.

Does your constant search for newer and better ways to do things detract from actually doing things? Some may say yes, but you say nay. No work is worth doing unless you can lecture your coworkers on why you were able to do it so efficiently (setup time not included).

The following is a list of tools/features that every good hacker should know about.

Dislcaimer: This article is written with a heavy dose of satire. It’s a twist on the “Me, an Intellectual” meme. While the suggestions are sincere (and by no means complete), the references to being a “hacker” are just for fun.

Shell (zsh)

Terminal Mac Check For Hackers

Average developer: A shell is a shell. It doesn’t really matter which one I use. They all suck anyway.
You, a Hacker: The shell is the lifeblood of my work. My passion for efficiency and features knows no bounds. My shell must be one worthy of a true hacker.

You live in the terminal, and that’s why you want to use a great shell. That’s why you use zsh.

Best Mac Terminal Hacks

It comes with a whole slew of features:

  • Auto-correct of misspelled commands
  • Easy drop-in replacement of bash
  • Better cd completion using <tab>
  • Path expansion: cd /u/c/c/j + <tab> =cd /user/caleb/code/jarvis

It also comes with a great framework for managing your zsh configuration: Oh My Zsh. It includes 200+ plugins and 140+ themes to add all sorts of awesome features to your terminal. A small sample:

  • git - tons of aliases and useful functions for git
  • tmux - alias and settings for integrating zsh with tmux
  • node - adds node-docs command for opening website docs
  • osx - several utilities for working with OSX
  • web-search - initialize web searches from command line
  • auto-suggestions - fast, unobtrusive suggestions as you type based on history

You can find the full list of plugins here.

Session Management (tmux)

Average developer: Okay I’ve got my files open for lame_project_1. But I also need to do work in boring_project_2. I also need to ssh into a server and look at the logs. I guess I’ll just create a huge mess in my terminal that has files/tabs from multiple projects open in a way that I’ll eventually lose control of and be forced to close and start over.
You, a Hacker: I work on several projects at once, so I need a tool to help me keep it organized. It should work across multiple platforms, and allow me to create organized work spaces and have a lot of other features that help with productivity.

You know that development can get messy. Sometimes, you have to work on several projects at once. That’s why you use tmux.

It allows you to create sessions. Each session can be customized to the exact layout you need. You can name sessions for easy switching, and even save and restore sessions if your terminal is closed. Plus, it has its own customizable status line that will allow you display things like time, date, CPU usage, and more. And if you don’t know your CPU usage at any given moment, are you even a hacker?

It even has a plugin manager and a whole slew of awesome plugins & features that will take your hacking to the next level.

Super-Pro Hacker Tip:
Use tmux with fzf via some awesome scripts to quickly create/delete/navigate to push your hacker level to over 9000.

Search (ripgrep)

Average developer: Where did I define that constant at? I know it’s somewhere in here. I’ll try to grep for it. What are the arguments again? Let me google that. Ah crap, now it’s searching my node_modules folder. This is the worst.
You, a Hacker: When I search for something, it should be blazing fast. Also, it should use sensible default settings, like ignoring binaries or hidden files.

You know that searching your project is a common task. It should be fast, and it should not waste your time. This means things like ignoring anything that your .gitignore file ignores, and skipping binaries and hidden files. That’s why you use ripgrep. It’s like grep on steroids.

In the words of its creator: “Use ripgrep if you like speed, filtering by default, fewer bugs and Unicode support.”

Fuzzy Finding (fzf)

Average developer: It’s sure hard to remember the exact location of so many files within my project. I guess I’ll stumble around until I find the right one.
You, a Hacker: I should be able to fuzzy-find files. I can type the file name, or some of the path, or all of it, and quickly find the file I’m looking for.

You know you shouldn’t have to type any more than you need to. So you use fzf, a general-purpose command-line fuzzy finder. It can also do much more than fuzzy-find files. It can used with any list: “files, command history, processes, hostnames, bookmarks, git commits, etc”.

Super-Pro Hacker Tip: You know that aliases are a great way to make shortcuts to take advantage of fzf’s features. For example, if you wanted to fuzzy-find a file, and then open up the selection in your default editor, you can add this to your zsh config:

Many more examples can be found on the fzf wiki.

Terminal Prompt (Spaceship)

Average developer: Who cares what my terminal prompt looks like? There’s no way it could possibly give me any useful information. I’ll just leave it as the default.
You, a Hacker: I want my prompt to be amazing. It should be context-aware. It should give me useful info and be configurable. Also, it would be sweet if it was related to space.

You know a prompt should be simple, clean, and provide only relevant information. It should also blow people’s minds when they see its beauty. That’s why you use spaceship-prompt. It provides git/mercurial integration, battery level indicator, clever host name and user data, version numbers for a variety of libraries, gorgeous icons, and much more.

Changing directories (z)

Average developer: I need to change my directory to my “hacker” project, which is inside of my cool folder, which is inside of my personal folder, which is inside of my code folder, which is in my home directory.
Best mac terminal hacks
You, a Hacker: I need to change my directory to my “hacker” project.

Typing out full file paths is what average developers do. You are a hacker. You rely on z. Once installed, it will start learning which directories you visit. Then, you can give it a regex (or simple folder name) to hop to the most likely candidate.

Bonus Hacker Tools

The following tools are additional ways to truly elevate your hacking game.

  1. wttr.in — There’s only one right way to check the weather.

2. Star Wars — Cool people like Star Wars. Hackers watch it in the terminal.

3. haxor-news - Are you even a hacker if you don’t read Hacker News?

4. Spotify - Using shpotify, you can play music from the terminal (OSX only… Hey, stop booing! Put that chair down! Who threw that tomato!?), or mopidy for something that’s cross-platform.

Terminal For Hacking

That about wraps it up. This is by no means a comprehensive list. Do you have any other amazing hacker tools? Leave a comment and let me know.

Terminal Mac Os

If you are interested in seeing more of these tools in action, checkout out my dotfiles that I use for development. As a bonus, here’s a screenshot of the glorious terminal in action: