I would like to display the contents of a text file on the command line. The file only contains 5-6 characters. Is there an easy way to do this?
How can I display the contents of a text file on the command line?
command line;files;cat
Using catSince your file is short, you can usecat.cat filenameUsing lessIf you have to view the contents of a longer file, you can use a pager such asless.less filenameYou can make less behave like cat when invoked on small files and behavenormally otherwise by passing it the -F and -X flags.less -FX filenameI have an alias for less -FX. You can make one yourself like so:alias aliasname='less -FX'If you add the alias to your shellconfiguration, you can use itforever.Using odIf your file contains strange or unprintable characters, you can useod to examine the characters. For example,$ cat file(Z4?o=j$ od -c test0000000 202 233   ( 320   K   j 357 024   J 017   h   Z   4 240   ?   o0000020   = 367  \n0000023