Monday, August 19, 2013

How to change the command prompt 'host & user color

[ To change the color of  'hostname' in command prompt ]

You can change the color of your shell prompt. To make your own life quite easy while working at the command prompt. Your current prompt setting is stored in a shell variable called PS1. There are other variables too, like PS2, PS3 and PS4.


Bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters.


* Task: Display current BASH prompt (PS1)

# $ echo $PS1

Sample outputs:

[\\u@\h \\W]\\$

    or

 \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
  By default the command prompt is set to [\u@\h \W]\$. The backslash-escaped special characters are decoded as follows:

    \u: Display the current username .
    \h: Display the hostname
    \W: Print the base of current working directory.
    \$: Display # (indicates root user) if the effective UID is 0, otherwise display a $.

* Task: Add colors to the prompt.

To add colors to the shell prompt use the following export command syntax: '\e[x;ym $PS1 \e[m'
Where,

    \e[ : Start color scheme.
    x;y : Color pair to use (x;y)
    $PS1 : Your shell prompt variable.
    \e[m : Stop color scheme.

* To set a red color prompt, type the following command

$ export PS1="\e[0;31m[\u@\h \W]\$ \e[m "
A list of color codes
Color Code
Black-0;30
Blue-0;34
Green-0;32
Cyan-0;36
Red-0;31
Purple-0;35
Brown-0;33
Blue-0;34
Green-0;32
Cyan-0;36
Red-0;31
Purple-0;35
Brown-0;33

Note: You need to replace digit 0 with 1 to get light color version.

*Task: How do I make the prompt setting permanent?

 Your new shell prompt setting set by $PS1 is temporary i.e. when you logout setting will be lost. To have it set every time you login to your workstation add above export command to your $HOME/.bash_profile file or $HOME/.bashrc file.

$ cd
$ vim .bash_profile


        or 

$ vim $HOME/.bashrc    

add this line in the end of the this file.

export PS1="\e[0;31m[\u@\h \W]\$ \e[m"

(save and quit from the file )

This will permanent color change

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

For RHEL/Centos

 go to the file

#vim  .bashrc

 and edit in end of the page this line:-

export PS1="\e[0;34m[\u\[\033[0;36m\]@\[\033[0;31m\]\h\[\033[0;33m\] \w]# \e[m"

 [ and save and quit the file ]

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

For Ubuntu

*************
  go to the file

$vim  .bashrc

#force_color_prompt=yes           [ remove the '#' singh from the line ]

use this line :-

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[0;32m\]\u\[\033[0;34m\]@\[\033[0;36m\]\h\[\033[0;31m\]:\[\033[0;33m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$

[ after this save and quit the file ]

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

Sunday, August 18, 2013

LINUX-NETWORKING-COMMAND

**********************************************************************************************************************************************************************
                            NETWORKING-INFO-COMMANDS
                        ****************************************
                       
#arp-scan  --interface=eth0/1  192.168.3.0/24   [ To scan all the ip and MAC in LAN ]

#arp-scan  --interface=eth0/1   192.168.3.0/24   |grep   IP/MAC/Any word 

$nmap -v -sP  192.168.1.0/24                  [ Scan your server for open ports and up hosts ]

$sudo /sbin/mii-tool                                 [ to find the connectivity of network link is ok or not ]

$nm-tool                                                  [ Network Manager tool to find the details of the network ]

$findsmb                                                  [ find the running samba-server in the LAN from client]

$findsmb -r                                              [ from the root ]

$wget  -p                                                 [ download the any thing from the command mode ]

$netstat -ant                                            [ all establish network on our system and server ]

$netstat  -an |grep  nfs                            [ to find out the connection established with 'nfs' ]

$netstat  -nte                                           [  ]

$netstat  -ant     |grep  23

#ss  -a                                                     [ another utility to investigate sockets ]

#ss  -l

#ss -o

#ss -s

#ss -4  state  all 

#system-config-network-cmd                 [ all about network ]

#ntsysv                                                   [ to edit and show all runing services ]

#setup                                                    [ " ]

$ls  /etc/sysconfig/networking/devices  [ to check the lan card ]

#tcpdump  -i  eth0  'udp' port  53          [   ]

#strace                                                  [ trace system calls and signals]

#ciptool   -h                                           [ Blue-tooth Common ISDN Access Profile (CIP)]

#ciptool  search                                    [ search the Blue-tooth devices ]

#ciptool   show                                     [ show the devices ]

#ciptool   connect                                 [ connect the blue-tooth devices ]

#ciptool   release

#ip  link

#ip  route

#ethtool   eth0/1

#route

#route -n

#route -e

#mtr                                                       [ a network diagnostic tool ]

#       
**********************************************************************************************************************************************************************
Q. When i try to ssh our server its syas error : "RSA host key has been change for (your system ip) and Host key verification failed .


Ans. : - Add correct host key in known_hosts, multiple ssh host keys per host-name.

        1. Get the rsa key of your server.

        #ssh-keyscan  -t  rsa  serve_ip

        (you will get sum key like 'AAAAB3.......' then you copy this key from server_ip till last )


        2. And on the client add this key to  " ~/.ssh/known_hosts "

        #server_ip  ssh_rsa AAABnX.....   ( past here the coyed key and enter )
       
        (Now you can access your server from 'ssh' it will not ask you the key )



$rpm -qa \*-release\*                                [ all new release package from red-hat ]

$cat /etc/redhat-release                           [ os release ]

$ rpm -qa yum\* rpm-\* python | sort      [ all the packages of yum server ]

$ls /etc/yum.repos.d

$cat /etc/yum.conf                                    [ To find the all configuration of the yum server ]

$yum repolist all                                       [ all the repos list  ]

$rpm -qa kernel\* | sort

$ ip    link                                                  [ to check link of the ip ]

$ man  ip                                                   [  to find more option of  IP link ]  

#mtr                                                          [ a network diagnostic tool ]

#mtr -i  IP address                                  [to find about any particular ip's status]

# man mtr

#route -n                                                   [ to find the route getway ip ]

#man  route                                              [ all about 'route' ]

#netstat   -ant

#netstat    -ant  |grep  23

#
  
--------------------------------------------------------------------------------------------------------------------------------

Saturday, July 27, 2013

LINUX-EXTRA-USEFULL-COMMAND

***********************************************************************                                            SYSTEM-INFO-COMMAND
                    ***********************************

*How to play a songs through command mode 

#yum install   cmus

#cmus 

- press no. '5' to select the songs dir. 
- press '+' to increase the volume .
- press '-' to decrease the volume. 
- press 'right arrow' to forward the song. 
- press 'left arrow' to rebind the song. 
& more option to play "cmus" command 

How to run Google Chrome as root.
Right click on the launch icon and select properties.  Append the following to the command in the 
#launcher --user-data-dir

This is what it will look like

/opt/google/chrome/google-chrome %U

just change it to be

/opt/google/chrome/google-chrome --user-data-dir %U

If you can’t find the launcher then you have to add it to panel or to your desktop. Select Applications-->Internet-->Google Chrome, right click on it and select Add this launcher to panel or Add this launcher to Desktop. Once you find the launcher icons, follow the steps above to run Chrome as a root user.
--------------------------------------------------------------------------------------------------------------------------
1. #cat    sl-60-x86_64-2011-live-DVD.iso   >>    /dev/sdb1  or /dev/cdrw   
 (To make a live booting  USB/CD/DVD from linux command mode )

2. #partprobe   /dev/sdb1   [so kernal can read this pendrive as bootable device] 
----------------------------------------------------------------------------------------------------------------------------- 

 Keyboard Shortcuts
*******************
Enter                    – Run the command
Up Arrow                 – Show the previous command
Ctrl + R                 – Allows you to type a part of the command you're looking for and finds it
Ctrl + Z                 – Stops the current command, resume with fg in the foreground or bg in the background
Ctrl + C                 – Halts the current command, cancel the current operation and/or start with a fresh new line
Ctrl + L                 – Clear the screen
command | less                 – Allows the scrolling of the bash command window using Shift + Up Arrow and Shift + Down Arrow
!!                     – Repeats the last command
command  !$                 – Repeats the last argument of the previous command
Esc + . (a period)             – Insert the last argument of the previous command on the fly, which enables you to edit it                           before executing the command
Ctrl + A                 – Return to the start of the command you're typing
Ctrl + E                 – Go to the end of the command you're typing
Ctrl + U                 – Cut everything before the cursor to a special clipboard, erases the whole line
Ctrl + K                – Cut everything after the cursor to a special clipboard
Ctrl + Y                 – Paste from the special clipboard that Ctrl + U and Ctrl + K save their data to
Ctrl + T                 – Swap the two characters before the cursor (you can actually use this to transport a                           character from the left to the right, try it!)
Ctrl + W                 – Delete the word / argument left of the cursor in the current line
Ctrl + D                 – Log out of current session, similar to exit
----------------------------------------------------------------------------------------

Learn the Commands
********************
apropos  subject            – List manual pages for subject
man  -k  keyword            – Display man pages containing keyword
man  command                    – Show the manual for command
man -t man | ps2pdf - > man.pdf      – Make a pdf of a manual page
which command                 – Show full path name of command
time command                 – See how long a command takes
whereis app                 – Show possible locations of app
which app                 – Show which app will be run by default; it shows the full path
--------------------------------------------------------------------------------------------------------
Searching
************
grep pattern files             – Search for pattern in files
grep -r pattern dir             – Search recursively for pattern in dir
command | grep pattern             – Search for pattern in the output of command
locate file                 – Find all instances of file
find / -name filename             – Starting with the root directory, look for the file called filename
find / -name ”*filename*”         – Starting with the root directory, look for the file containing the string filename
locate filename             – Find a file called filename using the locate command; this assumes you have already used the                           command updatedb (see next)
updatedb                 – Create or update the database of files on all file systems attached to the Linux root                       directory
which filename                 – Show the subdirectory containing the executable file  called filename
grep TextStringToFind /dir         – Starting with the directory called dir, look for and list all files containing TextStringToFind
---------------------------------------------------------------------------------------------------------
File Commands
***************
ls                     – Directory listing
ls -l                     – List files in current directory using long format
ls -laC                 – List all files in current directory in long format and display in columns
ls -F                     – List files in current directory and indicate the file type
ls -al                     – Formatted listing with hidden files
cd dir – Change directory to dir
cd – Change to home
mkdir dir – Create a directory dir
pwd – Show current directory
rm name – Remove a file or directory called name
rm -r dir – Delete directory dir
rm -f file – Force remove file
rm -rf dir – Force remove an entire directory dir and all it’s included files and subdirectories (use with extreme caution)
cp file1 file2                 – Copy file1 to file2
cp -r dir1 dir2             – Copy dir1 to dir2; create dir2 if it doesn't exist
cp file /home/dirname             – Copy the file called filename to the /home/dirname directory
mv file /home/dirname             – Move the file called filename to the /home/dirname directory
mv file1 file2                 – Rename or move file1 to file2; if file2 is an existing directory, moves file1 into directory file2
ln -s file link             – Create symbolic link link to file
touch file                 – Create or update file
cat > file – Places standard input into file
cat file                 – Display the file called file
more file                 – Display the file called file one page at a time, proceed to next page using the spacebar
head file                 – Output the first 10 lines of file
head -20 file                 – Display the first 20 lines of the file called file
tail file                 – Output the last 10 lines of file
tail -20 file                 – Display the last 20 lines of the file called file
tail -f file                 – Output the contents of file as it grows, starting with the last 10 lines
----------------------------------------------------------------------------------------------------------
Compression
**************
tar cf file.tar files             – Create a tar named file.tar containing files
tar xf file.tar             – Extract the files from file.tar
tar czf file.tar.gz files         – Create a tar with Gzip compression
tar xzf file.tar.gz             – Extract a tar using Gzip
tar cjf file.tar.bz2             – Create a tar with Bzip2 compression
tar xjf file.tar.bz2             – Extract a tar using Bzip2
gzip file                 – Compresses file and renames it to file.gz
gzip -d file.gz             – Decompresses file.gz back to file
-------------------------------------------------------------------------------------------
Printing
*************
/etc/rc.d/init.d/lpd start         – Start the print daemon
/etc/rc.d/init.d/lpd stop         – Stop the print daemon
/etc/rc.d/init.d/lpd status         – Display status of the print daemon
lpq                     – Display jobs in print queue
lprm                     – Remove jobs from queue
lpr                     – Print a file
lpc                     – Printer control tool
man subject | lpr             – Print the manual page called subject as plain text
man -t subject | lpr             – Print the manual page called subject as Postscript output
printtool                 – Start X printer setup interface
-----------------------------------------------------------------------------------------
Stopping & Starting
**********************
shutdown -h now         – Shutdown the system now and do not reboot
halt                 – Stop all processes - same as above
shutdown -r 5             – Shutdown the system in 5 minutes and reboot
shutdown -r now         – Shutdown the system now and reboot
reboot                 – Stop all processes and then reboot - same as above
startx                 – Start the X system
-----------------------------------------------------------------------------------------
ssh -p port user@host             – Connect to host on port port as user
ssh-copy-id user@host             – Add your key to host for user to enable a keyed or passwordless login
------------------------------------------------------------------------------------------
bg                 – Lists stopped or background jobs; resume a stopped job in the background
fg                 – Brings the most recent job to foreground
fg n                 – Brings job n to the foreground
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
*Note :- Mostly commands work under the these 'dir' - /bin
                              /bin/bash
                              /usr/bin
                              /sbin
                              /usr/sbin
                              /etc       
* on sudo this work like this - #sudo  /sbin/ifconfig


$locat   command name                       [ to find the location of the command like - /sbin/init , /sbin/adduser ]

$whereis command name                    [ to fined the location of the command and find  any file and dir from the system ]

$xclock                                                 [ to show gnome clock ]

$oclock                                                 [  " ]

$du -h                                                    [ find the used disk in GB ]

$df -h                                                     [ find the free space in hard disk ]

$du  -sh  name of file/dir                       [ to find the particular file/dir used space ]

$ls -m                                                    [ to find vertical width with sepretcomma,]

$ls -m -u                                                [ list info about mostly used file/dir ]                     
                                   
$umask -s                                              [ default permission of file/dir ]

$chage  -l user-name                            [ show account ageing info ]

$lsof                                                      [ list of open file  ]    

$rpcinfo                                                [ report RPC information ]

#iptables  -L -n -v                                 [ display the status of your firewall ]

$env                                                      [ display the environment of your system ]

$dmidecode                                          [ all about the BIOS]

$biosdecode                                          [ all about the BIOS ]

$chkconfig   --list  |less                         [ find the all running services ]

# mpstat 2 5                                         [ Report processors related statistics & to find out all the processing is runnig ]

$ps -avx                                                 [ runing process ]

$uptime                                                 [ find the total hour of system is up ]

$pwd                                                     [ to find out the location of the present currsor ]

$last                                                      [ show listing of last logged in users ]

$lastb                                                    [ show listing of last bad password used by other user ]

$lastlog                                                 [ reports the most recent login of all users or of a given user ]

$lastcomm                                            [ print out information about previously executed commands ]

$last  -d                                                 [ For non-local logins, Linux stores not only the host nameof the remote host but its IP number as well. This option
translates the IP number back into a hostname.]

$last   -a                                                [ Display the host-name in the last column. Useful in combination with the next flag.]

$last   -F                                                [ Print full login and logout times and dates.]

$last   -o                                                [ Read an old-type wtmp file (written by linux-libc5 appli-cations)    

$last   -w                                               [ Display full user and domain names in the output.]

$last   -x                                                [ Display  the  system  shutdown  entries  and  run   level ]

$arch                                                     [ to find out bit size of os ]

$uname -rmi                                          [  "]

$cat /etc/redhat-release                        [ to find out about OS ]

$ksnapshot                                            [ to take a snapshot ]

$lspci                                                     [ list of all PCI devices ]

$lspci  |grep  ethernet                           [ to find out the Ethernet devices ]

$ls -lZ                                                     [ to find out the SElinux context ]

#getenforce                                           [ show the selinux status ]

#setenforce   0                                      [ off selinux]

#serenforce   1                                      [ on the selinux]

#vim  /etc/sysconfig/selinux                   [ to change selinux value from the vim editor mode ]

#vim  /etc/selinux/conf

#getsebool  -a                                         [ get SELinux boolean value(s) ]

#getsebool  -a  |grep  samba

#setsebool                                              [ set SELinux boolean value  ]

#setsebool   -p     on    

#setsebool   -p     of                                [ we can also use 0 and 1 on the place of  'off' and 'on' ]

#vim  /etc/hosts.allow                            [ Make entry the name of host that should be allow to access and use our server     ]

ex. -  vsftpd: 192.168.1.0/24

    EXCEPT 192.168.1.2

    OR

    vsftpd : ALL  EXCEPT 192.168.1.2
   
    :wq  [ save the file ]


#vim  /etc/hosts.deny                              [ deny the users that should not use the service  ]

Ex. - sshd: all except 192.168.1.0/24  except  172.16.0.0/24

    :wq [ save the file ]


#set  |less                                                [ show all information of user ]

$press 'ctrl + m to use Enter key

$press 'ctrl + p to find the history

$fc -l                                                        [ to see the history

$sar                                                         [ Collect, report, or save system activity information ]

$sar  -n  dev  |more

$sar 4 5    

* Binary Marks
 --------------

Digits                     Permission

0                    none

1                    execute

2                    write

4                    read

3 (1 +2 )                 write and execute

5 (1 + 4 )                read and execute

7 (1 + 2 + 4 )                 read , write and execute
-----------------------
*USERS INFORMATIONS
--------------------
$cat  /etc/passwd                                   [ all users informations ]

$cat  /etc/shadow

$cat  /etc/gshadow

$cat  /etc/group
--------------------

#chage  -l   username                            [ change user password expiry information ]

#vi  /etc/sysconfig/selinux                     [  configure ther SElinux configuration]

#cd /var/log                                           [ to check the log file ]

#log] tail   messages                             [ to check the massages ]

#log] tail   secure                                  [ to check about the security log ]

#ls   -ltr                                                  [ to check all log file ]

#who -b                                                  [ show the dat and time of last system boot]

#who - u                                                 [ where  (.) means the user was active in the last minute , (old) means the user has been idle for more than 24 hours ]

#who -m                                                 [ show only hostname ]

#date  --date='15yers  ago'                   [ show the same day before 15 years ]

#setfont  /lib/kbd/consolefonts/iso02-12x22_press-tabe   [ to set the font of the console or command mode ]

#cat   OS.iso   >> /dev/sdb1                 [ To make a live booting from linux usb ]

#partprobe     /dev/sdb                         [ So kernal can read this pendrive ]

#startx                                                  [ To go from command mode to graphic ]

#last  username                                   [ To find last login by user ]

#set  |less                                             [ To show the all information about user ]

#!any-word                                          [ To find the history by that word ]
========================================================================

----------------------------------------------------------------------------------------------------------------------------------
vimtutor    (all editor - 'vi'  'vim'  'gvim' 'gedit' 'nano'  'emac' 'joc' 'cat' )
--------------------------------------------------------------------------------

            'VIM' Editor
        ..........................   

#vim  file-name

*press  'I' 'A' 'O' 'S' and 'P'  to go in to the insert mode ( to write some thing in the fiel )

*prss 'Esc' key to exit from the insert mod

*press ' :wq ' to save and quite from the file

*press ':q' to quit from the file

*press ':q!' to quit forceful

*press ':w' to save the file

*press ':w!' to save forcedly

*press ':wq!' to save and quit forcedly

*press 'd' to delete the line

*press '2dd' two line delete '3dd' three line delete

*press 'x' to delete the one by one

*press 'e' to end of the line and move right side

*press '0' to go to the first word of the line

*press 'y' from the word we want to copy [y - means yenky ] copy one line,

*press '2yy' copy to line . press '3yy' copy three line

*press 'p' to past the line

*press ':set nu' to set the all line in numbering.

*press ':set nonu' to set no numbering

*press ":! any command"  we can run any command while using 'VIM' run any command under the vieditor
        ----------------  

* To move the cursor, press the h,j,k,l keys as indicated. **
             ^
             k              Hint:  The h key is at the left and moves left.
       < h       l >               The l key is at the right and moves right.
             j                     The j key looks like a down arrow.
             v

*press 'dw' to delete a word

*press 'u' to undo the deleted line & press 'U' to undo whole line

*press 'Ctrl + r' to redo the command and word

*Type  ' r '  and then the character which should be there  ( to replace the word )

*Type "CTRL-G" to show your location in the file and the file status

*press 'gg' to go on the TOP of the page

*press 'Shift + g' to go on the BOTTOM of the page

*press "/word to find"  to find any word in the page

*press " :25 "  to go on the 25th line means find the sentence by the number

*To Replace the word  run this command :- " :%s/Rahul/Amit/g " means Rahul has been replaced by Amit. 

*To copy from the working file to a new file in vim editor use this command  ( :!cp  running-file-name   any-new-file-name )

#chattr  +i  file name          [ 'chatter' attribute is used to stop accidentally deletation of files and dir. we can not delete the files secured via
-------------------------          'chattr' now we can only read by option (+i) to remove the premission use (-i)

#chattr  -i  file name                           [ to remove the permission ]
-----------------------   

$grep  word-name   file/dir                 [ to find start from this word ]

$grep  -i word-name  file/dir               [ "]

$less   file-name                                  [ to view the file step by step press 'v' to      open the vieditor to change something ]


               
                        CAT-Editor
                    --------------------------


$cat  > ram                                     [ to create a new file  'cat > ram press enter and start to write after finished press 'Ctrl+D' to save the file ]

- - - -- -- - -
--- -----------
----------^D [ to save the fiel ]


$cat  ram  sam                                    [ to show the both file one time ]

$cat  ram  sam  > gopi                   [ to send the all content of 'ram' and 'sam' into the 'gopi' ]

$cat  ram                                            [ show the file ]

$cat >> ram                              [ to add some word and sentence in ram file ]

$cat -Et  ram  OR  $cat  -A  ram        [ to show the end of file ]

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

  

Thursday, July 25, 2013

HOW TO INSTALL (.rar file) IN LINUX

How to Open, Extract and Create RAR Files in Linux

RAR is most popular tool for creating and extracting compressed archive (.rar) files. When we download a archive files from the web, we required a rar tool to extract them. RAR is available freely under Windows operating systems to handle compressed files, but unfortunately rar tool doesn’t pre-installed under Linux systems, we need to install it using third-party tools to open, extract, uncompress or unrar a archive files.
Install Unrar in Linux

Install Unrar in Linux
The guide explains how to install unrar and rar command-line tools using RPMforge repository under Linux systems with yum command with their practical examples.

Enable RPMForge Repository for RHEL/CentOS/Fedora

We must first install and enable RPMForge repository under Linux systems to install Unrar and Rar command-line applications. We have provided RPMForge repositories for RHEL/CentOS 6/5/4 distributions. By default RPMForge repository already shipped with Fedora 17-12 systems, So fedora user’s don’t need to install it again.
For RHEL/CentOS 6/5/4 – 32-Bit OS
## RHEL/CentOS 6 32-Bit ##
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm

## RHEL/CentOS 5 32-Bit ##
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.i386.rpm
 
 
 For RHEL/CentOS 6/5/4 – 64-Bit OS
## RHEL/CentOS 6 64-Bit ##
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

## RHEL/CentOS 5 64-Bit ##
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
Once you’ve enabled RPMforge repository for systems. Follow the below instillation instructions with their examples.

Step 1: How to Install Unrar in Linux

# yum install unrar
Sample Output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Dependencies Resolved
=========================================================================================
 Package   Arch   Version    Repository   Size
=========================================================================================
Installing:
 unrar              i386            4.2.3-1.el5.rf      rpmforge   123 k

Transaction Summary
=========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 123 k
Is this ok [y/N]: y
Downloading Packages:
unrar-4.2.3-1.el5.rf.i386.rpm                                 | 123 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : unrar                                                                                                                                            1/1

Installed:
  unrar.i386 0:4.2.3-1.el5.rf

Complete!

Step 2: How to Open/Extract a RAR File in Linux


To open/extract a RAR file in current working directory, just use the following command with unrar e option.

# unrar e tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  index.php                                                 OK
Extracting  index.html                                                OK
Extracting  xyz.txt                                                   OK
Extracting  abc.txt                                                   OK
All OK
To open/extract a RAR file in specific path or destination directory, just use the unrar e option, it will extract all the files in specified destination directory.

# unrar e tecmint.rar /home/

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Extracting  /home/index.php                                           OK
Extracting  /home/index.html                                          OK
Extracting  /home/xyz.txt                                             OK
Extracting  /home/abc.txt                                             OK
All OK
 
To open/extract a RAR file with their original directory structure. just issue below command with unrar x option. It will extract according their folder structure see below output of the command.

# unrar x tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Creating    default                                                   OK
Extracting  default/index.php                                         OK
Extracting  default/index.html                                        OK
Creating    include                                                   OK
Extracting  include/abc.txt                                           OK
Creating    php                                                       OK
Extracting  php/xyz.txt                                               OK
All OK

Step 3: How to List a RAR File in Linux

 

To list a files inside a archive file use unrar l option. It will display the list of files with their sizes, date, time and permissions.

unrar l tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Archive tecmint.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.php           0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    8                0       64   0%

Step 4: How to Test a RAR File in Linux


To test an integrity of a archive file, use option unrar t. The below command will perform a complete integrity check for each file and displays the status of the file.

unrar t tecmint.rar

UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal

Testing archive tecmint.rar

Testing     tecmint/index.php                                         OK
Testing     tecmint/index.html                                        OK
Testing     tecmint/xyz.txt                                           OK
Testing     tecmint/abc.txt                                           OK
Testing     default/index.php                                         OK
Testing     default/index.html                                        OK
Testing     include/abc.txt                                           OK
Testing     php/xyz.txt                                               OK
All OK
The unrar command is used to extract, list or test archive files only. It has no any option for creating RAR files under Linux. So, here we need to install RAR command-line utility to create archive files.

Step 5: How to Install Rar in Linux


To install RAR command option in Linux, just execute following command.

yum install rar
Sample Output
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Dependencies Resolved
=========================================================================================
 Package   Arch   Version    Repository   Size
=========================================================================================
Installing:
 rar    i386            3.8.0-1.el5.rf      rpmforge   264 k

Transaction Summary
=========================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 264 k
Is this ok [y/N]: y
Downloading Packages:
rar-3.8.0-1.el5.rf.i386.rpm          | 264 kB     00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : rar                                          1/1

Installed:
  rar.i386 0:3.8.0-1.el5.rf

Complete!

Step 6: How to Create Rar File in Linux


To create a archive(RAR) file in Linux, run the following command with rar a option. It will create archive file for a tecmint directory.

rar a tecmint.rar tecmint

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive tecmint.rar

Adding    tecmint/index.php                                           OK
Adding    tecmint/index.html                                          OK
Adding    tecmint/xyz.txt                                             OK
Adding    tecmint/abc.txt                                             OK
Adding    tecmint                                                     OK
Done

 Step 7: How to Delete files from Archive


To delete a file from a archive file, run the command.

rar d filename.rar

Step 8: How to Recover Archives


To recover or fix a archive file or files, run the command with option rar r.
 
rar r filename.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Building fixed.tecmint.rar
Scanning...
Data recovery record not found
Reconstructing tecmint.rar
Building rebuilt.tecmint.rar
Found  tecmint\index.php
Found  tecmint\index.html
Found  tecmint\xyz.txt
Found  tecmint\abc.txt
Found  tecmint
Done

Step 9: How to Update Archives


To update or add files to existing archive file, use the following command with option rar u.

rar u tecmint.rar tecmint.sql

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Updating archive tecmint.rar

Adding    tecmint.sql                                                 OK
Done
Now, verify that the file tecmint.sql is added to archive file.

rar l tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Archive tecmint.rar

 Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver
-------------------------------------------------------------------------------
 index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9
 tecmint             0        0   0% 18-08-12 19:23 drwxr-xr-x 00000000 m0  2.0
 tecmint.sql 0 8 0% 18-08-12 19:46 -rw-r--r-- 00000000 m3b 2.9
-------------------------------------------------------------------------------
    6                0       40   0%

Step 10: How to Set Password to Archives


This is very interesting feature from Rar tool, it allows us to set a password to archive file. To password protect archive file use option rar a -p.

rar a -p tecmint.rar

Enter password (will not be echoed):

Reenter password:

AR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Updating archive tecmint.rar

Updating  tecmint.sql                                                 OK
Done
 
Now verify it by extracting the archive file and see whether it will prompt us to enter password that we have set above.

rar x tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Extracting from tecmint.rar

Creating    tecmint                                                   OK
Extracting  tecmint/index.php                                         OK
Extracting  tecmint/index.html                                        OK
Extracting  tecmint/xyz.txt                                           OK
Extracting  tecmint/abc.txt                                           OK
Enter password (will not be echoed) for tecmint.sql:

Extracting  tecmint.sql                                               OK
All OK

Step 11: How to Lock Archives


Another interesting lock feature from rar tool, it provides a option to lock a particular archive file from extracting it.

rar k tecmint.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Processing archive tecmint.rar
Locking archive
Done

Conclusion


For mor RAR and Unrar options and usage, run the following command it will display a list of options with their description.
# man unrar
# man rar
We have presented almost all of the options above for rar and unrar commands with their examples. If you feel that we’ve missed anything in this list and you would like us to add, please update us using comment form below

Tuesday, July 16, 2013

LIST OF UPLOADED SEVER-CONFIGURATION

1. VSFTPD

2. DHCP

3. SAMBA

4.  NFS

5.  HTTPD

6. DNS

7. NAT

8. SUDO

9. YUM

10. SSHD

11. NIS

12. INCREASE THE  SWAP PARTITION 

Friday, July 12, 2013

Cyber Security Courses

(FIND ALL DETAIL FOR CCCS & CCCSP)

go to this url - http://elearn.cdachyd.in/eSikshak/help/English/eSikshak/cccs.htm

NE (NETWORK ESSENTIAL )

                                         NE ( Network Essential ) 

1) What is the network ?

:- When more than one pc are connected physically is called Network.

2) What is Networking ?

:- When more then one P.C are interconnected and accessing the data and service like file, accessing , printer accessing etc. is called as networkig.


                       Topic in this lessone
                 ====================

a) Explain the history of computer networks ( ARPANET )

b) Explain the need of networks. 

c) Explain the type of computer Network 

d) Explain the layers of open system interconnection (OSI ) mode 


 

Saturday, June 29, 2013

USEFUL WEBSITES OF MY COLLECTION


               TOP WEBSITES
                     **************************************************

1. http://www.livestation.com/en/aljazeera-english#   [ whatch live bbc news ]

http://www.india.idp.com/uk/uk-education-fair/uk-education-fair.aspx?gclid=CJ3U39DdorUCFQub6wodplQAtA  [ ALL ABOUT UK STUDENT VISA ]

---------------Computer Classes Websites-------------------------

2. www.computernetworkingnotes.com   [ all about Networking ]

3. www.server-world.info/en

4. www.cyberciti.biz

5. www.linuxhomenetworking.com

6. www.linux.org

7. www.techcuriosity.com  [for all command information ]

8. www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:Ch14_:Linux_firewalls-using_iptables

9. www.ispexperts.com.np/?p=786

10. www.echowstuff.com

11. www.linuxtopia.org/online_books/rhel6/rhel_6_deployment_Ch-automated_Task.html [CRONTAB in RHEL-6 ]

12. http://rpmfind.net/linux/rpm2html/search.php?query=pdftohtml    [FIND THE ALL 'RPM' ]


--------------------Extra Useful Websites----------------

1. www.oxforddictionaries.com   [ Oxford Dictionary ]

2. www.bbclearningenglish.com    [ Learning English ]

3. www.indianrail.gov.in

4. www.irctc.co.in   [ Railway Ticket Booking ]

5. www.facts-about-india.com   [ All about India Fact]

6. www.coolinterview.com/type.asp?iType=741 [ Networking Interview Qustions ]

7. www.coolinterview.com/type.asp?iType=83

8. http://www.youtube.com/watch?v=PtYWfnFgM_g      [ All new computer trick Video from Youtube.com ]

and
http://www.youtube.com/watch?v=jg0IECQmUjE

9. http://www.crictime.com/watch_live_cricket_streaming_7.htm    [ watch live cricket match ]

10. http://www.youtube.com/watch?v=yLvHwZcsBkk&list=PLks8W396lro78Sxq4lPJZiXCdGT7gY166    [ Cisco clasess by Jasvinder]

11. http://www.youtube.com/watch?v=D-pi5riKjX4&list=PLks8W396lro78Sxq4lPJZiXCdGT7gY166     [ Jagvinder singh Cisco ]

12. http://www.jagvindersingh.blogspot.com    [All Networking classess by Jagvinder singh in Hindi ]

13. http://www.youtube.com/user/jagvinderThind   [ Watch the all video of Javinder Singh Cisco and Linux ]

14. http://www.9tut.com/ccna-basic-questions  [ All about CCNA classes ]

15. http://mknetwork-in.blogspot.in/2012/09/squid-proxy-server-configure-in.html  [ All about LINUX-6 Configuration ]

16. http://www.youtube.com/watch?v=VUAYmTnWaCY  [ Best youtube website for learning English pronouciation ]

17. http://www.antimoon.com/how/pronunctransdemo.htm  [ The best way to learn how to write pronounceation ]

18. http://www.tvonlinelive.net/Watch/Fox_News-Online-4729.html  [ whatch live new on FOX news live USA ]

19. http://www.techterms.com/category/internet   [ All about the Computers Cources A to Z ]

20. http://windows.microsoft.com/en-IN/windows7/products/features/bitlocker  [All about Windows-7 Features ]

21. http://www.comptechdoc.org/   [ All about the Networking - total clasess ]

22. http://www.techterms.com/definition/pppoe  [ Best website for All Networking ]

23. http://www.9tut.com/  [All question and answer from CCNA ]

24. http://billalert.mtnl.net.in/pay/login.asp   [ MTNL - BILL PAYMENT ] ***

25. http://www.certificationkits.com/cisco-certification/Cisco-CCNA-Network-Services-and-Troubleshooting-Tools-Part-II.html    (ALL ABOUT CCNA NETWORK MONITARING COMMNADS )

26. http://www.microsoft.com/security/default.aspx  [ all about Windows security]

27. http://www.securitymagazine.com/articles/topic/2236-cyber-security      [all about cyber-security ]

28. http://en.wikipedia.org/wiki/Server_(computing)      [ To know all about the Server Configuration ]

29. http://www.igenericdrugs.com/       [ All about the drugs information ]

30. https://help.ubuntu.com/community/Internet/ConnectionSharing  [ All about network sharing and iptables]

31. https://help.ubuntu.com/community/IptablesHowTo            [ Find the all about Iptables ]

32. http://www.networking-forum.com/viewtopic.php?f=42&p=215138  [iptables configuration ]

33. http://lartc.org/lartc.html               [ Linux Advanced Routing & Traffic Control HOWTO ]

34. www.facts-about-india.com         [ All about  India ]

35. 

SWAP PARTITION


  HOW TO INCREASE THE SWAP PARTITION SIZE
      ***************************************************
   
Normally we keep size of SWAP double to the RAM, but what if you have installed additional RAM and require more swap space. Lets see how we can increase the SWAP space without restarting the system assuming that there is some free space in the hard disk.

Open linux terminal and log in with root.

1) fdisk -l ( this will tell about the partitions in the Hard disk)

Assuming there are partitions upto sda7

2) fdisk /dev/sda

Press m for all the help options at this point.

3) Press n for the new partition.

it will ask for first cylinder – press enter (no need to give anything there)

it will ask for last cylinder TYPE : +1G ( it means that additionaly SWAP space will be of 1GB)

4) (1-8) press 8 (its for the new sda8)

5) Press l and then 82 ( 82 is hex number for SWAP)

6) Press p (to print the details)

7)press w (to write the configuration in the partition table)

