# Required FreeBSD shell commands



## Deather (Jul 29, 2020)

Hello I was wondering what FreeBSD commands do you need in order to boot and login etc, on a newly installed system. 
like I can get rid of sleep with: rm -rf /bin/sleep because I do not need to have sleep in order for FreeBSD to work. 
What are the needed command files, /bin  /usr/local/bin  etc... any exe


----------



## jb_fvwm2 (Jul 30, 2020)

The ones really not needed are eventually phased out in new versions, if you remove programs they might be used internally by FreeBSD in scripts and thus produce breakage
upon unwarranted removal.


----------



## Emrion (Jul 30, 2020)

I agreed with *jb_fvwm2*. What's the point to remove base user components? Security? Something else?


----------



## SirDice (Jul 30, 2020)

Deather said:


> Hello I was wondering what FreeBSD commands do you need in order to boot and login etc, on a newly installed system.
> like I can get rid of sleep with: rm -rf /bin/sleep because I do not need to have sleep in order for FreeBSD to work.
> What are the needed command files, /bin /usr/local/bin etc... any exe


Simple question, why? What are you trying to achieve by doing this?

If you're looking for a minimized installation (for embedded systems for example), read up on nanobsd(8) and picobsd(8).


----------



## usdmatt (Jul 30, 2020)

You might not use sleep, but for a start it appears 11 different rc.d scripts use it for various purposes.


----------



## Deather (Jul 30, 2020)

Security and I plan to rewrite all the stuff anyways. I'm basically rewriting FreeBSD without rewriting the source and compiling it for a private project. I only really need cli because I will make a ansi art interface Gui.


----------



## Deather (Jul 30, 2020)

Thank you I will check it out <3


----------



## ralphbsz (Jul 30, 2020)

Deather said:


> Security ...


So you are trying to modify FreeBSD to become more secure. In order for your quest to be taken seriously, you should probably tell us what you mean by "security", and what your experience and skill level is. For example, one particular aspect of security is physical security. So let me ask you: Are the bars of the cage that contains your FreeBSD system properly welded? What size bolts did you use to secure the cage to the concrete floor? Please show us the schedule and drawing for the steel bars in the concrete. Are you sure the structural engineer is qualified for the calculations that are involved there? What caliber ammo do the guards carry? Do you have sufficient magazines for rapid reloading, in case of a coordinated attack? And this is really not a joke, I have worked with server sites where every sys admin carries an assault rifle on their back, just in case of a security problem. If you care, they are caliber 5.56 with 35-round magazines, extra mag or two on the belt.

OK, obviously my line of questioning is a joke. Most individual computer owners (amateurs) do not worry about concrete and ammunition when considering computer security. In another thread, you say you are into penetration testing. Well, what is to be penetrated? What penetrating organization are you simulating? What is the value of the system and its data about to be penetrated? What incentive might potential attackers have? Is this about securing one personal credit card number with a $200 limit against credit card fraud, or does your service have military intelligence data that's relevant to a well-equipped nation-state actor? Did you piss off the Russians, Israelis, Chinese, or Trump? If yes, I can recommend a really good facial surgeon, which is probably more needed than computer security consultants.

And you are starting with the proposal to just delete /bin/sleep. Which is pretty ludicrous: That executable is nearly perfectly safe, because (a) it has very little functionality (not even any options), (b) it can't do very much other than cause denial-of-service by delaying things, (c) it is necessary for correct system operation, as others have already said. If you know anything about how Unix systems work, you should have known this.

You also don't seem to know the difference between /bin and /usr/local/bin. That's sort of a fundamental thing about how FreeBSD (in contrast to Linux and some commercial Unixes) organizes its directory structure. There is lots of good documentation to explain what files live where (start with man hier, and the corresponding handbook chapter), And in particular, FreeBSD uses /usr/local in a somewhat unusual fashion for packages and ports (unusual compared to Linux, which today is a large fraction of mindshare).



> and I plan to rewrite all the stuff anyways.


You are planning to rewrite utilities such as sleep? What makes you think that you are better at that than the people who wrote them originally? In particular given that BSD has a 40-year history and tradition, most of the developers are highly experienced, usually quite security conscious? And if you want to start rewriting everything that's at the level of "sleep" (and ls, and cat, and csh, and awk, and sed, and ...), you have quite a big task ahead of you. And you have demonstrated lack of knowledge of even basics!



> ... because I will make a ansi art interface Gui.


A GUI for a secure system that's based on line drawing characters and ncurses?

How many people here remember HP-UX's "sam" and AIX's "smit"? You might want to try those out to see how to do it "right", for suitably small values of "right". Everytime I'm forced to run raspi-config, I get remind how bad the "good old times" were.

Summary: I suggest that you start by learning some basics about the OS, and then explain to us what you want to accomplish, and what the goals and resources are.


----------



## PMc (Jul 31, 2020)

This is actually already very well designed in FreeBSD:
/bin contains the commands you really need in single-user
/usr/bin contains the commands you really need in multi-user
/usr/local/bin contains everything else

It is actually a very old scheme that comes from the time when there was a small+fast disk for /bin and a larger but slower one for /usr/bin - which was no longer the case in 1990 already, so the linuxian schemes didn't mantain it all to well. But I consider it a beautiful separation of duties, and it's one of the things I love FreeBSD for.


----------



## Deather (Jul 31, 2020)

Love at first sight


----------

