SCP file transfer between two linux machine in command line

SCP (Secure Copy) is a command line tool for Linux systems to securely transfer files from local to remote server or vice a versa. SCP uses SSH protocol for transferring files between two systems which is more secure than ftp.

Syntax: (Local to Remote)

scp /path/to/local/file.txt user@

Syntax: (Remote to Local)

scp user@ /path/to/local/

SCP command required password of remote system. In case you need to configure scp command in script and run with scheduler, you need to configure key based ssh login.

Transfer File Local to Remote Server
Following command will copy myfile.txt from current directory of local system to remote server’s /opt directory using root authentication. We are assuming remote server hostname is

$ scp myfile.txt

Transfer File Remote Server to Local
Following command will copy /opt/myfile.txt from remote system to local system’s /opt directory.

$ scp /opt/

Define Port with SCP Command
In case SSH is running on different port on remote server, use -P switch followed by port number with scp command.

$ scp -P 2344 myfile.txt

Transfer Directory Local to Remote Server Recursively
Following command will copy /opt/mydir directory from local system to remote system’s /opt directory recursively.

$ scp -r /opt/mydir

Transfer Directory Remote Server to Local Recursively
Following command will copy /opt/mydir directory from remote system to remote system’s /opt directory recursively.

$ scp -r /opt/

CentOS 7 no interface, no internet! installed on VMware workstation.

Job for network.service failed because the control process exited with error code.

This is what CentOS 7 says while you are trying to restart network.servce. New bees always runs into this problem i think atleast once. Because it was me too. So here i’m writing an easy solution.

When you ran into this problem your “ifconfig” command will only show you “l0” and/or “virbr0” in the list. There is no “eth0” or “eno16777736” device there. Then it must be giving big pain to your head.

Use below command …

dhclient -v

It will bound some IP address to the interface, its taking IP from DHCP, output will look something similar like below…

[root@localhost Desktop]# dhclient -v
Internet Systems Consortium DHCP Client 4.2.5
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.
For info, please visit

Listening on LPF/virbr0-nic/52:54:00:2e:2f:5f
Sending on LPF/virbr0-nic/52:54:00:2e:2f:5f
Listening on LPF/virbr0/52:54:00:2e:2f:5f
Sending on LPF/virbr0/52:54:00:2e:2f:5f
Listening on LPF/eno16777736/00:0c:29:bd:5c:3f
Sending on LPF/eno16777736/00:0c:29:bd:5c:3f
Sending on Socket/fallback
DHCPDISCOVER on virbr0-nic to port 67 interval 4 (xid=0x7cc5ba1e)
DHCPDISCOVER on virbr0 to port 67 interval 3 (xid=0x47fa961e)
DHCPREQUEST on eno16777736 to port 67 (xid=0x426c09a9)
DHCPACK from (xid=0x426c09a9)
bound to -- renewal in 683 seconds.

And Boom!!! your VM machine will have internet again… you can create a file with this command and make it auto start in boot. then you dont have to do this again and again…




Bootstrap is an open-source framework used to develop websites based on HTML, CSS and JavaScript, Bootstrap started as a project by Mark Otto and Jacob Thornton. The intention was to encourage consistency across web pages, but grew to include tooling for mobile-first design and common features web developers want, such as validation and dialog boxes.

Less is a style sheet language that helps overcome some of the complexities and shortcomings with CSS, and is converted into CSS that browsers can use. Bootstrap uses it because the Less is converted to CSS, developers using Bootstrap do not need to be familiar with Less. However, knowing Less can make customizing sites easier.

Bootstrap offers web developers many advantages. It makes it easier to layout pages without the use of tables. It simplifies CSS, as the bulk of the functionality you look for as a developer is already built for you, and frequently only requires the addition of classes to HTML elements, and a bit of structure.

There are several tools that make development with Bootstrap even easier. Visual Studio has IntelliSense for Bootstrap, which offers autocompletion of the different classes. You can also download a set of snippets for Visual Studio, which allows you to create complex Bootstrap structures with just a couple of clicks of the mouse.


