Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using SFTP via terminal to connect to a server to upload and download files. I often find myself typing statements like this:

cd website/theme/drupal7default/assets/css
lcd website/theme/drupal7default/assets/css
put mainstyle.css

It would be much better if I could have one command that can perform both a cd and lcd. So that I can do something like:

cdboth website/theme/drupal7default/assets/css
put mainstyle.css

This will make sure my lpwd and pwd are the same. Does the command I'm looking for exist? And if the command does exist, what is it?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Within sftp the easiest way is probably to use the arrow to return to previous command, then Home or Ctrl+A to go to the beginning of the line, then L Enter. That is:

  • Home L Enter

For your use case perhaps the internal SFTP client is not the smoothest way, though. You don't mention OS, but if it concerns *nix, then using an SCP wrapper script directly might be a simple way to save time in the end, creating e.g. myupload and mydownload that attempts to upload or download the file given as argument to/from the server respectively, automatically deciding the correct paths from some given base project paths. Set up key based login so you don't have to enter a password every time.

Another pro with using SCP from the command line on *nix as compared to the SFTP client is that you will be in a familiar shell environment, most likely Bash, and have access to regular navigation tricks among the commands such as tab completion, command repetition, brace expansion, etc.

Personally I prefer version control systems for these kinds of tasks. It will give you simple uploading using e.g. a commit hook, and version control is very handy for code projects. I don't know exactly what you are doing so it might not fit perfectly, but if you like, take a look at e.g. Mercurial or Git.

share|improve this answer
    
I agree with everything you said. Their systems admin disabled my ssh access. I think that's why when i run scp command, i get permission error. This system hasn't installed version contorl yet. –  John Aug 23 '12 at 15:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.