To print tab characters (and other control characters) you cant just press Tab because tab is a special auto complete char in bash.
Control-V then Tab or Control-V then Control-I (also known as ^I) – Tab character – so to print a Tab character you can use both of these combos
Example:
echo “Here comes a tabControl-V then Tabwhatever”
Will show: as echo “Here comes a tab whatever”
Hitting enter you will see
Here comes a tab whatever
Sidenote: In this article I actually used spaces to represent a tab (whatever, whocares)
Sidenote: if you select the tab character from the shell (by dragging a box around the echo or around the output) and paste it within a putty again it will actually put spaces into clipboard, but using bash history with up and down arrows you will actually have the tabs preserved. So with clipboard the tabs turn to spaces, but in bash history its actually shown as Tabs.
So to the outside viewer a tab or a few spaces look similar, so how do you distinguish them? One way is to add some characters and see how tab jumps things around more than a few character spaces (where as space always just keeps the same distance)
The best way, in my opinion, is to pipe the output of whatever text into cat -tevu (the t specially will convert all Tabs into ^I)
echo “Here comes a tabControl-V then Tabwhatever” | cat -tevu (the bold are special keys to press)
Here comes a tab^Iwhatever
The ^I means tab, a single tab char. If I saw ^I^I that means there were two tabs (Control-V then Tab, followed by Control-V then Tab again, will get us two tabs on the shell)
sidenote: there are other control characters, not just tab, for example ^X (control-V control-x) is the delete character it will show up as ^X but it will act as a delete in the output. cat -v shows those.