Useful tips for using Mac OS X for research


  1. How-Tos

  2. Shortcuts

  3. Applications

  4. Scientific Software

  5. Links

  6. Terminal Commands



                         









How-To

  • Dictionary and Thesaurus

    One very practical feature of Mac : Using Spotlight (shortcut : command + space) you can type in a word and if you click the result tagged "Definition" (or "Look Up" in newer versions) it opens up the Dictionary.
    By clicking on the Thesaurus tab (or any of the alternative) you search for the same word in the different databases.
    The shortcut : Command + L takes you directly to that entry and Command + D opens the dictionary application.
  • Add extra languages to the Dictionary

    In order to add extra languages to the Dictionary applications, the first step is to use the Preferences menu and select the ones you want that are already available.
    To add languages from external files, you need to use the DictUnifier application to convert them to the correct format.
  • Make Safari download PDF files instead of openning them

    In terminal, type: defaults write com.apple.Safari WebKitOmitPDFSupport -bool YES and restart Safari.
  • Creating Bootable USB in Mac OS X (Leopard or higher) using DiskUtil

    1. Open a Terminal, Insert your flash media and run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
    2. Run diskutil unmountDisk /dev/diskN
    3. Execute sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m
    4. Run diskutil eject /dev/diskN and remove your flash media when the command completes
  • Create text clippings

    Highlight a text and drag it to the desktop. This creates a clipping file which contains the text.
  • Insert special characters

    In TextEdit, go to menu Edit - Special Characters.
  • Use boolean operators in spotlight

    You can use the boolean operators AND, NOT and OR in the spotlight search.
  • Protect files from deletion

    You can protect important files from accidental deletion by locking them. To do so, right click on the file - Get Info - check "Locked"
    Stationery pad option creates a copy of the file every time you access it, in order to protect the file from accidental modifications.
  • Use keyboard viewr

    Click on the language icon in the menu bar and select Keyboard Viewer. With this application you can find the shortcuts for many special characters etc.
  • Read RSS

    To follow blogs and websites using the RSS protocol, one of the best tools is Google Reader.
    For pages that change but do not support RSS, various online tools can be used to provide the content in RSS. A good example is Page2RSS.
  • Tag cloud

    Wordle tag cloud generator - It helps generate some of the nicest tag clouds out there.
    Tumblr tag cloud generator - Very easy to use, javascript/Tumblr API based tag cloud generator.
  • Block access to specific domain

    echo 0.0.0.0 "domainname" >> /etc/hosts
    If you ever want to remove the blocking, open the file /etc/hosts and remove the corresponding line.
  • Share files

    Dropbox and Google Drive are the two best options.
    In Dropbox, you can create photo albums, make your files public, create shared folders, synchronize and backup your data.
  • Host a website

    There are many ways to do that, but a particularly easy an straightforward way is by using the Dropbox.
    You can just create the website and place it in the Public folder of Dropbox. If you own a domain, you can set up a web redirect service, linking to your homepage.
  • Multimedia

    • Take Screenshot

      a. Full screen : Command + Shift + 3
      b. Partial : Command + Shift + 4 and select the area you want
    • Record Screencast

      Using QuickTime Player, menu File - New Screen Recording.
      It can record microphone and computer sounds.
      Trick : If you want to record from the computer camera on the same time, you can do it in two ways :
      1. Use QuickTime's Movie recording to record in Parallel and then post-process the two videos if you want to overlay one to the other.
      2. Use QuickTime's Movie recording but instead of recording the video from the camera, just have the camera window open in the desired place in the screen.
    • Make a video from images

      In QuickTime, go to File - Import Image Sequence and import the images you want to convert to a video.
    • Disable the Volume changing sound effect

      When setting the Volume, there is a sound effect which can be disabled by going to the menu :
      System Preferences - Sound - Sound Effects - Uncheck "Play feedback when volume is changed"
    • Disable startup sound

      To disable the startup sound, type the following at the terminal : sudo nvram SystemAudioVolume=%80.
      Alternatively, you can install the StartupSound pref pane.
  • Maintenance

    • Repair disk permissions
    • Disk Utility - Verify Disk Permissions - Repair Disk Permissions
    • Apple Hardware Test

      To launch Apple Hardware Test (a utility that checks the status of various components of the Mac, reboot and hold down one of the following combinations during startup :
      * Option + D
      * Command + D
      * D
    • Start up in Single-User Mode

      Hold down Command + p while starting up.
    • Enable TRIM

    • Minimize application footprint

      Monolingual
    • Reduce standby delay

      To check the standby delay (in seconds) : pmset -g |grep standbydelay
      To set it : sudo pmset -a standbydelay 43200
    • Disable startup chime

      Type in terminal : sudo nvram SystemAudioVolume=%80
    • Disable sleep mode for given time

      Type in terminal : caffeinate -t MINUTES, where MINUTES the number of minutes you want to disable sleeping mode for.
    • Disable notification center

      Type in terminal : launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
      followed by : killall NotificationCenter
    • Enable copying from QuickView mode

      Type in terminal : defaults write com.apple.finder QLEnableTextSelection -bool true
      followed by : killall Finder
  • To be added

    • Create aliases

    • Print to PDF file

    • Use LaTeX

      Texshop
    • Write Greek in LaTeX

    • Use Windows in Parallels

    • Share files and folders

    • Connect Remotely with another computer

    • Use torrent protocol

    • Use internet relay chat (IRC)

    • Find ebooks on IRC

    • Control mac with speech

    • Automator

    • Apple Script

    • Burn DVD

    • Create ISO file

    • Convert a DMG file to ISO

      hdiutil convert /path/imagefile.dmg -format UDTO -o /path/convertedimage.iso
    • Convert an ISO file to DMG format

      hdiutil convert /path/imagefile.iso -format UDRW -o /path/convertedimage.dmg
    • Reference management

    • Blogging

    • Security upgrade

      To be added : Prey, encrypt files, Vidalia, Tor, Firewall





Shortcuts

List of key names

⌘  Command
Control key icon  Control
Option or Alt key icon  Option - "Alt"
Shift icon  Shift
fn (Function key) 









  • Add a Paste Without Formatting shortcut: Go to System Preferences --> Keyboard --> select the Keyboard Shortcuts tab, --> select "App Shortcuts". Click the plus button at the bottom and enter (sans-quotes) "Paste and Match Style" for the Menu Title --> In the Keyboard Shortcut, press the desired shortcut (e.g. Shift + Command + V) --> Press the Add button.
  • Space : Quick look file
  • Enter : Rename
  • Alt : Changes some of the application menus
  • Command + Space : Open Spotlight search
  • Escape : Clear what you have typed (in Spotlight)
  • double Escape : Close Spotlight search
  • Command + , (comma) : Open application preferences
  • Command + W : Close window
  • Command + Q : Quit application
  • Command + o : Open selected file
  • Command + Tab : Cycle between applications
  • Command + ~ : Cycle between windows of the same application
  • Command + down arrow : Open selected file
  • Command + up arrow : Move to enclosing folder
  • Command + down arrow : Open file
  • Alt + click on menu bar items : Extra options
  • Command + L : Create an alias
  • Command + R : Open the original (for an alias)
  • Command + Alt + drag and drop file : Creates and moves an alias instead of the actual file
  • Command + Enter : While in Spotlight, it opens the parent folder of the selected file
  • Command + Backspace : Send selected file to Trash
  • Alt + Empty Trash : Securely delete data
  • -----------------------------------------------------------------------------
  • Command + T : Open new tab (in Firefox/Chrome)
  • Command + W : Close tab (in Firefox/Chrome)
  • Control + Tab : Cycle between tabs (in Firefox/Chrome)
  • Command + N : Open new window (in Firefox/Chrome)
  • Command + click : Open link in new tab (in Firefox/Chrome)
  • Command + Enter : Open typed url in new tab (in Firefox/Chrome)
  • Command + "=" : subscript (in Word)
  • Shift + Command + "=" : superscript (in Word)
  • Alt + Space : non-breaking space (in Word)
  • Shift + Enter : line break (in Word)
  • Control + Command + H : Highlight selected text (in Preview)
  • Command + L takes you directly to the dictionary entry (in Spotlight search)
  • Command + D : opens the dictionary application. (in Spotlight search)





Applications






Scientific Software






Links






Terminal Commands

All the commands below can take a lot of options, that alter their behavior.
Using the command : man "commandname" you can find all the necessary information for using it.
"filename" signifies the file and should be used without the quotes.

    Basic

  • history
      displays command history
  • more
      displays contents of file
  • head"filename"
      outputs first 10 lines of file
  • head"filename"
      outputs last 10 lines of file
  • chmod
      change file permissions
  • cd
      change directory
  • mkdir
      create directory
  • mv "filename" "newfilename"
      rename file
  • rm
      remove file
  • setenv "VARNAME" "value"
      set environment variable to value
  • echo $"VARNAME"
      get value of environment variable
  • rmdir
      remove directory
  • ls
      list files in directory
  • pwd
      current working directory
  • .
      current directory
  • ..
      parent directory
  • echo "command"
      echoes command to output
  • cp "filename" "path"
      copies file
  • open filename
      opens the file with the default program
  • cat "filename"
      see file contents
  • while [1]; do commands; done;
      opens a loop that will
  • sleep "seconds"
      pauses the loop for some time
  • for
     
  • let "arg"
      evaluates "arg"
  • make executable
     
  • | (pipe)
      placed after a command, it pipes the output as an input to the command after the pipe
  • unzip filename.zip
      unzips a zip file
  • command > filename.txt
      write output of a command to a file
  • command >> filename.txt
      append output of a command to a file
  • nano "filename"
      very simple text editor
  • pico "filename"
      even simpler text editor
  • grep
      powerful command to search in a file
  • emacs
      unix text editor
  • vi
      unix text editor


  • Advanced

  • wc "filename"
      word, line and character count
  • ssh
      connect to a server using ssh protocol
  • curl - o "webaddress"
      Download files directly from the Terminal (Mac OS X)
  • tidy filename.html
      clean html code
  • /usr/share/dict/words
      dictionary file
  • sudo mdutil -E / ;sudo mdutil -i on /
      re-index spotlight database
  • unzip -l $@ filename.zip
      shows the content of a zip file
  • sudo /usr/libexec/locate.updatedb
      Update locate database
  • locate "filename"
      Search for filename
  • mdfind "keyword1 keyword 2"
      search for files containing keywords in filename or metadata
  • killall "applicationname"
      stop application
  • alias
     
  • date
      displays date and time information in a variety of formats
  • cal month year
      calendar
  • md5 "filename" or md5 "word" or openssl sha1 "filename"
      calculates hash for file or word
  • od -vAn -N4 -tu < /dev/urandom
      produces random numbers


  • Special

  • /System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background &
      Make your Screensaver the background image of your desktop (the terminal window must remain opened)
  • man -t "command" | ps2pdf - "filename.pdf"
      Saves a the man page of a command in pdf format
  • screencapture -t jpg -x "directory"
      Takes a screenshot
  • for filename in *.jpg; do mv $filename ${filename%.jpg}.gif; done
      Changes the ending of all the jpg files to .gif. For more info on Pattern Substitution have a look here.
  • sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport /usr/sbin
      Link to the airport command line utility
  • sudo airport -z
      Dissociate networks
  • openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
      Generate random MAC address
  • ifconfig en0 | grep ether
      Find current MAC address
  • sudo ifconfig en0 ether xx:xx:xx:xx:xx:xx
      Spoof MAC address (where xx:xx:xx:xx:xx:xx the new desired MAC address)
  • sudo mdutil -i on /Volumes/XY
     Enable spotlight indexing of volume XY. With flag -i off you disable it.
  • sudo mdutil -E /Volumes/XY
     Build spotlight index for volume XY.