Displaying Tabs In A File

Question:

How can I display tabs (tab characters) in a file ?
Is there any command in vi which displays tabs? 

Answer:

In command mode do "set list", and the ^I is the tab identfier.  To undo it do "set nolist". 

Enter :set list, or :set nolist to revert back.
 

Question:

How do I know the space s in a file are white spaces or tabs in UNIX?

Answer:

Method 1:

Use vi or vim,

After opening the file, type :set list, all the tabs will shown as “^I”

$ vi abc

This file^Icontains some spaces  and^I^Itabs.$
Do you^I see any ^I ^I tab?$
~

Method 2:

Use cat command with -vt flags.

$ cat -vt abc

This file^Icontains some spaces  and^I^Itabs.
Do you^I see any ^I ^I tab?

Have a Unix Problem
Unix Forum - Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.