How to find devices on a given network?



To find the devices on the given network, use nmap

On RHEL systems, 
$ sudo yum install nmap


On Unix Systems

$ sudo apt-get install nmap

$ nmap -sP IPaddress of your network

you can find IPaddress of your network by simply running ifconfig command and can find the pattern of IP address of your own netowork

So, my network has a pattern of 192.168.133....

$ nmap -sP 192.168.133.0/24


This will show you which hosts responded to ping requests on the network between 192.168.133.0 and 192.168.133.255.

Then, you can telnet into them for access.


Enjoy Linux..!!!








Update Local repository with server



Back

To synchronize all the changes done on the server with your local repository, use git PULL.

$ git pull origin BranchName
This will update the local files with the remote changes on the github server.


There is another way

$git reset --hard origin/BranchName



How to check the differences between two branches?

$ git diff branch_1 branch_2




How to update the server if the directory has been removed locally ?

1. git rm -r directory_name
2. git commit -m "directory_name removed"
3. git push origin branch_name




Compare same file under different branches 

git branch1 branch2 -- filename.js









Github - Branching




1. To create a new branch

$ git checkout -b branch_b1



2. To swtich back to master

$ git checkout master


3. To create a new branch from any other branch (other than master)

$ git checkout -b branch_b2 branch_b1



4. To list the available branches in your current repository

$ git branch -a


5. To delete the branch

$ git branch -d BranchName


6. To make the branch available to others through server repository

$ git push origin BranchName


7. How to sync local branch to the latest master on the server ?


We can do that, by the following steps

(Assume we are branch b1)
git fetch 
(This will reset the whole branch b1 to the server version)

git rebase origin/master(This will merge all the latest master into the branch b1)



Github



Git is really in use nowadays, and most of the companies are using it for smooth development and proper file synchronizations.

So, here is a small tutorial on using GITHUB from command line.


Create a account on github. And set your username and email on the terminal using the following git commands


  • git config --global user.name "your_name"
  • git config --global user.email "your_name@mail_domain.com"


1. Open a repository locally

$ git clone https://github.com/your_username/repository_name


Now, in Git work flow, your local repository consist of 3 stages.

a. Your Working Directory - This holds the actual files

b. Index - This is like a staging area.

c. Head - This points to the last commit you have made.


2. Suppose you create a new File, called modules.txt
So, to add this file to the server, you first have to add it to the index .

$ git add modules.txt

or 

$ git add *


3. But, to actually commit these changes

$ git commit -m "Some updating message"

This command basically moves your changes to one step ahead towards the HEAD.
But, still your changes are not yet saved to the server.


4. The process called PUSHING is responsible for saving to the server.

$ git push origin master

So, here,
origin = the local directory 
master = server repository. 

Master can be replaced by any other branch.

After this you will see something like 

Counting Objects...
Delta compression...
Writing Objects...
Total...
To https//.....


Summary

a) git Clone
b) git add
c) git commit
d) git push origin master







NVM - Node Version Manager



  • NVM stands for Node Version Manager.
  • It is really an awesome way to handle different versions of node and manipulate with them to work on different requirements.
  • So, to install it. 
  • Best Way is to install git 

