Posts Tagged ‘Linux’

How to Remove Spaces from Filenames in Linux/UNIX

Wednesday, April 22nd, 2009

This command will rename all files that have spaces in their filenames, in the current directory and recursively in its subdirectories, so that in the new filenames all spaces are replaced with underscores (‘_’ characters). find . -name ‘* *’ | while read file; do target=`echo “$file” | sed ‘s/ /_/g’`; echo “Renaming ‘$file’ to [...]


Code completion (IntelliSense) for C++ in Vim with OmniCppComplete

Friday, March 20th, 2009

C++ autocompletion is possible with VIM. This is officially the coolest tech discovery I’ve made this year. And it’s easy to setup. Here’s how to configure C++ IntelliSense for Vim, with an example that demonstrates how to enable code completion for the the C++ Standard Template Library (STL). 1. Download You need the following: Vim [...]


Floating point arithmetic using bc

Monday, March 16th, 2009

The bc shell utility that is available on most UNIX/Linux distributions defaults to integer arithmetic (i.e. throws away anything after the comma). To prevent this, you can set the “scale” option in bc. E.g., the following command will return 3.333: echo “scale=3; 10/3″ | bc


How to insert the output of a command in VI

Friday, February 27th, 2009

To insert the output of a command (e.g. ‘ls’) below the cursor, type: :r !ls or :read !ls