You can use expand to replace tabs with spaces. For example, if your editor has tab set as 4 spaces then use: expand -4 MyFile.java > temp VERIFY WITH AN EDITOR THAT IT DID THE RIGHT THING IN temp THEN mv temp MyFile.java The default is 8 spaces so expand MyFile.java > temp will replace tabs with 8 spaces. DO NOT use "expand MyFile.java > MyFile.java". This will result in an EMPTY FILE. You must use an intermediate temp file. This occurs because the file redirection creates a new empty file the overwrites the original before the expand reads the original.