(UBUNTU) 
  • apt-get install git 
  • Then, simply run
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`

  • To activate nvm, you need to source it from your shell:
$ . ~/.nvm/nvm.sh
  • Close the terminal and restart
  • So, now type 
$ nvm 
  • You will see a bunch of details about it.
  • Now, install for example, the 0.12 version of node

$ nvm install 0.12
$ nvm use 0.12



Thats all, 

Enjoy Linux..!!!
+CentOS +Ubuntu +Linux 







How to create a bootable USB device in Linux?

Thanks to Linux, it has made the creation of a bootable USB, ton of times easier than Windows.

So you just have to type the following command.

dd bs=4M if=file_name.iso of=/dev/sdb && sync


Ok, so the command looks easier, but most of the time people get stuck at of.

of means output file. Because, in output file, we cannot use the name of the file, instead we have to use the name, which the system has assigned to our USB or external HD.

So,  go to the terminal and type

df-h

There you will find a list of partitions and external medias connected to your machine.


That's all

Enjoy Linux..!!!
+CentOS +Ubuntu +Linux
  

Types of Rebooting



Cold Reboot

  • Also known as a hard reboot.
  • In this, the power to the system is physically turned off and back on again, causing an initial boot of the machine.


Warm Reboot

  • Also known as soft reboot.
  • In this the system restarts without the need to interrupt the power.






could not resolve error in github cloning...!!!!

Sometimes, we face the "could not resolve error" when we are trying to clone the github repository.

So, it happens when we have some kind of proxy set on our system.

So, either you can unset them and rerun the "git clone" command.


or

directly run this command based on the http type you are using to clone.

git config --global --unset http.proxy

or

git config --global --unset https.proxy
 





What's a proxy server?


In linux, you can check the proxy settings by using the command

$ env | grep proxy

or you can use the following commands

$echo $HTTPS_PROXY
$echo $HTTP_PROXY
$echo $http_proxy
$echo $https_proxy

If it doesn't show anything, then the proxy is not set.
Otherwise, you can unset them using the following commands.

$ unset  https_proxy
$ unset http_proxy







Text File Busy/Unexpected End of File Error in Bash

Sometimes, we get an error when we paste some bash code from windows environment to linux terminal. The error is like text file busy, or bash uninterrpreted error, Unexpected End of File etc. etc.

So, the poblem is, either the file is not writeable. 
So, chmod 777 filename

or 

the linux terminal is not able to read the input file.
So, run the dos2unix command
$ dos2unix filename.sh

And then run the bashscript
$ ./filename.sh

How to delete a directory even if it's not empty?

You might have seen, while using the "rmdir" command that you cannot delete this directory as it is not empty.

Use the following command :

> rm -r directoryName

or

> rm -rf directory_Name

so, "f" represents force. So, it will skip all the necessary checks and simply wipe out the whole directory.

Use SUDO, if you still cannot delete.



Enjoy Linux...!!!!
+CentOS
+Linux
+Ubuntu

How To in Linux

How to remove npm ?


  • Ok, so npm stands for Node Package Manager, and trust me, it's really an awesome thing. 
  • It is a package manager for various things, like angular, node (default), gulp, grunt, mobile, javascript and many more.
  • But, it is also important to know, how to uninstall npm from the system to get a fresh npm later.
  • So, here it goes
$ sudo npm uninstall npm -g
$ npm -v
  • To remove everything related to npm,
$ rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*


Simple..!!!


Enjoy Linux
+CentOS

    Delete dual boot options on windows

    Sometimes, we see multiple options of windows even if they are not running because of failed installation.
    So, to remove them,

    1. Goto run, and type msconfig:
    2. After msconfig is launched:
    3. Go to the Boot tab
    4. Slect the boot entry you want to delete.
    5. Click the Delete button and then click OK.

    Thats all.

    How to know if a package is there on your CentOS or not ?


    To find a exisiting package on your CentOS system, just type this command 


    # rpm -ql "package_name"

    For instance, to download the youtube videos, we need the youtube package - "youtube -dl" 

    rpm -ql youtube-dl

    So, you will see a list of files within that package, and that makes sure the presence of that package on your system. 




    If the package is not installed, the terminal will display 

    " package youtube-dl is not installed "



    That's all



    Live Linux...!!!
    +CentOS









    Windows Phone Best Youtube Client - TubeCast

    
    This is one of the best online HD Video streaming app on the windows phone platform.
    
    
    
    
    Tubecast is an incredible Youtube client and also displays your Youtube videos on the DLNA devices, Chromecast, Smart TV , Xbox & Xbox One... etc etc.
    
    
    
    
    
    
    Some Features :
    
    
    
    1 Download Youtube videos (Pause and Resume)
    
    
    2 Login to your Youtube account and use all the features 
    (subscribe, watch later, history etc.)
    
    3 Play the sound of the video under lock and also in background while switching apps.
    
    4 QHD(1440p) Full HD (1080p) SD (480p) 60fps
    
    
    
    
    
    
    
    
    
    
    For more details check out this link,
    http://www.windowsphone.com/en-us/store/app/tubecast/bee1728a-4c19-495e-86b2-ce13e4eaa6d4
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    COOKIES VS SESSIONS


    Some of my friends asked me to write on some basic differences between a Session and a cookie.
    Both are little bit confusing, but easy to understand.
    So, here they are



    COOKIES SESSIONS
    1. Cookies are small text files which are stored on our computer by web browsers1. Session are 32 bit variables which hold information about one user available to all pages of one application
    2. Cookies can store string data type2. Sessions can store any data type
    3. Cookies are stored at the client side3. Sessions are stored at the server side
    4. Cookies are not secured, as they are stored in text-format4. Sessions are secured, as they are stored in binary format
    5. Cookies can be disabled5. Sessions cannot be disabled
    6. Cookies give no burden to server6. Sessions give burden to server, as servers need to handle them
    7. Cookies are persistent and non-persistent7. Sessions are non-persistent, as its lifetime can be set manually.