but the work is not finished yet because still Linux system is using old partition table…. so we need to force it to read the new partition table and the command is

8) partprobe (used to read new partition table)

9) mkswap /dev/sda8 (this will make the swap space to be used)

Note: if we restart Linux then the new swap partition will get lost so we need to make it permanent by making an entry in /etc/fstab

10) vi /etc/fstab (press i to go in insert mode)

In the last line make this entry

/dev/sda8 swap swap defaults 0 0

save the file with :wq

11) mount -a

12) swapon -a

13) swapon -s (to see the status)

That's all you have to do to add some more swap space to your LINUX for better functionality.

DHCP - SERVER (Dynamic Host Configuration Protocol )

                                                      DHCP SERVER

DHCP -  Dynamic Host Configuration Protocol

Port No. -  67,68

package  - dhcpd

deamon  - dhcpd

role     -   provides  the dynamic ip add. to all the LAN.  P.C,
-----------------------------------------------------------------------------------

( Note : - Before configure the 'DHCP' Server set the static IP in the system  on which we are going to  configure DHCP server )

   #vim    /etc/sysconfig/network-script/ifcfg-eth0

      BOOTPROTO = static

      IPADDR  =  192.168.0.1

      NETMASK =  255.255.255.0

      :wq   [ after this conf. save the file and quit ]
 ----------------------------------------------------------------------

