Showing posts with label terminal. Show all posts
Showing posts with label terminal. Show all posts

Tuesday, 21 August 2012

OSX Terminal: alt-left jump word ctrl-left go to start and more

By default OSX Terminal doesn't let you use many standard OSX text-editing shortcuts. For example, CMD or Control Left normally jumps to the start of the line. Alt-left jumps left one word. Also forward delete doesn't work.

Happily it's possible, though slightly confusing, to add these shortcuts back.

Here's how:
  • Open Terminal Preferences
  • In the Settings Pane, select Keyboard


  • Click the + button



  • Now let's add those shortcuts back.
For jump-to-start-of-line:
  • Key: Cursor Left
  • Modifier: Control
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-A. \001 will appear
For jump-to-end-of-line:
  • Key: Cursor Right
  • Modifier: Control
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-E. \005 will appear
To re-activate forward delete
  • Key: forward delete
  • Modifier: none
  • Action: send string to shell: (the default)
  • Click in the empty white box and press CTRL-D. \004 will appear
To move forwards one word at a time
  • Key: cursor left
  • Modifier: option
  • Action: send string to shell: (the default)
  • Click in the empty white box and press Escape+b. \033b will appear
To move backwards one word at a time
  • Key: cursor right
  • Modifier: option
  • Action: send string to shell: (the default)
  • Click in the empty white box and press Escape+f. \033f  will appear.


I find adding these shortcuts in makes terminal much more usable. 


Thursday, 28 June 2012

Take an iPhone or iPad Screenshot from the Command-line


Here's another tip using the great libimobiledevice library http://www.libimobiledevice.org/, originally built to manage iOS devices on Linux.

Taking app screenshots is a bit of a pain. We tend to do the following:

  • Run the app
  • Press Home+Power together to take a photo,
  • Go to the photo library
  • Find the photos
  • Email them to ourselves.

Using this method you can type a Terminal command, and have the screen appear directly on your computer. Much easier.
Here's how:

Connect your device, open up Terminal.app and type:

idevicescreenshot

It'll save a .TIFF file to the current directory. Easy!

Tuesday, 26 June 2012

Install iPhone / iPad / iOS App IPA without iTunes or Xcode

Using the great libimobiledevice library http://www.libimobiledevice.org/, originally built to manage iOS devices on Linux, it's possible to do a bunch of cool things, including installing an app directly on a connected device without needing to use iTunes or Xcode.

Here's how:

Now connect your iDevice, open Terminal.app and type:

ideviceinstaller -i myApp.ipa

Note: Your IPA will need to have a valid code signature and mobileprovision file for the install to succed. This system is NOT a way around iOSs security!

Wednesday, 8 September 2010

Mac OSX Terminal: Recursive list of files in directory excluding .svn and .DS_Store folders / files

Those pesky .svn and .DS_Store files and folders are the enemy of many a terminal command..
Here's how to get a handy list of all files in a folder without them, in a simple format for later processing.

find * -type f | grep -v "\.svn" | grep -v "\.DS_Store"


Outputs:
App-Info.plist
Default.png
GpsDrawTheme/theme.json
RootModule/code/common.js
RootModule/code/db.js
RootModule/code/drawing.js
RootModule/code/drawingMenu.js
RootModule/code/index.js
RootModule/code/instructions.js
RootModule/code/myDrawings.js
.. etc


I'm sure there's a way this could be simpler, but this works for me.

Wednesday, 1 September 2010

MacOSX: Opening documents, folders, and applications from the command line

The Mac OSX command line has a very handy 'open' cp,,amd which tells the Mac OS UI to open the item you pass in. This is great for switching from using the terminal to using the UI for those times when the UI is more convenient.

Open the current folder in Finder
open .


Open a file using the default application
open mydoc.txt


Open a file a specific application
This is the same command as right-clicking on an item in finder and choosing 'Open With'. It can be really handy for testing an html file in a specific browser.

open -a /Applications/Safari.app index.html