LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   what command will do this? (https://www.linuxquestions.org/questions/linux-newbie-8/what-command-will-do-this-491880/)

MrSako 10-12-2006 03:22 PM

what command will do this?
 
to upload files from my Windows PC to my Linux server over ssh i use this program that looks likea ftp client that uses ssh. i normally use putty to logon to my ssh server, and i hate openinig a seperate connection and program just to upload a file. what command can i use to upload a file from my PC (windows) to my linux server which im connected to via ssh?

another thing i'd like for convinance reasons is to know how to do something like... for instance this command i use on text files i create in windows when i upload them to linux

perl -i.bak -pe 's/\r\n/\012/' filename.ext

its alot of letters and stuff to type in. id like to create my own command so i it can be like mycommand filename.ext and it runs that. is something like that very hard to do?

gilead 10-12-2006 03:36 PM

You can use pscp.exe to copy files to an SSH server - it's one of the programs that comes with putty. It doesn't have a GUI but it can use your saved putty sessions. For example the first command line below doesn't use a saved putty session, but the the second one use a saved session called ssh-box:
Code:

pscp bigfile.iso ssh-box.onmynetwork.com.au:/home/steve
pscp bigfile.iso ssh-box:/home/steve

For converting files on your Linux box, you can use fromdos. From man fromdos:
Code:

fromdos  takes a DOS text file as stdin and sends a UNIX text file to stdout

cs-cam 10-12-2006 07:01 PM

dos2unix is another app that will convert your text files :)

MrSako 10-16-2006 03:00 PM

i dont think i understand how ot use pscp? i downloaded it from here http://www.chiark.greenend.org.uk/~s.../download.html

when i run it in wnidows it just opens a window and closes it.

gilead 10-16-2006 09:02 PM

That's correct - it doesn't have a GUI so you need to run it from the command line with something like the command I used earlier.

shawnbishop 10-17-2006 01:54 AM

Good Day

Download a program called "bitvise tunnelier", it opens a console and a "Windows Explorer" like FTP program to copy files, but it uses scp and ssh

Cheers

MrSako 10-23-2006 04:09 PM

Quote:

Originally Posted by gilead
That's correct - it doesn't have a GUI so you need to run it from the command line with something like the command I used earlier.

so i upload pscp to the server it will be used on?

gilead 10-23-2006 05:54 PM

No - pscp.exe is the windows program that will copy files from your windows box to your SSH server. On the Linux SSH server will already be Linux executables for doing the same thing from the Linux box (scp, sftp, ssh) to other SSH servers.

EDIT: The commands in my earlier post are run on the windows box to copy files to the Linux SSH server.

Was that what you meant?

MrSako 10-24-2006 03:41 PM

oh thats not exactly how I wanted it to work.

ie im already in putty doing stuff on my linux server messing with files etc and i realize i need to upload a file for whatever im doing

id like to just be able to type in

uploadfile c:\lala\lala\lala


versus what i do right now is i open this other program i have thats for uploading and downloading files over ssh with a ftp like gui (i dont care for the gui)

its so inconvinant (sp) to have to open a whole new program to upload a small file.

i don't think bitvise is for me it seems like the program i already have.

prasanta 10-26-2006 02:12 AM

The other option is to mount your windows partition into the linux box and do a normal cp of the files from the mount point to the desired directory. You can achive that with putty also.

--
Prasanta

chrism01 10-26-2006 02:23 AM

what about mounting via Samba (or NFS) ?

timmeke 10-26-2006 06:34 AM

@chrism01: that's exactly what prasanta was referring to.

And indeed, it should be fairly straight-forward:
1. On Windows, make a shared folder with appropriate permissions and a suitable name of course.
2. On Linux, you can then use "smbmount" or "mount -t smb" to mount the shared folder on your Linux box.
If you want to have it mounted each time you boot your Linux box, you could add it to /etc/fstab.
When inside PuTTY, you can then simply cp from/to the shared folder.

In your case, I recommend sharing & mounting the entire Windows disks, to avoid having to copy (on Windows) the files to the shared folder (ie again, an operation outside PuTTY) to make them available to Linux.


All times are GMT -5. The time now is 11:02 PM.