After I log in with the terminal under mac, I feel worried when I want to upload a file. Is it possible to open an ftp?
I searched, and sure enough, there is a direct command line tool, the name is SCP
It is used as follows:
1. Upload the local file to the server
scp /path/filename username@servername:/path/
For example, scp /var/www/test.php [email protected]:/var/www/ upload the test.php file in the /var/www/ directory of the local machine to /var/www on the server 192.168.0.101 / directory
2. Download the file from the server
We often use wget to download files, but if there is no http service, how to download files from the server?
scp username@servername:/path/filename / var/www/local_dir (local directory)
For example, scp [email protected]:/var/www/test.txt downloads the file /var/www/test.txt on 192.168.0.101 to /var/www/local_dir (local directory)
3. Download the entire directory from the server
scp -r username@servername:/ var/www/remote_dir/ (remote directory) / var/www/local_dir (local directory)
For example: scp -r [email protected]:/var/www/test /var/www/
4. Upload the directory to the server
scp -r local_dir username@servername:remote_dir
For example: scp -r test [email protected]:/var/www/ Upload the test directory in the current directory to the /var/www/ directory of the server