FreeBSD Excuteble program

Hi beloved community,
I am new with FreeBSD, and i wonder if Microsoft Windows uses .exe, and Debian linux uses .deb, most linux uses .sh.
Which package .Name does FreeBSD uses? and if you write a desktop software / application for freebsd how does that Excute file look like for example? when i was reading .txz was mentioned.
is this true?
My most important question is: if i make my own operating system based on FreeBSD like MacOS, and decide to sell it or give it away, will i face lawsuit by the BSD foundation and other that is involved!
Thank you guys for a awesome support
 
I am new with FreeBSD, and i wonder if Microsoft Windows uses .exe, and Debian linux uses .deb, most linux uses .sh.
You're mixing up various different things here. A Windows .exe is an executable file. For Windows this is typically stored in the PE format. This is a program containing CPU instructions that are run. A Debian .deb is a package format. It's a way to store a collection of files you can conveniently install or remove from the system. A "Linux" .sh file is usually a shell script, with regards to Linux it's typically bash(1)

Which package .Name does FreeBSD uses?
If you're asking what package format FreeBSD uses; pkg(8). These have a .pkg extension.

and if you write a desktop software / application for freebsd how does that Excute file look like for example?
Depends on what you're using. You can write an 'executable' in an interpreted language like Python, Perl or as a sh(1) script. Those are 'human readable' files. You can just open them in a text editor and read/modify the code directly. There are also compiled languages like C/C++. You need a compiler to convert your source code into machine (CPU) instructions. Those files are stored in a format called ELF.

when i was reading .txz was mentioned.
That's usually a compressed tarball. The FreeBSD pkg(8) format is in essence just a compressed tarball too.

if i make my own operating system based on FreeBSD like MacOS, and decide to sell it or give it away, will i face lawsuit by the BSD foundation and other that is involved!
As long as you used the BSD licensed parts correctly, no. You could run into hot water with Apple though. If you rip off their IP, trademarks and/or patents.
 
You're mixing up various different things here. A Windows .exe is an executable file. For Windows this is typically stored in the PE format. This is a program containing CPU instructions that are run. A Debian .deb is a package format. It's a way to store a collection of files you can conveniently install or remove from the system. A "Linux" .sh file is usually a shell script, with regards to Linux it's typically bash(1)


If you're asking what package format FreeBSD uses; pkg(8). These have a .pkg extension.


Depends on what you're using. You can write an 'executable' in an interpreted language like Python, Perl or as a sh(1) script. Those are 'human readable' files. You can just open them in a text editor and read/modify the code directly. There are also compiled languages like C/C++. You need a compiler to convert your source code into machine (CPU) instructions. Those files are stored in a format called ELF.


That's usually a compressed tarball. The FreeBSD pkg(8) format is in essence just a compressed tarball too.


As long as you used the BSD licensed parts correctly, no. You could run into hot water with Apple though. If you rip off their IP, trademarks and/or patents.
Thank you for your lesson! it was very educational!
I never liked apple anyway, so i would never touch thier garbage to give them a reason to take me to court!
 
The closest analog in Windows for a shell script is a batch file. They typically have a .bat extension. File extensions are not as important in Unix and its work-alikes as they are in Windows. They're usually just a convention. The actual type of the file is determined by its contents as gpw928 describes.
 
7 years in and I am still learning the special sauce.
I should have known it is called magic.
I know that Xorg used MIME but I had no idea command line does too.
 
Guys is there any FreeBSD with KDE desktop enviroment ISO i can download? like a ready to go USB image?
Any of you might know of?
 
Guys is there any FreeBSD with KDE desktop enviroment ISO i can download?
No. FreeBSD base doesn't include anything GUI. But you can just install the packages for xorg and kde5, that's no rocket science either. Best start with reading the handbook.

There are systems based on FreeBSD that install with some desktop included and preconfigured like e.g. GhostBSD.
 
Guys is there any FreeBSD with KDE desktop enviroment ISO i can download? like a ready to go USB image?
Any of you might know of?
Not really. Many have tried and the vast majority have fallen by the wayside.
Have a look at List of BSD operating systems on Wikipedia. There's one or two still going but they forked many major versions back so may not be FreeBSD any more. I've not looked at any other than OPNSense recently, and that's a firewall "appliance", not a desktop ready OS.
 
Execution of certain program is derived from file extension at first. Then the program looks for its requirement and then run. If you not yet started FreeBSD, which is the OS (base), and are looking for some help on how to install FreeBSD refer to the handbook's section Installing FreeBSD 13.X . Reading the whole Getting Started section in the handbook is a MUST and I will assume that you have read it. Follow the how to ( another ) and by downloading '-memstick.img'. If you come up step by step with one objective and its problem at a time, helping you will be easy.
 
Execution of certain program is derived from file extension at first.
Not on a *nix system. Of course you should use extensions, but they're only informative. *nix filesystems have an "executable" bit in the file permissions, that's how the system knows whether something is executable, see chmod(1).

Then, there are two possibilities.

Either the executable file is a binary program in a format understood by the system, nowadays typically ELF on *nix systems. Then the kernel launches the program interpreter (ld-elf.so(1) on FreeBSD) and feeds the program to it to do all necessary initialization (like dynamic linking) and then jump to the program's entry point. By convention, binary programs don't have any filename extension.

Or the executable file starts with the magic #! (a "shebang"). Then, whatever is named in the shebang is executed instead and the executable file is passed as a commandline argument.

edit: Windows works very differently, here are the differences in a nutshell:
  • Whether something is executable is indeed determined by the filename extension, for binary programs, that's .exe.
  • Binary programs aren't in ELF format but in PE ("portable executable") format.
  • There are no shebangs, instead you can register programs that handle filename extensions, e.g. cmd.exe for .bat, powershell for .ps1, etc.
 
Then the kernel launches the program interpreter (ld-elf.so(1) on FreeBSD) and feeds the program to it to do all necessary initialization (like dynamic linking) and then jump to the program's entry point.
Partially true and only for dynamic executables but not true for static ELF binaries. Partially because in either case kernel does limited sanitation on ELF header and if there's a problem doesn't execute the binary. Sidenote: There's an art of creating as small ELF binary as possible that kernel still executes (and breaks ELF standard altogether).

In case of dynamic binaries ld does further sanitation but from kernel perspective that's already program executing.
Easy to test: copy /bin/ls to your directory, modify first byte: dd if=/dev/zero of=./ls bs=1 count=1 conv=notrunc and try to execute.
 
Execution of certain program is derived from file extension at first.
False. The first two bytes of the file are examined. If they are !# it is considered a file of data for an interpreter. If not, the beginning of the file is examined to extract a magic number that should correspond to an executable image file. See execve(2).
 
  • Like
Reactions: mer
In post #2 SirDice explained in details. Still I tried to input some suggestions for hands on experience. Windows and *nix are different world. That is why you are considered as Gurus. But OP need to jump first from windows or Debian (KDE) to FreeBSD. Probably describing intricacy of *nix file system, for which it is famous, will be too much even for Phishfry;)
 
Back
Top