Mellon
Mellon

Reputation: 38842

Newbie: linux command

Two questions to ask:

1. I am using scp command to copy a file from a remote server, I am wondering how can I specify the place where to paste the copied file on my local computer?

for example, if I wanna copy a test.txt file from a remote server and paste it on my local computer under /home/myname/tmp/ what is the proper command? is it

scp SERVER_ADDRESS /home/myname/tmp/

2. If I want to search a file whose name contain text of "test" , what is the command I should use? I mean search for any file with name test , ('_' is a wildcard)

--------------------------- update ------------------------

what is the difference between "find" and "grep"?

Upvotes: 1

Views: 155

Answers (2)

0xd
0xd

Reputation: 1901

1:

scp SERVER_ADDRESS:/path/to/remote/file.txt /path/to/local/file.txt

2:

find . -name "*test*"

This will search for files/directories containing "test" anywhere in the filename. The search will start from the current directory . To search in another path, use find /path/ -name "*test*". If you only want to search in files, that is, exclude directories, then add -type f before the -name option.

Upvotes: 1

Kirk Strauser
Kirk Strauser

Reputation: 30947

First man scp is your friend (as are all man pages in general).

  1. Yes: in full, that'd be like scp server:/path/to/file.txt /local/path/.

  2. Your main options here are:

    locate test (if you have locate installed and its database is up to date)

    -or-

    find /path/name -name '*test*' to find any named files inside the /path/name directory and all its children.

Upvotes: 1

Related Questions