Saturday, 16 September 2017

conditional execution of commands in linux

if the first command is executed successfully then execute the second command in linux
example
       if the kuldeep folder is present at your working directory then this will create test.txt file in this folder.
[root@localhost~]#ls -ld kuldeep && touch kuldeep/test.txt

if the first command does not execute successfully then execute the second command in linux
example
      if the kuldeep folder is not present at your working directory then this will create it
 [root@localhost~]#ls -ld kuldeep || mkdir kuldeep

pls put your comments and suggestion.

Friday, 15 September 2017

how to search a keyword and replace in linux using vim text editor

[root@localhost ~]# vim testfile.txt
# go to the execution mode of vim
:%s/keyword/neword/ig
#option i is use for ignore case
#option g is use for global search
#only draw back is this will not match exact keywork you use this as
:%s/\<keywork\>/newword/ig
#this will match exact keyword and replace with new.

Thursday, 14 September 2017

how to set login message in linux

[root@localhost~]#vim /home/msg.sh
#!/bin/bash
dialog --title "welcome message"\
           --infobox "welcome $USER. welcome to linux system.\
                            your login time is ( `date`)" 7 50; sleep 5
:wq
[root@localhost~]#chmod +x /home/msg.sh
[root@localhost~]#vim /etc/profile
#"at the end of file"
/home/msg.sh
:wq
now log out your user then relogin it


pls put your comment and suggestion.

Friday, 20 May 2016

how to use laptop as hotspot

run command prompt as admin
1- netsh wlan set hostednetwork ssid=testwifi mode=allow key=12345678
(key should be in 8 characters)

2-netsh wlan start hostednetwork

this command will create a virtual interface like ( local area connection* 4)

now you wifi router is enabled

if you wants to share your internet connection with others 
then right click on your lan connection and go to the properties
then sharing 
then internet connection sharing 
then check the check box of allow other network users to connect through this computers internet connection 
then select yout connection like ( local area connection* 4)

how to set time for internet use

this will allow internet access for a particular time interval. R4(config)#int f0/0 R4(config-if)#ip nat inside R4(config-...