Random Useful Commands

by Sebastien Mirolo on Sun, 12 Apr 2009

It often happens that source files include meta information written by the source control software in the comments. As a result, when you use diff to find relevent differences between branches, the output gets clottered with "diff noise". You can use the -I option to get rid of it.

diff -ru -I '$.*$' prev current

If you would like to run Emacs or any other X11 application over ssh on OSX, launch the OSX X11 utility and in an X11 terminal window (not Terminal.app):

$ ssh -X -l login machine

Then run remote commands in the terminal window and they will appear on your local desktop. (ex. emacs filename &).

If all you need is to edit remote files, you can do that from within your local Emacs using transparent remote file access. That avoids running an X11 and configuring Emacs on the remote machine.

For unknown reasons, it happens that sometimes a perfectly well formatted unix file turns into text with "mac" line ending (i.e. "mac" shows up in the emacs bottom status bar). To fix this, just type M-x, set-buffer-file-coding-system, RET, unix.

Also, you sometimes cannot delete files in OSX even though *ls* shows you have permissions to those files. This is because OSX has a BSD heritage and implements extended flags. You can use the *chflags* command to update those flags (ex. chflags nouch filename or man chflags for more information). Linux also has extended flags on an ext filesystem but it uses a different mechanism and different commands to access them.

I read the following post and now this has become one of my favorite git command line.

$ git log --graph --pretty=oneline --abbrev-commit

The following article will show you how to detach a process from the shell.

by Sebastien Mirolo on Sun, 12 Apr 2009