====== How to launch the correct associated program for any file from the console ====== Let's say you have a .png file, a .txt file and an .mp3 file. If you are using Konqueror (or Nautilus under Gnome), just double click, the program you've chosen for this type of file will be launched : a picture viewer for the .png file, a text viewer for the .txt file, and a multimedia player for the .mp3 file. Now, you're using the console, and you don't want to bother wondering which program you want to launch if you want to view a file. You can't "execute" it either, because a .png file is just not executable (it's not a program nor a script !). What happens when you double-click a file in Konqueror/Nautilus is : "okay, what's the file type ? got it, I will launch the right program and ask it to view the file". There's a way to do that using the console, too.\\ Without it, if you want to listen to your .mp3 file, you can type: <code console> $ xmms intro.mp3 </code> But it implies you have to know each program name for each type file. Not very handy. Here comes the solution. Under KDE: <code console> $ kfmclient exec the_filename_goes_here </code> Under Gnome: <code console> $ gnome-open the_filename_goes_here </code> In both cases, the correct program will be launched to view the file, according to your KDE/Gnome preferences, yay ! If you use this command often, you can set a shorter alias in your .bashrc file ("kfmclient exec" is a bit long to type, and Linux is about efficiency, right ?), adding the following line to it: <code console> alias kx="kfmclient exec" alias gx="gnome-open" </code> ~~META:date created = 2006-08-28 11:56:00~~

 
blog/how_to_launch_the_correct_associated_program_for_any_file_from_the_console.txt · Last modified: 08/03/2010 13:25 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki