How do I in shell terminal copy an entire file or directory file from one linux server to anouther linux server

Ok I have centos os account on one server and I want to pull in my files from another server.

I want to do this in terminal mode. By ssh into the remote server getting my entire directory and copying it to my current location.
How would I do this
sobeservices2Asked:
Who is Participating?
 
rajendraoneConnect With a Mentor Commented:
scp root@192.168.178.1:/directory/[^.]* /local/directory/

The expression [^.]* means any files that does not start with "." which are hidden.

0
 
medveddConnect With a Mentor Commented:
scp -r user@host:/path/dir .

user - your username on remote server host
0
 
JelcinConnect With a Mentor Commented:
you can use scp

scp root@192.168.178.1:/directory/file /local/directory/

would login on remote server 192.168.178.1 with user root and copy /directory/file from remote server to /local/directory/
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
JelcinConnect With a Mentor Commented:
scp file  root@192.168.178.1:/directory/

would copy file on local computer to server 192.168.178.1 with user root to /directory/
0
 
sobeservices2Author Commented:
I am trying to copy the home directory

would path be

/home/myname
usr/home/myname
I want everything from the home directory
0
 
sobeservices2Author Commented:
scp root@192.168.178.1:/directory/file /local/directory/

Worked how would I eliminate hidden files?
0
 
sobeservices2Author Commented:
Thank you
0
 
sobeservices2Author Commented:
I tried this with another vm machine Solaris 10

and got this when I typed the line

ssh: connect to host columbia.com port22: Connection refused

What does this mean it worked ok on another vm
0
 
rajendraoneCommented:
That means columbia.com is not listening on port 22 or you cannot reach at port 22 of the server. It could be reachability issues or just the server is not listening to that port for anyone. Make sure sshd is running on the remote server.
You may verify if the server is listening to ssh by issueing following command:
$ netstat -na | grep 22
      *.22                 *.*                0      0 49152      0 LISTEN
If you see something like *.22 then it is listening on port 22.

First make sure you can ping to that server.
0
 
rajendraoneCommented:
Or sometimes, even when ssh is running you are not allowed ssh using root. Check /etc/ssh/sshd_config file at the remote server.
0
All Courses

From novice to tech pro — start learning today.