3

I'm new to this and can't quite wrap my head around it. I want to run specific firefox profile which, so I just put this line in a text file: firefox -p Profile make it executable and run it. It works fine.

Now what advantages I gain if I make a .desktop file that has in the command line basically the same? Other than the option to set an icon and add it to the launcher? Are there any fundamental differences?

user240891
  • 739
  • 4
  • 10
  • 26

2 Answers2

9

For using by command-line:

  1. You can make executable file (let by command gedit myfp)as follows:

    #!/bin/bash
    [Your commands Here]
    
  2. Give it execution permission by chmod +x myfp and put this file in location: /usr/local/bin

  3. Now you can easily execute [Your commands Here] by running command mypf in Terminal.

For using by GUI (as a Launcher):

  1. You can create a desktop file (let by command gedit mypf.desktop) as follows:

    [Desktop Entry]
    Name=My Firefox
    Comment=My Profile
    Exec=[your command here]
    Type=Application
    Icon=[path/to/icon-file]
    

    where [Desktop Entry] remains constant and [your command here] is may be firefox -p or directly mypf if available. [path/to/icon-file] is path to icon file.

  2. Give it execution permission by chmod +x mypf.desktop and put in location /usr/share/applications.
  3. You can also create symbolic link to your desktop by ln -s /usr/share/applications/mypf.desktop ~/Desktop and launch from Desktop easily.

Additional Info: It can be run at startup by putting Desktop file in $HOME/.config/autostart.


Which method/way should you make? is depends upon How it will be executed and For what purpose?

Also visit following community helps:

Hope this helps you to create executable file for using by command-line script and/or desktop file for using by GUI as a launcher.

Pandya
  • 35,771
  • 44
  • 128
  • 188
0

Not quite

Open Gedit choose new, put your command in the document and click save as.

THIS IS IMPORTANT - make sure to save your file as a .sh file not a text file.

Once saved you can open a file browser right click the file and choose properties then the permissions tab and tick the make this file executable box.

The file you now have is called a shell script if you open with terminal all commands in the file will be executed.

The advantage of this is you can add as many different commands (the same ones you use in a terminal) and execute them all at once.

Here's a simple demo one to try copy the codeto a text doc and save as a .sh

firefox nautilus shotwell

It will simply open 3 programs but is a good example of how shell scripts work. Hope this helps

Mark Kirby
  • 18,529
  • 19
  • 78
  • 114