Linux: Convert Tabs to Spaces

Objective: Convert a text file with tabs to spaces on Linux.

There are various tools to convert tabs to spaces. One of the them is the expand tool.

To convert a single tab to 4 spaces, use the following syntax.

If you are only interested in replacing the initial tab-based indents with spaces in your source code files and not convert any tabs defined in strings, use expand with “-i” option.

To convert a tab into 4 spaces using sed, use the following syntax.

If you are editing a file in vim, use :retab command.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }