M A C ’ S T E R M I N A L P R E S E N T E D O N M A R C H 8 , 2 0 1 6 B Y B U RT S T E P H E N S , O M U G M E M B E R Note: You will not be able to run Terminal from this PDF. You are encouraged to try Terminal on your computer. Music: From the Terminal Movie, John Williams Conducting
G E T T I N G U N D E R T H E H O O D
A B O U T T E R M I N A L • Included with All Versions of Macs’ OS X • Works under the hood (by providing an Interface to control the UNIX Operating System • Uses a Command Line rather than a Graphic Interface • “Terminal” is a terminal emulator - the devices people used in the days of mainframe computers http://www.macworld.co.uk/feature/mac-software/get-more-out-of-os-x-terminal-3608274/
S O M E T H I N G S Y O U C A N D O • Show Hidden Files ( defaults write com.apple.finder AppleShowAllFiles TRUE ) • Disable Window Animations ( defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false ) • Change Screenshot Formats ( defaults write com.apple.screencapture type file-extension ) • Show File Path Info ( defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES ) • Erase Free Hard Drive Space Securely ( diskutil secureErase freespace 3/Volumes/hard-drive-name) OR ( sudo rm -rf /) • Enable AirDrop Over Ethernet ( defaults write com.apple.NetworkBrowser BrowseAllInterfaces - bool true )
How to open the command line • On OS X, open your Applications folder • Then open the Utilities folder • Then Open the Terminal application. • You may want to add this to your dock. • OR you can launch terminal by using Spotlight search in OS X, searching for “terminal”.
S O M E B A S I C • cd - change directory T E R M I N A L C O M M A N D S • mkdir - make directory • pwd - path of current directory • touch - create multiple files • cp - copy • ls - list • mv - move (replace) • rm - remove or delete • open - opens a file • clear - clear the window http://www.macworld.co.uk/feature/mac-software/get-more-out-of-os-x-terminal-3608274/
F O R M AT O F A C O M M A N D L I N E • Command • Argument • Flags
I N S TA N T LY G E N E R AT E A C A L E N D A R C O M M A N D : C A L M O N T H Y E A R ( C A L 3 2 0 1 6 )
N AV I G AT I N G T O F O L D E R S E X A M P L E : C D / A P P L I C AT I O N S / U T I L I T I E S T H E N L S
L I S T C O N T E N T S O F D I R E C T O RY L I S T - L S ; V I E W I N A L I S T F O R M A T - L S - L
E N A B L E A I R D R O P O N O L D E R M A C S AirDrop sends files between Macs quickly and easily. Trouble is, it’s only on WiFi and on more recent Macs. If your Mac doesn’t currently support AirDrop, you can enter the following command to use it, as well as to use it over ethernet: $ defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool TRUE You’ll need to restart the Finder, the quickest way is to use the killall command which will restart it: $ killall Finder To revert the changes, enter: $ defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool
R E B U I L D S P O T L I G H T Spotlight can occasionally not work as well as we’d like. Sometimes, we just need to tell Spotlight to create a new index so it can find files as fast and efficiently as possible. To do this: $ sudo mdutil -E /Volumes/DriveName The above command will delete Spotlight’s index, forcing it to start a new one. SUDO requires a password which is your computer administrative password. It allow the user to execute a command as superuser or to another computer. BUT BE CAREFUL.
M A K E Y O U R M A C TA L K Example of Talking with a Selected Voice: say -v Karen “Hello Jim” Example of Audio Text File Being Saved: say -v Alex -r 175 -o /Users/burtstephens/Music/Young_output.aiff -f / Users/burtstephens/Desktop/young.txt v = voice, -r =reading speed, -o = output type and location, -f = specific text file
D O W N L O A D F R O M U N S TA B L E S E R V E R Sometimes you are downloading a big file, but it keeps failing, and you always have to hit RESUME. Your problems are over, with this code, if the download stops suddenly, it will automatically restart. This code have a 15kbps speed limit, delete –limit-rate 15k to remove the speed limit. while ! curl -C - -O --limit-rate 15k file-address- goes-here; do sleep 10; done
A D D R E S S B O O K D E B U G M E N U If you have some trouble with Address Book it may be useful to open up the debug menu as well as this use some of the hidden features. Make sure address book is closed first before applying the code. If you want to revert it remove YES in the string. defaults write com.apple.addressbook ABShowDebugMenu -bool YES
E N A B L E T I M E M A C H I N E O N U N S U P P O RT E D D R I V E S Enable Time Machine to work on unsupported drives such as a NAS. Use with caution as it is unsupported. defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
S E T S C R E E N S AV E R A S WA L L PA P E R This command sets the currently selected screen saver as the desktop background. Use command + c or . to stop while in Terminal. Alternatively you can use wallsaver. /System/Library/Frameworks/ScreenSaver.framework/ Resources/ScreenSaverEngine.app/Contents/MacOS/ ScreenSaverEngine -background
E J E C T A S T U C K O R D V D For a Single Optical Drive use the command: drutil eject If you have both an internal and external optical drive: Use either drutil eject internal or drutil eject external
Some Terminal Commands to Speed up your Mac in OS X El Capitan 1.. Disable animations when opening and closing windows. 2. Disable animations when opening a Quick Look window. 3. Accelerated playback when adjusting the window size 4. Disable animation when opening the Info window in OS X Finder 5. Disable animations when you open an application from the Dock. 6. Make all animations faster that are used by Mission Control. 7. Disable the delay when you hide the Dock 8. Disable the animation when you sending and replying an e-mail 9. Disable the standard delay in rendering a Web page. 10. The keyboard reacts faster to keystrokes http://www.defaults-write.com/10-terminal-commands-to-speed-up-your-mac-in-os-x-el-capitan/
D E V E L O P A L I B R A RY O F C O M M A N D S • Appearance ◦ Transparency ◦ Wallpaper • Applications ◦ App Store ◦ Apple Remote Desktop ◦ Contacts Contacts ◦ iTunes Debug Mode ◦ Mail # Enable defaults write com.apple.addressbook ABShowDebugMenu -bool true ◦ Safari ◦ Sketch # Disable (Default) ◦ Skim defaults write com.apple.addressbook ABShowDebugMenu -bool false ◦ TextEdit • Backup ◦ Time Machine … https://github.com/herrbischoff/awesome-osx-command-line#shells
For a large email database that hasn't been optimized for a while, this can provide significant improvements in responsiveness and speed. VA C U U M M A I L I N D E X
TA K I N G T H E N E X T S T E P S
P R O G R A M M I N G W I T H P Y T H O N Python is a clear and powerful object-oriented programming language, comparable to Perl, Ruby, Scheme, or Java. • Python is pre-installed with latest versions of OS X • (El Capitan comes with Python 2.7) • More serious users with want to download Xcode and Homebrew
S I M P L E E X A M P L E W I T H P Y T H O N : L I S T I N G N A M E S O F F R I E N D S
A N O T H E R P Y T H O N E X A M P L E : I F, I F - E L S E , A N D E L S E
H O M E B R E W Homebrew Cask extends Homebrew with support for quickly installing Mac applications like Google Chrome, VLC, and more. No more dragging and dropping applications! • Free and open-source software that simplifies the installation of software on Apple's OS X operating system. • Written in Ruby programming language which comes installed with oS X
X C O D E . The newest version of Xcode -7 includes everything you need to create apps for iPhone, iPad, Mac, and Apple Watch. The Swift programming language (Version 2) has been updated and is now faster than ever, with great features that make your code even easier to read and write. And with the new playgrounds you can experiment with new APIs or author gorgeous interactive documentation using embedded resources, additional source code, and rich text comments. Xcode’s user interface testing feature can even record your app in action and generate tests for you. To Install X Code: https://itunes.apple.com/us/app/xcode/id497799835?mt=12
O T H E R U S E F U L A P P L I C AT I O N S Automator or Hazel F or OS X that implements point-and-click (or drag and drop) creation of workflows for automating repetitive tasks into batches for quicker alteration, saving time and effort over manually changing each file separately. https://www.noodlesoft.com/hazel.php
Y O U C O U L D W I N AT T O N I G H T ’ S R A F F L E
With Joe Kissell’s Book you will be able to - Figure out what’s preventing a disk from unmounting or ejecting Tell which applications are currently assessing the Internet Rename files in bulk (older OS Xs) Chase File Permissions Automate command-line activities with scripts
Recommend
More recommend