step 1.    Install the package  'dhcpd'

              #yum    install  dhcpd

             (copy the the conf. file from /user/share/doc/dhc-4.1.1/dhcpd.conf.sample  to                                              /etc/dhcpd/dhcpd.conf )

step 2.      #cp     /usr/shar/doc/dhcp-4.1.1/dhcp.conf.sample       /etc/dhcp/dhcpd.conf

             overwrite ?  yes  

            [  Nonte:-  This particular subnet declaration specifies a default lease time of 600 seconds (10 min)  and a maximum lease time of 7200 seconds (two hours ). Other common values would be 86400 (one day )  ,  604800 (one week ) ,  and 2592000 (30 day ).


step 3.   #vim    /etc/dhcp/dhcpd.conf


           #this is very basic subnet declaration.

         sbunet  192.168.0.0   netmask   255.255.255.0 {

          range   192.168.0.2     192.168.1.50 ;
          }

         :wq   [ save the file and quit after this configuration )

          #service    dhcpd      restart
          
step 4.    # vim   /var/lib/dhcpd/dhcpd.leases          [ go in to this  file and delete  all the content  ]      

              :wq   [ delete all and save the file ]

              # vim  /var/lib/dhcpd/dhcpd.leases~        [ again go in to this file and delete all ]

               :wq    [ delete all and save the file ]

step 5.    [ Note:- if want to fix the IP of any system than go to the file '/etc/dhcp/dhcpd.conf' and put the
MAC Add. and of  that system and fix the IP

              #vim      /etc/dhcp/dhcpd.conf

              host  fantasia     [ find this line in conf. file of dhcp ]

              hardware ethernet          00:0c:f1:80:3a:67 ;

              fixed  - address    192.168.0.5

              :wq    [ after fixed the IP save this file and quit ]

              #service    dhcpd    restart

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

YUM SERVER


 YUM  (Yellow Dog Update Modifier ) 
                ------------------------------------------

* YUM - It is a 'xml' file. It resolve the dependency,it is front end of '.rpm'

(FROM SERVER END)
         ...........................................

step 1. [Copy the DVD of RHEL-6 in to the '/var/ftp/pub'

#mount  /dev/cdrw   /mnt   [ mount first the DVD in to the '/mnt ]

#cd   /mnt

#cp -av -R  *  /var/ftp/pub      [where '*' is whole dir 'Package' ]

step 2. #vi  /etc/yum.repose.d/server.repo

[ where 'server.repo' is the name of your yum server that can be any thing "file.repo"]

[server]

name = server

baseurl = file:///var/ftp/pub/Package

gpgcheck = 0

enabled  = 1

:wq   [ after this configuration save the file and exit]

step 3. Install the package of 'creatrepo'

#cd  /var/ftp/pub/Package

#rpm   -ivh  creatrepo_pres tab  


step 4. #cd ..

   #cd ..

   #creatrepo  pub   (/packages)

step 5. #yum clean all

#yum list all

step 6. #yum   install    package name

Ex. - yum install vsftpd

FROM CLIENT END
                .........................

step 7. #vim  /etc/yum.repos.d/server.repo

[server]

name = server

baseurl = ftp://192.168.0.1/pub/Packages

gpgcheck = 0

enabled  = 1

:wq  [ save the file and quit ]


#yum list all

#ping  -s 256 192.168.0.1
-----------------------------------------------------------------------------------------------------