Question: When I am in `vim` I can change the tab size with the following command:

```
:set ts=4

```

Is it possible to set tab size for `cat` command output too?

Answer: 
**For X terminal emulators (eg. `$TERM` is `xterm`, `st`, etc.):**

```
$ tabs -N

```

**For virtual consoles (no X Server, only text console where `$TERM` is `linux`, etc.):**

```
$ setterm --tegtabs N

```

Where `N` is an integer number of spaces to be used for TAB.

**Sed way insead of `tr` which translates `SET1` to `SET2` of characters in `1:1` 'proportions':**

```
$ sed 's/\t/    /g' FILENAME
           ^^^^^
        spaces here

```
According to the manpage, cat can not do it on its own. But you can e.g. run the output from cat through `tr` filter to replace the tabs with any number of spaces you wish:

```
cat somefile | tr '\t' '  '

```

will replace the tab character with two spaces.

Update: as pointed out in the comments to this post, this actually **does not** work. Nevertheless, I'm keeping the answer as an example of how **not** to do it.