[SOLVED] Terminal spits out gobblegook! [SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
silverpuma
Level 1
Level 1
Posts: 23
Joined: Fri Jul 26, 2013 4:23 pm

[SOLVED] Terminal spits out gobblegook! [SOLVED]

Post by silverpuma » Wed May 09, 2018 2:30 pm

Hi folks, need some help. I've just started learning command line/ terminal but I must have messed up the terminal. When I now try to practice the cat command to display the contents of a text file I saved to my documents the output to the terminal is random characters. Can I fix the terminal or can I uninstall the terminal and reinstall a fresh copy?
Thanks in advance for any help ........ https://photos.app.goo.gl/3TmLS2SorBbwsUVZ9
Last edited by silverpuma on Thu May 10, 2018 5:18 am, edited 3 times in total.
It takes considerable knowledge just to realize the extent of your own ignorance.....T Sowell

User avatar
Flemur
Level 17
Level 17
Posts: 7171
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Terminal spits out gobblegook!

Post by Flemur » Wed May 09, 2018 2:39 pm

silverpuma wrote:
Wed May 09, 2018 2:30 pm
When I now try to practice the cat command to display the contents of a text file I saved to my documents the output to the terminal is random characters.
The problem might be how you're saving the text file - is it from libreoffice, or something similar?

You output has mime type "vnd.oasis.opendocument.text", which I think is like a MS .odt file:
https://www.openoffice.org/framework/do ... types.html
which contains special characters for formating, which look like junk.

So I don't think there's anything wrong with your terminal.

Try
- open the same file with a plain text editor, like leafpad or gedit, see if you get the same stuff.
- try saving the HTML from a web page and "cat file.html", html should be pure regular text, as should the files in
/usr/share/doc/<various-program-names>/README
(But NOT README.gz - that's like a zip file).

- or things like

Code: Select all

ls -l > a.txt
cat a.txt
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

silverpuma
Level 1
Level 1
Posts: 23
Joined: Fri Jul 26, 2013 4:23 pm

Re: Terminal spits out gobblegook!

Post by silverpuma » Wed May 09, 2018 2:55 pm

Flemur wrote:
Wed May 09, 2018 2:39 pm
silverpuma wrote:
Wed May 09, 2018 2:30 pm
When I now try to practice the cat command to display the contents of a text file I saved to my documents the output to the terminal is random characters.
The problem might be how you're saving the text file - is it from libreoffice, or something similar?

You output has mime type "vnd.oasis.opendocument.text", which I think is like a MS .odt file:
https://www.openoffice.org/framework/do ... types.html
which contains special characters for formating, which look like junk.

So I don't think there's anything wrong with your terminal.

Try
- open the same file with a plain text editor, like leafpad or gedit, see if you get the same stuff.
- try saving the HTML from a web page and "cat file.html", html should be pure regular text, as should the files in
/usr/share/doc/<various-program-names>/README
(But NOT README.gz - that's like a zip file).

- or things like

Code: Select all

ls -l > a.txt
cat a.txt
Thanks for the fast reply. And yes you're correct i made the text file in Libreoffice. For my first attempt, I just saved the documant as a .odt file and the terminal printed the random characters, then I just changed the .odt to .txt but still the same output. But from your answer is it the case that the "cat" command in the terminal will always do this if I am using a document from Libreoffice etc and it only works properly if I use a text editor? If I understood you correctly, this would mean if I tried the "cat" command on a .pdf document for example, the terminal output would be be junk as well? Its as you said the....... "formatting"? I just did not know or understand that, so my stupid mistake :oops: .....

Anyhow I'll try what you suggested and will be back with the news...... :D
It takes considerable knowledge just to realize the extent of your own ignorance.....T Sowell

silverpuma
Level 1
Level 1
Posts: 23
Joined: Fri Jul 26, 2013 4:23 pm

Re: Terminal spits out gobblegook!

Post by silverpuma » Wed May 09, 2018 3:04 pm

https://photos.app.goo.gl/bX61r381iAPUo5At6 Yes it worked...... :roll: Thank you so much for the quick advice. When I open the file with the text editor it was full of junk as you expected. So I made a new file in the editor and saved it and all worked fine. I just did not understand the proper limitations of the "cat" command.
It takes considerable knowledge just to realize the extent of your own ignorance.....T Sowell

mediclaser
Level 4
Level 4
Posts: 369
Joined: Tue Mar 20, 2018 2:28 pm

Re: Terminal spits out gobblegook!

Post by mediclaser » Wed May 09, 2018 6:58 pm

Simply renaming the file extension from .odt to .txt does not change the formatting of the file. What you could do next time is to open the .odt file again in Libre Office and do a "Save As". Then select "Text (.txt)" as the new format.
If you're looking for a greener Linux pasture, you won't find any that is greener than Linux Mint. ;)

User avatar
Flemur
Level 17
Level 17
Posts: 7171
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Terminal spits out gobblegook!

Post by Flemur » Wed May 09, 2018 9:39 pm

silverpuma wrote:
Wed May 09, 2018 3:04 pm
I just did not understand the proper limitations of the "cat" command.
Try this on your ODT (namely your original format) file:

Code: Select all

strings filename.odt
strings file.pdf:

Code: Select all

%PDF-1.6
890 0 obj
<</Outlines 593 0 R/Metadata 887 0 R/AcroForm 891 0 R/Pages 871 0 R/OCProperties<</D<</RBGroups[]/OFF[]/Order[]            ...
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
         <pdf:Producer>Adobe Acrobat 8.1</pdf:Producer>
      </rdf:Description>
Although it looks like junk, there are no special characters like this, from cat file.pdf:

Code: Select all

 �0��^[ kb����!~H���a��a^��y^M�^Z^L�q<^A$F~C^W+z����~G~Y�^Y���^?).ܨ
~X^Y�~C�:ef̼"`�m�~N^Tu6�4j^@^Q~B�G^P�| ��|J^MP�~J^C]^M~V�~Ez^A�~^d~B~E�~D6!>^A~]�
FOr more info

Code: Select all

man strings 
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
PeterRJG
Level 1
Level 1
Posts: 35
Joined: Mon Dec 14, 2009 8:00 am

Re: Terminal spits out gobblegook!

Post by PeterRJG » Thu May 10, 2018 12:53 am

Isn't .odt a container format? I.e it's a zipped file containing the text and a few xml files on how to mark that text up? If so, no wonder the OP is getting gobbledegook looking at it.

User avatar
lsemmens
Level 8
Level 8
Posts: 2423
Joined: Wed Sep 10, 2014 9:07 pm
Location: Rural South Australia

Re: [SOLVED] Terminal spits out gobblegook! [SOLVED]

Post by lsemmens » Thu May 10, 2018 9:49 am

Everyone has had a go at explaining the reasons for the gobbledegook, so, I thought I might as well have a go, too. :D

Think of it this way. You have a car - if it rains, what do you do? You turn on the wipers, of course. How do you do that? Somewhere you will find a switch, All cars of the same make and model will have the same switch. Hop into a car from across the pond and you'll find that it has wipers, too, but, how to turn them on. Of course it will be another switch, but not necessarily the same switch in the same location, it may be a button whereas yours is a lever. You get the picture. A word processor is like a car, different wps are like different cars, they all have the same function, but the way they work is different. A Text Editor has a similar function to a word processor, but is more like the old horse and cart, very basic. All of that gobbledegook is just the word processor's way of remembering exactly what you typed and how you wanted to display it.The standard character set for any text file usually only contains a maximum of 256 characters , in reality, it is about 102 (the number of keys on your keyboard that produce an image on your screen). If we had to also have a special key for every variation of every letter, our keyboard would have to be huge. Think of each letter requiring a BoldFace, Italic, BoldItalic, sizes from 1pt up to 72pt or beyond Underlining, Overlining, other embelishments, different typefaces, and I haven't even mentioned the myriad of colours. Every wordprocessor in the past used their own unique method of storing that info which is why you have the various import and export filters in you word processor. PDF (Portable Document Format) was intended to circumvent this but it was still a proprietary format. The ODF (which is what Libre OFFICE, Apache Open Office et. al use) format is a standard that many word processors can use. Microsoft Word has been a defacto standard for many years, however, they cannot seem to settle on a standard format migrating through various .doc formats to .docx and .docm now.

The Open Document Format, at least retains some standard of compatibility.
Kernel: 4.15.0-46-generic x86_64 bits
Desktop: Cinnamon 3.8.9
Distro: Linux Mint 19 Tara

Laptop HP-ProBook-470-G2 8Gb RAM SSD
Server AMD Phenom 9650 - GEForce 9400GT 6Gb RAM
+ three other Mint machines
Out of my mind - please leave a message

rene
Level 12
Level 12
Posts: 4150
Joined: Sun Mar 27, 2016 6:58 pm

Re: [SOLVED] Terminal spits out gobblegook! [SOLVED]

Post by rene » Thu May 10, 2018 10:21 am

lsemmens wrote:
Thu May 10, 2018 9:49 am
Everyone has had a go at explaining the reasons for the gobbledegook, so, I thought I might as well have a go, too. :D
I hadn't yet! In which context...

Also please note that cat'ing something like an ODT into a terminal can in fact other than simply display the "gobblegook" which is said ODT when interpreted as cat'able bytes easily indeed upset your terminal by that stream of bytes containing by the terminal interpreted escape-sequences. Happens quite a bit. Blind-type reset and hit enter to cure that one.

silverpuma
Level 1
Level 1
Posts: 23
Joined: Fri Jul 26, 2013 4:23 pm

Re: [SOLVED] Terminal spits out gobblegook! [SOLVED]

Post by silverpuma » Fri May 11, 2018 6:59 pm

lsemmens wrote:
Thu May 10, 2018 9:49 am
Everyone has had a go at explaining the reasons for the gobbledegook, so, I thought I might as well have a go, too. :D

Think of it this way. You have a car - if it rains, what do you do? You turn on the wipers, of course. How do you do that? Somewhere you will find a switch, All cars of the same make and model will have the same switch. Hop into a car from across the pond and you'll find that it has wipers, too, but, how to turn them on. Of course it will be another switch, but not necessarily the same switch in the same location, it may be a button whereas yours is a lever. You get the picture. A word processor is like a car, different wps are like different cars, they all have the same function, but the way they work is different. A Text Editor has a similar function to a word processor, but is more like the old horse and cart, very basic. All of that gobbledegook is just the word processor's way of remembering exactly what you typed and how you wanted to display it.The standard character set for any text file usually only contains a maximum of 256 characters , in reality, it is about 102 (the number of keys on your keyboard that produce an image on your screen). If we had to also have a special key for every variation of every letter, our keyboard would have to be huge. Think of each letter requiring a BoldFace, Italic, BoldItalic, sizes from 1pt up to 72pt or beyond Underlining, Overlining, other embelishments, different typefaces, and I haven't even mentioned the myriad of colours. Every wordprocessor in the past used their own unique method of storing that info which is why you have the various import and export filters in you word processor. PDF (Portable Document Format) was intended to circumvent this but it was still a proprietary format. The ODF (which is what Libre OFFICE, Apache Open Office et. al use) format is a standard that many word processors can use. Microsoft Word has been a defacto standard for many years, however, they cannot seem to settle on a standard format migrating through various .doc formats to .docx and .docm now.

The Open Document Format, at least retains some standard of compatibility.
Thanks isemmens for the great explanation it's appreciated.
It takes considerable knowledge just to realize the extent of your own ignorance.....T Sowell

silverpuma
Level 1
Level 1
Posts: 23
Joined: Fri Jul 26, 2013 4:23 pm

Re: [SOLVED] Terminal spits out gobblegook! [SOLVED]

Post by silverpuma » Fri May 11, 2018 7:04 pm

Just to finish off folks, the help and time you all took to explain to me, what I realize is to you guys a very basic question has been wonderful. I'm slowly getting to grips with the command line and enjoying every minute of it. So again......Thank you
It takes considerable knowledge just to realize the extent of your own ignorance.....T Sowell

Post Reply

Return to “Newbie Questions”