1 ssh
创新互联建站是一家专业提供大兴企业网站建设,专注与做网站、成都网站制作、HTML5建站、小程序制作等业务。10年已为大兴众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。
$ ssh username@remotehost
用shh登陆服务器。
2、scp
命令scp基于SSH协议,可以将本地文件拷贝到远程服务上的指定目录,格式如下:
$ scp filename username@remotehost:remotedirectory
执行:$ scp ipmsg.log admin@10.25.1.202:/home/admin
3 ftp/sftp
首先用root用户登录远程Linux服务器,将admin用户添加到FTP账户中。
通过echo命令追加一行到user_list文件中:# echo admin user_list
之后通过service命令开启FTP服务:# service vsftpd start
现在就可以在本机访问FTP远程服务器了,然后通过put命令上传文件了。
4 SSH Windows Client
SSH提供了一个scp2.exe作为Windows下的scp命令工具。
题主你好,
从服务器上下载文件或向服务器上传文件最常用的命令当属scp了,使用方法也简单.
一.先说题主问题中的情况,即从服务器上往回拿文件(官话一点的表达:从服务器上将文件下载到本地):
scp 服务器用户名@服务器ip:文件的绝对路径 要将文件保存到本地哪
举例来说,我的服务器地址是1.1.1.1,用户名为hellofriend,并且在服务器上的/home/hellofriend/下有个名为ok的文件,则我想将服务器上的这个ok文件下载到本地的根目录,/,下用到的命令为:
scp hellofriend@1.1.1.1:/home/hellofriend/ok /
命令执行完成后,会提示你输入hellofriend这个用户的密码,密码输入完成后,回车,正常情况下,你在根目录下就能看到ok文件了.
*.新手注意事项:
a.ip地址和文件路径中间有个冒号;
b.文件路径一般用绝对路径,即从根开始找;
c.不要忘了写你要将文件保存在本地的哪里;
-----
二.再说如何将本地文件上传到服务器,这个不细说,命令和上面的差不多:
scp 本地的文件路径 服务器用户名@服务器ip:要保存在服务器的哪个位置
如我要将本地根目录下的ok文件上传到1.1.1.1这台服务器的/home/hellofriend目录下,则命令为:
scp /ok root@1.1.1.1:/home/hellofriend/
执行命令后,输入密码,回车,正常情况下文件就上传成功了.
-----
写在最后: 上面命令写的其实相对死板一些,其实还有一些小技巧,题主用的多了就能了解了,这里先不过多展开.
=====
希望可以帮到题主, 欢迎追问.
在下边图示位置粘贴授权码,耐心等待一会即可(1-2分钟)
授权成功。
测试上传和同步本地文件到云盘
由于百度PCS API权限限制,程序只能存取百度云端/apps/bypy目录下面的文件和目录。我们可以通过:
你是你是要通过git命令上传东西,还是想上传git到服务器上面,你可以先通过yum安装git
# yum install git
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds linuxprobe.com from cached hostfile
base | 3.7 kB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:05
extras | 3.4 kB 00:00
hhvm | 2.9 kB 00:00
shells_fish_release_2 | 1.2 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 821 kB 00:01
upgrade | 1.9 kB 00:00
virtualbox/signature | 181 B 00:00
virtualbox/signature | 1.1 kB 00:00 ...
包 git-1.7.1-8.el6.x86_64 已安装并且是最新版本
无须任何处理
#git --help
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help COMMAND' for more information on a specific command.
下面我给介绍一种从本地上传到服务器的命令:
命令rz和sz命令,首先你需要安装lrzsz库
#rz --help
rz version 0.12.20
Usage: rz [options] [filename.if.xmodem]
Receive files with ZMODEM/YMODEM/XMODEM protocol
(X) = option applies to XMODEM only
(Y) = option applies to YMODEM only
(Z) = option applies to ZMODEM only
-+, --append append to existing files
-a, --ascii ASCII transfer (change CR/LF to LF)
-b, --binary binary transfer
-B, --bufsize N buffer N bytes (N==auto: buffer whole file)
-c, --with-crc Use 16 bit CRC (X)
-C, --allow-remote-commands allow execution of remote commands (Z)
-D, --null write all received data to /dev/null
--delay-startup N sleep N seconds before doing anything
-e, --escape Escape control characters (Z)
-E, --rename rename any files already existing
--errors N generate CRC error every N bytes (debugging)
-h, --help Help, print this usage message
-m, --min-bps N stop transmission if BPS below N
-M, --min-bps-time N for at least N seconds (default: 120)
-O, --disable-timeouts disable timeout code, wait forever for data
--o-sync open output file(s) in synchronous write mode
-p, --protect protect existing files
-q, --quiet quiet, no progress reports
-r, --resume try to resume interrupted file transfer (Z)
-R, --restricted restricted, more secure mode
-s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds
-S, --timesync request remote time (twice: set local time)
--syslog[=off] turn syslog on or off, if possible
-t, --timeout N set timeout to N tenths of a second
-u, --keep-uppercase keep upper case filenames
-U, --unrestrict disable restricted mode (if allowed to)
-v, --verbose be verbose, provide debugging information
-w, --windowsize N Window is N bytes (Z)
-X --xmodem use XMODEM protocol
-y, --overwrite Yes, clobber existing file if any
--ymodem use YMODEM protocol
-Z, --zmodem use ZMODEM protocol
short options use the same arguments as the long ones
#sz --help
sz version 0.12.20
Usage: sz [options] file ...
or: sz [options] -{c|i} COMMAND
Send file(s) with ZMODEM/YMODEM/XMODEM protocol
(X) = option applies to XMODEM only
(Y) = option applies to YMODEM only
(Z) = option applies to ZMODEM only
-+, --append append to existing destination file (Z)
-2, --twostop use 2 stop bits
-4, --try-4k go up to 4K blocksize
--start-4k start with 4K blocksize (doesn't try 8)
-8, --try-8k go up to 8K blocksize
--start-8k start with 8K blocksize
-a, --ascii ASCII transfer (change CR/LF to LF)
-b, --binary binary transfer
-B, --bufsize N buffer N bytes (N==auto: buffer whole file)
-c, --command COMMAND execute remote command COMMAND (Z)
-C, --command-tries N try N times to execute a command (Z)
-d, --dot-to-slash change '.' to '/' in pathnames (Y/Z)
--delay-startup N sleep N seconds before doing anything
-e, --escape escape all control characters (Z)
-E, --rename force receiver to rename files it already has
-f, --full-path send full pathname (Y/Z)
-i, --immediate-command CMD send remote CMD, return immediately (Z)
-h, --help print this usage message
-k, --1k send 1024 byte packets (X)
-L, --packetlen N limit subpacket length to N bytes (Z)
-l, --framelen N limit frame length to N bytes (l=L) (Z)
-m, --min-bps N stop transmission if BPS below N
-M, --min-bps-time N for at least N seconds (default: 120)
-n, --newer send file if source newer (Z)
-N, --newer-or-longer send file if source newer or longer (Z)
-o, --16-bit-crc use 16 bit CRC instead of 32 bit CRC (Z)
-O, --disable-timeouts disable timeout code, wait forever
-p, --protect protect existing destination file (Z)
-r, --resume resume interrupted file transfer (Z)
-R, --restricted restricted, more secure mode
-q, --quiet quiet (no progress reports)
-s, --stop-at {HH:MM|+N} stop transmission at HH:MM or in N seconds
--tcp build a TCP connection to transmit files
--tcp-server open socket, wait for connection
-u, --unlink unlink file after transmission
-U, --unrestrict turn off restricted mode (if allowed to)
-v, --verbose be verbose, provide debugging information
-w, --windowsize N Window is N bytes (Z)
-X, --xmodem use XMODEM protocol
-y, --overwrite overwrite existing files
-Y, --overwrite-or-skip overwrite existing files, else skip
--ymodem use YMODEM protocol
-Z, --zmodem use ZMODEM protocol
short options use the same arguments as the long ones
More information can be used for reference linuxprobe.com。
在 Linux 系统提示符 $ 下,使用 ftp 命令,如下所示:
$ftp a.b.c.d cr (其中:a.b.c.d 为假设的一个对方的 FTP 服务器的 IP 地址)
如果是对方的 FTP 服务器允许别人进行匿名访问的话,那么用户名就是:anonymous,密码一般为空。否则的话,就需要输入对方提前事先提供给你的用户名和密码才能够进行文件传输。
使用约定好的用户名和密码登录到对方的 FTP 服务器之后,你就可以使用 put(传输单个文件)、或者 mput(传输多个文件)、get(从对方的FTP服务器上获取单个文件)、mget(从对方的FTP服务器上获取多个文件)了。当然了,一般 FTP 服务器的系统管理员都会给你一个 /pub 子目录,供所有用户使用。所以一般来说,即使使用账号登录 FTP 服务器之后,第一个命令就是: cd /pub ,转入公共子目录。