Solution for “Error interpreting JPEG image file (Not a JPEG file: starts with 0x89 0x50)”

Standard

I recently faced a problem opening some JPG images that I have downloaded somewhere over the internet, probably Twitter. So I though I’d share the problem and the simple solution.

When I tried opening an image I got the following error

Error interpreting JPEG image file (Not a JPEG file: starts with 0x89 0x50)

As the error states I was trying to open an image with a JPEG extension but which was not actually a JPEG image. To further verify this and know the actually format I ran this command in the terminal:

file file_name.jpg

which will give you something like this:

PNG image data, 346 x 480, 8-bit/color RGB, non-interlaced

The solution was to imply replace .jpg or .jpeg with the appropriate format, .png in this case.

References

I can’t open .jpg files, what to do?, Ask Ubuntu
Why am I getting the error: “Not a JPEG file: starts with 0x89 0x50”, StackOverflow

Linux tip: find your bash command in less than 3 seconds

Standard

Many Linux users usually need to repeat the same command over and over again. For the newbie she will often re-write the whole command. The average use might already know that there’s something called a bash history and so she would use the up and down arrows to navigate through the history. It will take a while to find the needed command.

The more advanced user would know the trick I am about to tell you to find the appropriate command in less than 3 seconds.
Continue reading

Useful Unix/Linux commands

Standard
$ indicates terminal command
# indicates a comment
Bold indicates “not installed by default”
$ lsusb     #list USB devices
$ lspci     #list all PCI devi
$ startx    #initialize an X session
$ more      #filter for paging through text one screenful at a time. (less gives more advanced).
$ less      #opposite of more; allows backward movement in the file as well as forward movement.
$ stty      #change and print terminal line settings
  $ stty size # prints terminal size

File commands

$ locate            #find files by name (for newbies I suggest the gui catfish -requires installation)
$ find              #search for files in a directory hierarchy
$ ls                #list directory contents
$ cd                #change directory
$ pwd               #print name of current/working directory
$ cp                #copy files and directories
$ rm                #remove files or directories
$ rmdir             #remove empty directories
$ file foo.format   #extracts info about file and what software it was written with; helpful in the case of having forgot which software was used to produce such a file

System info

$ uname
$ df                         #report file system disk space usage
                             #e.g; df or df /home
$ man                        #interface to the on-line reference manuals
$ free                       #Display amount of free and used memory in the system
                             #e.g; free -mt (m for MB & t for totals line)
$ uptime                     #tell how long the system has been running.
$ finger                     #user information lookup program
$ w                          #show who is logged on and what they are doing.
$ whoami                     #print effective userid
$ cat /proc/meminfo          #memory info
$ cat /proc/cpuinfo          #cpu info
$ lsb_release -a             #print (a: all ) distribution-specific information
$ last -x | grep shutdown    #show listing of last 10 logged in users; you can pipe this to the tail to read the last n instances.
                             #e.g; for 10 instances: last -x | grep shutdown | tail -n 10
$ last -x | grep reboot      #show listing of last logged in users
$ sudo shutdown -P hh:mm     #shutdown & poweroff (-P) @ hh:mm

Processes

$ uname
$ ps               #report a snapshot of the current processes.
$ top              #display Linux tasks
$ htop             #interactive process viewer based on top
$ watch            #execute a program periodically, showing output fullscreen
                   #e.g; watch -n 5 free -m
$ powertop         #program to analyze power consumption on Intel-based laptops
$ kill pid         #send a signal to a process
$ killall proc     #kill processes by name
$ pidof program    #find the process ID of a running program

Some useful terminal shortcuts

Ctrl+C #halt the current command
Ctrl+Z #pause command
$ fg #resume paused command in foreground bg resume paused command in background
Ctrl+D #logout of current session (similar to exit)
Ctrl+W #erase last word before cursor
Ctrl+U #erases the whole line
Ctrl+R #type to bring up a recent command
I hope this list turns out to be useful to you 🙂

Thanks for reading

last update: 2014-11-03

Compiling Muesli Fortran

Standard

Here is the code you need to compile and install the free numerical and graphical MUESLI library, developed by Édouard Canot [1].

sudo apt-get install 'libatlas-dev liblapack-dev zlib1g-dev libreadline6-dev imagemagick  
libx11-dev libpng12-dev g++ gfortran' #installing dependencies
 Note: for Ubuntu 10.04 replace “libatlas-dev” by “libatlas-headers”)
tar xvfj muesli-linux-all-2.6.3_2012-05-03.tar.bz2 #untar

cd muesli-linux-all-2.6.3_2012-05-03/GNU_GFC
./configure --f90=gfortran --blas=/usr/lib/ --lapack=/usr/lib/lapack/ #configuring

make -s distclean #clean your distribution from previous installation
make -s (or for detailed output: make MODE=verbose) #compiling; this will take some time

cd tests #testing
make #make the test files
./run_all #run all the made test files

cd ..
make install #installing

cd tests/fgl #testing fgl
make #make the test files
./run_all #run all the made test files


And here’s a video on how to do that [1]:

For further help, please contact MUESLI’s author from the respective homepage [2].

==========================
[1] http://playterm.org/r/compiling-muesli-fortran-on-ubuntu-1336936852
[2] MUESLI library homepage: http://people.irisa.fr/Edouard.Canot/muesli/