Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Mac OS X Terminal Tips


1. Go to beginning of the current line

Ctrl + A

2. Go to the end of the current line

Ctrl + E

3. Copy the current path

$ pwd | pbcopy

4. Clear the screen [same as clear]

Ctrl + L

5. Display all the environment variables

$ env

6. Deleting from current position to the end of the line

Ctrl + K

7. Deleting from current position to the beginning of the line

Ctrl + U

8. Deleting the first word before current position

Ctrl + W

9. Move the cursor a letter back from the current position

Ctrl + B

10. Move the cursor a letter forward from the current position

Ctrl + F

11. Open current location in Finder window

$ open .

12. Open a file with unknown extension with the default editor

$ open -t file.ext

13. Watch a particular file to see who's opening it

sudo opensnoop -f PathToTheFile

14. Text-to-speech

say "HI"

15. Runs the last command again
!!

16. Hold option and click a position in the current line to move your cursor to that position.

17. List all possible commands
Hit and hold ESC

Installing Scapy on Mac OS X

I wouldn't have written this blog post, if everything went well for me while doing the $subject..

I was trying with MacPorts - it gave me the following error..

:error:configure db46 requires the Java for Mac OS X development headers.
:error:configure Download the Java Developer Package from:
:error:configure Target org.macports.configure returned: missing Java headers
:debug:configure Backtrace: missing Java headers while executing
"$pre $targetname"

By going through some of the MacPorts tickets found out that we need to have Java for Mac OS X 10.6 Update 3 Developer Package installed first - which you can get from here.

Once that is done, only following is needed..

$ sudo port install scapy

Mac OS X 10.6 terminal gets so long to load

This is something I faced after using the MacBook Pro for a month long...

Following is the solution..

sudo rm -f /private/var/log/asl/*

Make sure, you backed up any logs you require before executing the above...

Building and installing MacPorts on Mac OS X 10.6 from source

The MacPorts project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.

1. svn co http://svn.macports.org/repository/macports/trunk/base/ macports

2. cd macports

3. ./configure

4. make

5. sudo make install

6. sudo /opt/local/bin/port -v selfupdate

To test the setup, lets try to install MySQL via MacPorts...

1. export PATH=/Developer/usr/bin:/Developer/usr/sbin:/opt/local/bin:/opt/local/sbin:$PATH

2. sudo port install mysql5-server