How to add bridge network

Problem Statement:
You might have created VM in your laptop which is running on different network segment 10.x.x.x. your laptop is running on wired/wireless network on different segment 192.168.x.x. Now we need to bridge these two network to transfer files and access internet. How to achieve it?
In your VM add another network interface as bridged network device name is eth1 and make a note of HWaddr.
Reboot the VM generally allow you to bring eth0 and eth1 both interfaces on by default. now you can access your laptop/pc through the second interface IP segment will be same as your Laptop/PC segement

if not we can manually add the device file and update as below

[root@localhost network-scripts]# pwd
[root@localhost network-scripts]#

[root@localhost network-scripts]# cat ifcfg-eth0
[root@localhost network-scripts]# cat ifcfg-eth1
[root@localhost network-scripts]#
eth0 Link encap:Ethernet HWaddr 08:00:27:yy:yy:yy
inet addr: Bcast: Mask:

eth1 Link encap:Ethernet HWaddr 08:00:27:xx:xx:xx
inet addr: Bcast: Mask:

How to scp from remote server multiple files

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Basic syntax of SCP

scp source_file_name username@destination_host:destination_folder

“copy source_file_name” into “destination_folder” at “destination_host” using “username account”.

How to copy single file
$scp -p username@hostname:/u01/local/oracle/db_01/backup/<FileName> .


How to copy multiple files
To use wildcard on the remote host, we must delimit the wildcards with backslash (\)
$ scp -p username@hostname:/u01/local/oracle/db_01/backup/\*.dmp .

The above command will pass “*.dmp”

How to copy Entire folder

$ scp -p username@hostname:/u01/local/oracle/db_01/backup/\* .


1.1 Copy the file “foobar.txt” from a remote host to the local host

$ scp /some/local/directory

1.2 Copy the file “foobar.txt” from the local host to a remote host

$ scp foobar.txt

1.3 Copy the directory “foo” from the local host to a remote host’s directory “bar”

$ scp -r foo

1.4 Copy the file “foobar.txt” from remote host “” to remote host “”

$ scp \

1.5 Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host

$ scp foo.txt bar.txt

1.6 Copy the file “foobar.txt” from the local host to a remote host using port 2264

$ scp -P 2264 foobar.txt
1.7 Copy multiple files from the remote host to your current directory on the local host

$ scp\{a,b,c\} .

How to rotate log files

We can use simple linux commands to rotate logs. There are some tools also available to rotate the logs.
Method 1: Backup the log and make the log empty without stopping the service.
1.1 Backup the current Log

$ tail -100000 alert_UPGR.log > alert_UPGR.log.bak

$ ls -ltr alert_UPGR.log*
-rw-r—– 1 oracle oinstall 353665 Jul 4 00:41 alert_UPGR.log
-rw-r–r– 1 oracle oinstall 353665 Jul 4 00:52 alert_UPGR.log.bak
1.2 Compress the backed up Log

$ gzip alert_UPGR.log.bak
$ ls -ltr alert_UPGR.log*
-rw-r—– 1 oracle oinstall 353665 Jul 4 00:41 alert_UPGR.log
-rw-r–r– 1 oracle oinstall 33727 Jul 4 00:52 alert_UPGR.log.bak.gz
1.3 Empty the active log

$ >alert_UPGR.log

$ ls -ltr alert_UPGR.log*
-rw-r–r– 1 oracle oinstall 33727 Jul 4 00:52 alert_UPGR.log.bak.gz
-rw-r—– 1 oracle oinstall 0 Jul 4 00:53 alert_UPGR.log
1.4 Confirm the alert log is updated

SYS@UPGR:SQL> alter system switch logfile;

System altered.


$ ls -ltr alert_UPGR.log*
-rw-r–r– 1 oracle oinstall 33727 Jul 4 00:52 alert_UPGR.log.bak.gz
-rw-r—– 1 oracle oinstall 229 Jul 4 00:54 alert_UPGR.log
2. How to rotate Catalina.out log when it is more than 5M?.

2.1. Create this file


2.2. Copy the following contents into the above file

/var/log/tomcat/catalina.out { copytruncate daily rotate 7 compress missingok size 5M }

About the above configuration:
Make sure that the path /var/log/tomcat/catalina.out above is adjusted to point to your tomcat’s catalina.out
daily – rotates the catalina.out daily
rotate – keeps at most 7 log files
compress – compressesthe rotated files
size – rotates if the size of catalina.out is bigger than 5M

How to run shell script in background

We need sometime run the script in background

1. How to execute the script in Background
Let us say you have created script call

Login to remote host with appropricate username and password

$ nohup <scriptname> > <logname> &
$ nohup /home/oracle/mudhalvan/scripts/ > /home/oracle/mudhalvan/scripts/test_bg.log &

2. How to check any background jobs are running in this session
$ jobs

3. Test with example
oracle@localhost:~/mudhalvan/scripts$ cat

find /. -name “test” -print
oracle@localhost:~/mudhalvan/scripts$ ls -ltr
-rwxr-xr-x 1 oracle oinstall 29 May 27 19:43
oracle@localhost:~/mudhalvan/scripts$ nohup /home/oracle/mudhalvan/scripts/ > /home/oracle/mudhalvan/scripts/test_bg.log &
[1] 3865
oracle@localhost:~/mudhalvan/scripts$ jobs
[1]+ Running nohup /home/oracle/mudhalvan/scripts/ > /home/oracle/mudhalvan/scripts/test_bg.log &

4. Why we need to run the scripts in background

1. You may be connected remotely to the server and execute some script which need to be executed for more than few hours. Due to network issue or session security you remote session may disconnect which may cause your running script end at half way.

2. Long running script which will not take your one session of your remote client connection from your client machine.

5. Benifits of running a script in background

1. Disconnect or network disturbance on your remote client will not impact your script execution
2. You can use the current remote session for another process