Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I like to copy a file from the server to local host. What will be the command? I can ssh to server and now want to copy the file to my local directory. I am using Redhat.
Can you reach the local machine from the server by IP? Or on other words, are you on a host that the server can contact on the LAN, rather than being behind a firewall/NAT at a remote location (as in, from a school, office, etc).
If the server and the client are on the same network, you can simply log into the server with SSH, and run a command like this:
scp ./filename username@localIP
So if you wanted to move the file "Test.txt" to the computer at 192.168.1.120 as user tom, you would do:
scp ./Test.txt tom@192.168.1.120
Assuming the machine is running an SSH server, that will copy the file over to it.
Thanks for the quick reply. Following command works very fine. but I was not able to trace it in local machine. I was not able to find the copied file in local machine. From the server it says 100% complete.
the local user name is root@IP address. Where I will find it? Thanks.
Hi foysol_bgd,
you can do this:-
scp file.txt root@server:/root/file.txt (or /home/root/ if you lazy)
scp -r folder root@server:/root (for recusively copy folder)
Regards,
Ks
Rather than ssh'ing to the server and performing an scp on the server, which establishes a 2nd ssh connection back from the server to your local machine, you're better off doing it all in one scp command on the local host:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.