I assume that you are familiar with HTML(Hyper Text Markup Language) already and also CSS. As you can edit or create HTML with any text editor Bootstrap is also like that. But first you need to add necessary file references in HTML like CSS.

Regardless of the editor you choose, and you can use any editor you like, the steps to add Bootstrap to a page are similar.

  1. Otain the necessary files
    To add Bootstrap to a page, you’ll need to obtain the CSS, glyphicons, and JavaScript files from These files are available in a single zip file, which can be extracted to the folder you’ll store your HTML pages in. By default, the folders inside of the zip file are titled css, fonts and js. While you can keep these folder names, I like to rename css to Styles, and js to Scripts.
    In addition, the Bootstrap JavaScript library requires jQuery. You can obtain jQuery from The only file you’ll need is the minified, production file. You can add this to the Styles folder.
  2. Create an HTML page and add the necessary references
    After creating an HTML page, you need to reference the following files:

    1. Inside the head section, create a reference to bootstrap.min.css. Sample HTML for creating the reference is provided below. Remember, if your CSS file is in a different folder, you will need to update the folder name Styles to the name you chose. (In addition, you could use a content delivery network (CDN)).
      <link rel='stylesheet' href='./Styles/bootstrap.min.css' />
    2. Inside the body section, typically at the bottom, you need to reference two JavaScript files, jQuery and Bootstrap. The files must be referenced in that order. As before, you will need to update the folder name Scripts to the name you chose. The name of the jQuery file may also be different as the version of jQuery changes over time. Finally, you could also use a CDN to serve the necessary files.
      /Scripts/jquery-2.1.4.min.js and /Scripts/bootstrap.min.js

When referencing script or CSS files, best practice is to use the minified versions of the files, typically identified with the letters min in the name. Minified files don’t contain line breaks, spaces, or other components that make the scripts human readable, things which browsers don’t need. By using the minified versions, you minimize the amount of data sent to the client, which will improve the rendering speed of the page.

On the next post we will continue with bootstrap classes and work with a page design practically.

Break Root Password

How to break root password in Linux (RedHat/CentOS)

Its actually very easy to break a linux server’s root password if you have access to the physical server. Security is actually an illusion, just you need to make your server secure from any kind of threat that is coming from your environment and also your friends.

Here i will describe how to break a linux server’s password in a easy way, if you anyhow forget your root password it can be recovered just some few steps and commands. lets begin…

Step-1: Reboot your system by hard switch or pressing ‘Ctrl+Alt+Del’ or any other way you want. And don’t allow your server to load the OS again, i mean before loading just press arrow keys.

Step-2: Now you need to edit the current entry by pressing ‘e’ button. It will open some scripts in your window.

Step-3: Find the line that starts with ‘linux16’ and navigate your cursor to the end of the line. You can do this by pressing the ‘End’ button or by pressing right arrow until the last character. Now add or append ‘rd.break’ after a space at the end of the line. And press ‘Ctrl+x’ to boot using the modified config.

Step-4: System will appear with command link viewing something like below.


Now you need to remount /sysroot file and give read/write permission.

switch_root:/# mount -o remount,rw /sysroot


switch_root:/# chroot /sysroot

‘chroot’ runs a command or an interactive shell from another directory, and treats that directory as root. It will take you to a new shell like below.



Here you need to give the ‘passwd’ command to give it a new password. it will prompt twice.

sh-4.2# passwd [press enter]

: ******* (123456)
: ******* (123456)


After all these steps the last step is to create a autorelabel executable file which the OS will take to relabel the configuration file. Next just exit from both shell and it will take some time(like 2min) to boot and you can enter with the new password.

sh-4.2# touch /.autorelabel
sh-4.2# exit

switch_root:/# exit

Wait for 2 minute and Login… Hurreeeh…!!! now access the root with your new password and you can change this with any password you want.

Hello World!!!

I am wondering why each and every programming code tutorials starts with writing “Hello World”. It could be anything. Hello world is just a simple string and it used to show some thing as output.

Below i am listing the way of different programming languages to print/show the “Hello world” string…


print(“Hello world!”)


console.writeline(“Hello world!”);


printf(“Hello world!”)


<html><body>Hello World!</body></html>


echo “My first PHP script!”;