Big-E's [nearly] Daily Quick Tips. Updated: November 4th, 08

DON'T post new tutorials here! Please use the "Pending Submissions" board so the staff can review them first.
Post Reply
User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

Big-E's [nearly] Daily Quick Tips. Updated: November 4th, 08

Post by Big-E »

So I figure I could at least be a little use, and I figured what way then giving a daily tip of various functions I find useful. Heck, I will probably forget about it some days, so it will probably be a tip every third day. Anyway, I will start with my first tip, other people can feel free to chip in with a tip of their own, if they wish..

SCP FUNCTION
Ever find yourself connected via SSH to a remote host and quickly want to transfer a file? Some of you might connect via ftp and transfer the file that way, but why? Why not use the scp function? SCP or "secure copy" will transfer files to and from your host, or remote host - whichever direction you wish to send the file. It`s really quite easy.

Send from remote host, to your localhost
In your local terminal type the following:

Code: Select all

scp user@remotehost.tld:/directory/to/file.extension /path/to/store/file/locally
This will prompt you to type the password to the remote users, on the remote host. Once you are authenticated, the file will be transfered via SSH to your computer.

Send from localhost, to remote host
In the terminal type the following:

Code: Select all

scp /local/path/to/file.ext username@hostname.tld:/path/to/folder/on/remote/host 
Again, this will prompt you to type the password, upon authenticating it will the transfer the file to the remote host.

Of course, this is not all you can do with the command, it`s but a small introduction. You can ready the manual pages by typing man scp and learn some of the more advanced features.
Last edited by Big-E on 05 Nov 2008, 16:37, edited 2 times in total.

User avatar
Still_Learning
Fame ! Where are the chicks?!
Fame ! Where are the chicks?!
Posts: 1040
Joined: 11 Jun 2008, 16:00
15
Location: Trigger City

Post by Still_Learning »

First time i have heard of that feature, thanks! :D

User avatar
Big-E
Administrator
Administrator
Posts: 1332
Joined: 16 May 2007, 16:00
16
Location: IN UR ____ , ____ING UR _____ .
Contact:

November 4th Update.

Post by Big-E »

THE DIFF FUNCTION

So again, I will be explaining another simple command which most *nix systems have. The diff commands. It`s pretty simple to use.

Scenario: We have file1 and file2, file1 contains the configuration for a service we are running on our system and file2 contains a copy of the file, and the changes we have made to the file. So say we wish to view exactly which changes we have made, we can do the following:

Code: Select all

 
diff file1 file2
The output will look something like this:

Code: Select all

< String1 
---
> String1-WithChanges
< String2
---
> String2-WithChanges

So, what use is this? Well, very simple really. This is a very quick way you can note the difference between two files, without having to visually inspect each element of the file manually, that is why we invented machines in the first place. To work for us.

User avatar
computathug
Administrator
Administrator
Posts: 2693
Joined: 29 Mar 2007, 16:00
17
Location: UK
Contact:

Post by computathug »

Nice tutorial buddy, il try this once i get all systems up and going again.

Like the title of the post as well :wink:

Post Reply