Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

Monday, 19 September 2016

5 commands you should NOT run.

If you do want to test them out you can check out this tutorial on installing vmware and run them inside a VM just for fun.

A list from this reddit post for people to post the most dangerous/annoying commands they can come up with.

The Classic Fork bomb:
Posted by cuba200611
This line crashes your system as it uses up all the resources. It works by creating a function which calls its self twice and has no way of terminating it's self. This quickly uses up all the resources and crashes your PC.

:(){ :|: & };:

Delete your whole hard drive:
This line deletes everything from the hard-drive when run as root.

rm -fr /

Break your CD drive:
This line constantly ejects your CD drive not allowing it to shut.
Posted by wee0x1b

while true; do eject; done

Overwrite you hard drive:
This line writes zeros to your hard drive
Posted by Celtore

dd if=/dev/zero of=/dev/sda

Chmod killer:
Posted by: therancor91
Explanation from gigolo_daniel:
For those wondering why this breaks your entire system giving you execution permission errors everywhere while prima facie it merely seems to add permissions, the primary reason is that it removes setuid and setgid bits on executables if you change permissions like that. These mode bits when an executable is ran run it under the permission of the owning user and owning group respectively, not the user who executes it. This is typically used with a lot of executables to allow a temporary elevation of privileges which is needed for a surprisingly large number of operations.

You can no longer normally become root after you done this because both sudo and su use the setuid bit to enable a login as root.

chmod 777 /

All of these commands show the true power of a one line command which could destroy your system, be careful when copying commands.

Saturday, 17 September 2016

Simulating your mouse

Sometimes you just want to automate tasks but the program only has a GUI. Simulating mouse clicks can make this job a lot easier and this is were xdotool comes in.

Installing xdotool:

Debian systems:

sudo apt-get install xdotool


sudo yum install xdotool

Arch linux:

sudo pacman -S xdotool

Simulating mouse movements and clicks

Left click

xdotool click 1

Right click

xdotool click 2

Mouse move

xdotool XXX YYY (XXX,YYY Being the coordinates)

A basic example where this can be used is a online dogeminer click game.

#Simple Auto clicker
while [ 1 ];do
  xdotool mousemove XXX YYY click 1
  sleep 5