Linux Commands

When computer starts wifi starts automatically ?

root@cherry # nano /etc/crontab

SHELL=/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command

17 * * * * root cd / && run-parts --report /etc/cron.hourly

25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )

47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )

52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

* * * * * root ap-hotspot start -------------------> Add this line and save

 

How to connect one machine to another machine ?

chinna@chinna:~$ scp -r  /home/chinna/Desktop/techlearn.in.png  chethan@192.158.72.99:.
chethan@192.158.72.99:.'s password: 
techlearn.in.png                                        100%   14KB  14.1KB/s   00:00    
chinna@chinna:~$ 

-----------------------------------------------------------------------------------------------------------------------------------------------------

chinna@chinna:~$ ssh chethan@192.158.72.99

chethan@192.158.72.99:~/Desktop$ scp -r Chinna chinna@192.148.10.21:.

 

Chinna chinna@192.148.10.21's password:xxxxxxxxx
Selenium2plus.final_.pdf                                                                                                                                                         100%   52KB  52.0KB/s   00:00    
Files_downloaded_by_AirDroid (1).zip                                                                                                                                             100%  314     0.3KB/s   00:00    
     
chethan@192.158.72.99:~

 

 

How to setup a Wireless Hotspot (AP-HOTSPOT) in Linux ?

1st:
root@cherry:/# sudo su -
root@cherry:/# add-apt-repository ppa:nilarimogard/webupd8
root@cherry:/# aptitude update
root@cherry:/# aptitude install ap-hotspot
root@cherry:/# ap-hotspot configure
root@cherry:/# ap-hotspot start
root@cherry:/# ap-hotspot stop
root@cherry:/# ap-hotspot restart

2nd :

root@cherry:/# sudo su -
root@cherry:/# aptitude update
root@cherry:/# aptitude install ap-hotspot

root@cherry:/home/chinna# sudo apt-get install hostapd

root@cherry:/home/chinna# sudo apt-get install dnsmasq

Download Package files from this link : https://launchpad.net/~nilarimogard/+archive/ubuntu/webupd8/+sourcepub/3...
Download file : ap-hotspot_0.3.1-1~webupd8~0_all.deb (5.2 KiB)

root@cherry:/home/chinna# dpkg -i ap-hotspot_0.3.1-1~webupd8~0_all.deb

root@cherry:/home/chinna# sudo ap-hotspot configure
root@cherry:/home/chinna# sudo ap-hotspot start
root@cherry:/home/chinna# sudo ap-hotspot stop
root@cherry:/home/chinna# sudo ap-hotspot restart

 

How to install skype in linux ?

root@chinna:~# dpkg --add-architecture i386

root@chinna:~# apt-get update
click on below url link and download your machine architecture(ex: my system is Debian)
http://www.skype.com/en/download-skype/skype-for-computer/

You will go to skype download path in termianl mode (see below ex)
root@chinna:/home/chinna/Downloads# dpkg -i skype-debian_4.3.0.37-1_i386.deb

some time you will get error(then enter below command)
root@chinna:/home/chinna/Downloads# apt-get -f install

As the final command enter in terminal mode
root@chinna:/home/chinna/Downloads# dpkg -i skype-debian_4.3.0.37-1_i386.deb

How do I check if a package or sotware installed on my machine ?

check perticular package is installed or not in your machine 
root@chinna:/home/chinna# dpkg --get-selections | grep firefox
firefox                        install       ----------------> package installed

                                  if package was not installed in your machine

root@chinna:/home/chinna# dpkg --get-selections | grep php
root@chinna:/home/chinna#                           ------------------> you will get empty 

                                  Check all package installed list

root@chinna:~# dpkg --get-selections
adduser                                         install
alsa-base                                       install
alsa-utils                                        install
apache2                                         install

 

How to install Firefox browser on Debian /mint/ubuntu ?

  #nano /etc/apt/source.list ---->   add source list in below url :
  deb http://packages.linuxmint.com debian import
  //Ctrl+x and enter Y (save)

   Update your package list:
   #apt-get update ---> This command will fetch mint/debian package repository list. 
   As a last step install firefox browser:
   #apt-get install firefox

update,upgrade and dist upgrade in linux machines

root@chinna:~# nano /etc/apt/source.list
paste the below line in the source.list
deb http://ftp.uk.debian.org/debian wheezy main contrib non-free

to update the system
root@chinna:~# apt-get update
root@chinna:~# apt-get upgrade
root@chinna:~# apt-get dist-upgrade

Update Java version in Debian Linux

root@debian:/home/chinna# java -version
java version "1.6.0_31"
OpenJDK Runtime Environment (IcedTea6 1.13.3) (6b31-1.13.3-1~deb7u1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
root@debian:/home/chinna# apt-get install openjdk-7-jdk openjdk-7-jre

root@debian:/home/chinna# update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status

------------------------------------------------------------

* 0 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 auto mode

1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode

2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode

Press enter to keep the current choice[*], or type selection number: 2

root@debian:/home/chinna# java -version

java version "1.7.0_03"

OpenJDK Runtime Environment (IcedTea7 2.1.7) (7u3-2.1.7-1)

OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)