30 Mac Terminal Commands to Access Hidden Features
Everyone loves subconscious features. There'southward a reason we phone call them "Easter Eggs", it's like receiving a present from your device. Hidden features may seem contemporary, but, they tin can be incredibly productive too.
The Terminal awarding in your Mac is a window to the internal working of the organisation, and it can allow you to modify a lot of settings, and access a multitude of features, if you know how to do it. In this article, I'grand going to innovate y'all to some neat commands that will let y'all to access a ton of subconscious features and capabilities on your Mac.
Note: Some changes might need a restart (or at least a log out, log in) to accept event, especially the ones where we are editing default values.
one. Create Disk Image From Folder Contents
If nothing else, disk images can be incredibly useful to go along files as a restorable image that you tin can restore on will. Information technology'due south something like TimeMachine. The control you need to create a disk image from the contents of a folder is:
hdiutil create -volname "VolumeName" -srcfolder /path/to/binder -ov diskimage.dmg
I have a folder called Beebom, where I relieve all the screenshots for the diverse articles I write. Let's create a deejay image from that:
hdiutil create -volname "BeebomImage" -srcfolder ~/Beebom -ov Beebom.dmg
2. Burn Deejay Images to DVD
If your Mac has a DVD drive, or if y'all utilise an external DVD RW bulldoze, you can fire images to a DVD using the command line. It's a simple one line command:
hdiutl burn /path/to/paradigm
If I was to burn the Beebom.dmg image on a DVD, I would utilize the command every bit:
hdiutl burn down ~/Beebom.dmg
Note: This control works for .dmg, .iso and .img files.
three. Write Disk Image to Volume
Y'all can write the information in a disk epitome to a Book. Y'all'll have to format the volume first, though. The command is:
sudo asr -restore -noverify -source /path/to/prototype -target /Volumes/volumeName --erase
To illustrate, I showtime created a blank epitome formatted every bit ExFAT into which I would restore the Beebom.dmg data. This was achieved using:
hdiutil create -megabytes 30 -blazon UDIF -fs ExFAT ~/BlankDisk.dmg
This created a blank, mountable disk that I could freely format without losing data. Retrieve to mountain this deejay by double clicking on it. Then, navigate to "/Volumes/" by doing the following:
1. Open Finder
two. Press Command + Shift + Chiliad
3. Blazon /Volumes/ and press Enter
Adjacent, I ran the following command to write the contents of Beebom.dmg to the BlankDisk.dmg book.
sudo asr -restore -noverify -source ~/Beebom.dmg -target /Volumes/Untitled/ --erase
four. Catechumen Files To HTML
If y'all have a .txt, .rtf or fifty-fifty a .doc/.docx file, you can easily convert it into the html format using a uncomplicated Terminal command.
textutil -convert html file.ext
Only supersede the "file.ext" with the path to the file y'all want to catechumen and press Enter.
I created a sample beebom.rtf file to convert into its HTML equivalent.
textutil -convert html ~/beebom.html
Notation: This command can convert documents to multiple formats such as txt, rtf, rtfd, html, doc, docx, odt, or webarchive.
five. Add a Recent Apps Stack to Dock
The dock provides you with quick admission to multiple apps, as well as Downloads and Trash. However, using a unproblematic command can permit you add together another stack to the Dock for your Contempo Applications. The control to achieve this is a bit long and may be difficult to empathize.
defaults write com.apple.dock persistent-others -assortment-add \
'{ "tile-data" = { "list-type" = ane; }; "tile-type" = "recents-tile"; }' && \
killall Dock
This enables the "Recent Applications" stack on your dock. Also, perform a "double-finger tap" on this stack and y'all tin can choose from options such as "Recent Applications", "Recent Documents", "Recent Servers", etc.
6. Add a Spacer Tile to Dock
You tin can also add a blank tile, or a spacer tile (as information technology is called), to the dock. This tin can assist y'all to increment the infinite between multiple icons on the dock to give them a more than spread out and neat look, if y'all desire. The command to add a spacer tile to your dock is similar to the command for adding a "Recent Apps" stack.
defaults write com.apple tree.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' && \
killall Dock
7. Prevent App Icons on Dock From Billowy
I find it very abrasive when an app icon starts bouncing up and down on the dock, trying to get my attending. Yes, it merely does that when information technology really requires attention, but information technology can get really annoying. If you would like to cease the app icons from bouncing on the dock, but apply the following control to prevent the behaviour.
Note: This command doesn't stop the icon from bouncing when you lot launch it, only when it bounces to concenter attention.
defaults write com.apple.dock no-bouncing -bool false && \
killall Dock
If you notice that you miss those bouncing icons, or if you only wanted to endeavour this out for in one case, yous tin simply use the following command to enable bouncing once more.
defaults write com.apple.dock no-billowy -bool true && \
killall Dock
8. Reset Dock
Maybe y'all have added a lot of applications to your Dock, adjusted the size, and rearranged the icons mode too much, or possibly yous but want your Dock dorsum to the way it was when you kickoff booted upward your Mac. Whatever your reasons may be, the command to attain this is very unproblematic.
All you lot demand to do, is run the following command in Terminal, and your Dock volition reset dorsum to its original settings.
defaults delete com.apple.dock && \
killall Dock
ix. Hide a File or Folder
At that place are multiple reasons to want to hide a file or a folder. For one, it may take confidential data that you don't want others to see.
You might know that files with a "." prepended to their name, are hidden by default. However, you lot can't just prepend a "." to a file or a folder. Attempt it out, Finder will give you a warning and the performance volition fail.
Also, if someone wants to cheque for subconscious folders on your directory, they will most probably look for files with a "." prepended to their names, anyway. And then why not hide your personal files and folders in a meliorate style?
All it takes is a simple command.
chflags hidden /path/to/file/folder
If you lot want to unhide these files or folders, all yous need to practise is supercede "hidden" with "nohidden" in the command above.
ten. Prove/Hibernate Hidden Files and Folders
There are some directories and files that your Mac keeps hidden from you in Finder. The reason is simple; these are the files and folders that a coincidental user would ordinarily not require access to. However, if you e'er do need to admission these subconscious folders, all you demand to practise is edit one of the default values for Finder, and this can be washed with the following command:
defaults write com.apple.finder AppleShowAllFiles true
Intuitively, the command to hide all those files and folders simply changes the command to say "imitation" instead of "truthful"
Once you have executed this command, yous volition demand to relaunch Finder. To practise this, follow the steps given below:
- Locate the "Finder" icon on your Dock.
- Printing "option" and tap on the icon with ii fingers.
- From the context card, select "Relaunch"
xi. Show/Hide Full Path in Finder Title Bar
If you lot have ever used the Last to alter, access or transfer files, you volition know that finding the "path" of files is very important to point the Terminal to the right file.
Normally, you'll take to select the file in Finder and utilise the "Get Info" pick to find the path to that file. Withal, Finder can be fix to display the unabridged path of the current directory you're in, past executing one simple command.
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
Your finder volition now show the complete path to the current directory in its championship bar.
To turn this feature off, utilize the post-obit command:
defaults write com.apple tree.finder _FXShowPosixPathInTitle -bool imitation
12. Enable The Option to Quit Finder
Finder is app that doesn't testify a "Quit Finder" particular in its menu, doesn't reply to "Control + Q" hotkeys and basically looks invincible. The option to quit Finder is really just hidden and can be exposed with a uncomplicated command.
defaults write com.apple.finder QuitMenuItem -bool true && \
killall Finder
If you want to hide the option again, simply use the following command:
defaults write com.apple tree.finder QuitMenuItem -bool fake && \
killall Finder
13. Disable Smooth Scrolling
Smooth scrolling is really a boon. It helps the unabridged UI look more than fluid and allows the user to interact in a much better manner with the UI. On older Macs, nonetheless, smooth scrolling tin can burn more bridges than information technology helps build.
Older Macs might non have enough GPU horsepower to effectively apply polish scrolling effects to the UI. Thankfully, shine scrolling can be disabled.
This command volition disable smooth scrolling on your Mac
defaults write NSGlobalDomain NSScrollAnimationEnabled -bool fake
To enable it over again, just supersede "false" with "true"
14. Show/Hide Desktop Icons
Have yous e'er had to screen-share with someone over applications like "FaceTime" and "TeamViewer"? Most people would take used 1 or the other screen sharing service, at least once. However, if you're like me, your desktop probably gets chaotic all the time, and obviously, you'd not want the other person to encounter that clutter. That other person could be your boss, and you'd not want them to see how unorganised your desktop unremarkably is, would yous?
Instead of spending a long time filtering out the clutter, and sorting files into directories, you can simply use the post-obit command to hide the icons from your desktop; making it perfect for screen sharing, presentations, and basically any job where some other person might see your desktop and judge you for your poor organisational skills.
The control to hide icons from your desktop is:
defaults write com.apple.finder CreateDesktop -bool false && \
killall Finder
Of class, one time you're done with the task at hand, y'all'd like to get all your desktop mess back on your, well, desktop. To practice this, simply run the following control:
defaults write com.apple.finder CreateDesktop -bool true && \
killall Finder
fifteen. Show/Hide Path Bar in Finder
The path bar does exactly what its name suggests: it displays the path to the current working directory that you're in. Instead of enabling the Finder "title bar" to brandish the path, why not use the "path bar" itself? Later on all, this is what it's meant to practise.
The commanddefaults write com.apple.finder ShowPathbar -bool true
enables a "path bar" in Finder.
Y'all can also hide the "path bar" if yous want, but supplant "truthful" with "fake" in the command given above.
16. Open up Folders, URLs, Files, Applications
You tin open folders, files, URLs, even Applications, directly from the Last app. This is specially useful if you're writing a script to access a file, folder or a URL.
The command, intuitively, is "open up". The arguments you pass to "open up" helps information technology to make up one's mind what you're asking it to open.
For example, to open up a folder, the command will exist:
open /path/to/binder
If you accept navigated to some directory inside the Last, and you want to open that directory in Finder, simply employ the following command:
open .
Note: There is a "." after open, this "." implies that you lot're asking information technology to open the folder that information technology is currently in.
You can as well open up URLs.
open up "https://github.com"
will open up GitHub in your default browser.
17. Prevent Mac From Sleeping
There exists a plethora of applications that are directed at preventing your Mac from sleeping for a user specified menses of time, and they work. But why install a third-party app when you tin use the Terminal to achieve the same functionality?
There's a control line utility built-in into Mac, called "caffeinate". Cleverly named, as caffeine is known to prevent sleepiness, caffeinate tin be used to set a time for which your Mac will not sleep.
The command is elementary enough.
caffeinate -u -t time_in_seconds
So, if you wanted to preclude your Mac from sleeping for, say, 1 hour, the control volition become:
caffeinate -u -t 3600
eighteen. Put Display to Slumber After Specified Fourth dimension
On the other mitt, y'all might want to set your Mac so that it puts the display to sleep afterward a time specified past you.
You can use the "Power Manager" to achieve this. The command is simple, but requires "super user" access to run, as it changes power settings.
sudo pmset displaysleep time_in_minutes
Say you want your Mac to sleep after 5 minutes of inactivity, the command to enable this will be:
sudo pmset displaysleep 5
xix. Prepare Mac to Automatically Restart if Frozen
Macs are wonderful machines. They barely ever freeze, thank you to first-class management of resources by Os Ten that tries to put the user first. Nevertheless, every now and and then, even a Mac stops responding. The reasons for which may be one of many; the point is, at that instance, all you lot can practise is hold down the power button until your Mac powers off, and and then restart it.
Wouldn't it be better if you could merely set your Mac to automatically restart whenever it freezes? I think it would.
All you lot demand to practice, is runsudo systemsetup -setrestartfreeze on
and your Mac will automatically restart whenever (if, at all) it freezes. Dandy, correct?
Note: I couldn't actually test this, because I was evidently non going to freeze my Mac on purpose, but the documentation contains this feature, so it should piece of work.
20. Disable Autocorrect on Keyboard
Autocorrect is one of those features that can exist both a life saving, and a terribly annoying tool. Everyone has varying opinions on autocorrect, which is perfectly fine. If y'all remember autocorrect helps you more information technology annoys you lot, you're gold because Mac keyboards come up with autocorrect turned on, by default. If, notwithstanding, yous're like me, and y'all don't detect autocorrect useful enough, you tin disable information technology on your keyboard with a unproblematic control.
defaults write -yard NSAutomaticSpellingCorrectionEnabled -bool false
21. Disable the Default Long Press Activity for Keys
Everyone of united states has gone crazy at times and wanted to type messages that apply unnecessary repeated letters like "hiiiiiiii", or "yayyyy". Don't prevarication, I know y'all have, too. The problem, simply, is that the keyboard on Mac behaves like one would expect the keyboard for a mobile device to behave. Long pressing a cardinal comes up with a carte for accented characters. Some might find that useful, I find it unimportant. Sure, on an iPhone long pressing leads to accented characters, simply should it really exist that way on a laptop? I don't recollect so.
Fortunately, there'due south a way to stop this iOS like behaviour from leaking into our Macs.
defaults write -one thousand ApplePressAndHoldEnabled -bool fake
It'south recommended to log out and log in, in lodge for the changes to take result.
22. Adjust Central Repeat Rate
Then you changed the default long printing behaviour for your Mac, and you lot tried to echo letters by long pressing on the central, simply it'south simply too ho-hum (or possibly, besides fast)? All you need to practice is adjust the key repeat rate. Gear up the value to whatever y'all adopt, you'll accept to test out a couple of values to find a practiced match.
defaults write NSGlobalDomain KeyRepeat -int 0.02
This will set a very fast key echo rate. You can adjust the value to your preference.
23. Convert Audio File to iPhone Ringtone
iPhones use the .m4r format for ringtones, and if you have ever wanted to set your favourite song equally your ringtone, y'all're out of luck until you convert the file to the .m4r format. Fortunately, yous can do this very hands using the Terminal.
afconvert input.mp3 ringtone.m4r -f m4af
This control takes an input.mp3 file, converts it into .m4r format and saves information technology with the name "ringtone.m4r"
24. Create Audiobook from Text File
This is a fun i. One simple control on the Concluding, and you can convert any text file into an Audiobook, complete with proper pauses at punctuation marks.
The command itself, is: say -v Alex -f /path/to/file.txt -o "outputfile.m4a"
Annotation: This command creates the audiobook in the "Alex" voice, OS Ten has a lot of available voices to choose from, y'all tin observe out more than past running say -v ?
in the Last.
25. Disable Sound on Boot
Yep, y'all can press a fundamental while you lot ability your computer on, to forbid it from making the iconic "chime", merely you have to do that every time you start your Mac. Why not disable it completely? All you need to do, is run the post-obit command:
sudo nvram SystemAudioVolume=" "
26. Show WiFi Network Password
Oft times, it then happens that I have my Mac connected to a WiFi network and I want to connect my phone, likewise. Alas, I don't retrieve the countersign. I could gauge it, sure, but I could besides ask my Mac to just tell me. It seems to me, that the latter is a much more efficient mode to approach this particular problem.
security find-generic-countersign -D "Airport network password" -a "SSID" -gw
That is the command you need to run in the Terminal. Obviously, replace "SSID" with the proper name of the WiFi network you want to notice the password for.
Note: This control can just show the passwords to WiFi networks that your Mac has connected to, at least once. This is not a tool to crack WiFi passwords.
27. Generate Secure Passwords
Secure passwords are difficult to create and harder to recall. Well, I tin at least help you solve half of that problem. The other half – the remembering part – well, that'south on you. Y'all could merely write information technology down somewhere safety, you know.
Terminal can assist you generate strong passwords using this command:
date | md5
28. Take Delayed Screenshots
Always wanted to take a delayed screenshot? I personally haven't ever needed to, merely maybe you have. In that location has to exist someone who uses this, because there be third-political party apps that let this. Peradventure they want to create a fourth dimension-lapse of their screens, but I digress. I'm here to tell y'all that you don't need those third-political party apps in order to take delayed screenshots.
All you lot need is, you guessed information technology, the Terminal, and the following command:
screencapture -T 3 -t jpg -P delayedpic.jpg
This will accept a screenshot after 3 seconds, and save it as "delayedpic.jpg" on your computer.
29. Change Default Screenshot Format
Here, at Beebom, we use JPEG screenshots throughout the website; Macs take screenshots in PNG, by default. This caused a major difficulty: I had toconsign every screenshot to a JPEG format earlier I could utilize it on the website. However, it as well caused me to expect for a solution, and information technology turns out, the solution is a command; and a simple i at that.
defaults write com.apple.screencapture type "jpg"
This command volition save me countless hours of converting screenshots to JPEGs and then uploading them on the website.
thirty. Play iOS Charging Sound When MagSafe is Continued
To be honest, this is more of a gimmick; only it could be useful if the calorie-free on your MagSafe connector has gone bad, and doesn't work. Note that I said it "could" exist useful. I hateful, you tin notwithstanding run across the battery icon to bank check if your laptop is charging or non, but whatever. This is a cool hidden feature, nonetheless, and I'thousand covering it.
defaults write com.apple.PowerChime ChimeOnAllHardware -bool true && \
open /System/Library/CoreServices/PowerChime.app
You can plough it off, as well.
defaults write com.apple.PowerChime ChimeOnAllHardware -bool fake && \
open /System/Library/CoreServices/PowerChime.app
SEE ALSO: 25 Essential Card Bar Applications for Mac
Explore, Learn, Be Productive
These hidden features are non an exhaustive list. I don't claim to know everything the Terminal can practice, simply this commodity tin can requite y'all some idea near the advantages of exploring the Terminal and its commands. Try out the features I have explained in this article, and comment below, explaining your experience with these commands.
Source: https://beebom.com/mac-terminal-commands-access-hidden-features/
Posted by: rinconwhought.blogspot.com
0 Response to "30 Mac Terminal Commands to Access Hidden Features"
Post a Comment