linux上传命令行 linux命令行传输文件

Linux运维命令Curl - 日常用法总结

在Linux系统中,curl是一个利用URL规则在命令行下工作的文件传输工具,可以说是一款很强大的http命令行工具。它支持文件的上传和下载操作,是综合传输工具,习惯上称url为下载工具。下面就日常运维中基于curl命令使用做下总结

网站建设哪家好,找成都创新互联公司!专注于网页设计、网站建设、微信开发、成都微信小程序、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了爱辉免费建站欢迎大家使用!

一、Curl命令用法

1. curl语法和参数选项

# curl [option] [url]

curl常见参数

2. curl使用说明

curl是一种命令行工具,作用是发出网络请求,然后得到和提取数据,显示在"标准输出"(stdout)上面。它支持多种协议,下面说下curl命令的日常使用示例:

3. curl上传文件的用法(POST请求方式)

一般来说,我们都会用curl下载网页,但是curl上传文件则不常用。下面说下curl模拟"multipart/form-data"形式的form上传文件, 命令稍稍复杂些。

4. curl常用示例

5. curl命令的超时时间

二、Curl的GET、POST、PUT、DELETE请求

1. GET、POST、PUT、DELETE含义与区别

2. GET、POST、PUT、DELETE四种请求方式的curl访问

请问linux下的工具rz可以只使用命令行进行上传吗?命令是什么?就是不用窗口选择文件,只命令行输入文件名

我只在windows下用xmanager远程连接时用过rz。

在命令行,用scp就行了,很方便。

Linux命令行上传文件到百度网盘

在下边图示位置粘贴授权码,耐心等待一会即可(1-2分钟)

授权成功。

测试上传和同步本地文件到云盘

由于百度PCS API权限限制,程序只能存取百度云端/apps/bypy目录下面的文件和目录。我们可以通过:

linux中,有哪些命令是比较好用的呢?

1.列出文件清单命令:ls

ls命令能够列出当前目录下的所有内容。ls 命令的执行方式为:

# ls [-选项] [文件名或者目录名]

进入到Linux命令行中后,我们至少要知道当前所处的位置有哪些内容,这些信息就可以使用ls命令来获得。

在Linux中,ls命令是最常使用的命令之一,因为在命令行下要随时查看目录内容。如果不加任何选项的话,ls命令仅列出当前目录下的文件和目录名,例如,想要查看/etc目录下的内容,可以使用下列命令:

# ls /etc

如果想要列出当前目录下所有文件,则可以使用下列命令:

# ls -a

2、cat命令

功能:在标准输出上显示文件。

语法:cat [-vTEuAte] 文件

例子: cat example.txt

cat -A exam2.txt

cat file1 file2 file2

3、more命令

功能:在终端屏幕按屏显示文本文件。

语法: more [-pcdls] 文件

例子: more example.c

more -dc example.c

more -c -10 example.c

4、less命令

less命令的功能几乎和more命令一样,也是用来按页显示文件,不同之处在于less命令在显示文件时允许用户既

可以向前又可以向后翻阅文件。

5、head命令

功能:显示指定文件的前若干行。缺省设置为显示10行

语法:head [-n] 文件

例子: head example.c

head -3 example.c

6、tail命令

功能:显示指定文件的末尾若干行。缺省设置为显示10行

语法:tail [+ / - num ] [参数] 文件

+num 从第num行以后开始显示。- num 从距文件尾num行处开始显示。

例子: tail example.c

tail -4 example.c

7、grep、fgrep和egrep命令

功能:

这组命令以指定模式搜索文件,并通知用户在什么文件中搜索到与指定的模式匹配的字符串,并打印出所有包含该字符串的文本行,在该文本行的最前面是该行所在的文件名。grep命令一次只能搜索一个指定的模式;egrep命令检索扩展的正则表达式(包括表达式组和可选项);fgrep命令检索固定字符串,它不识别正则表达式,是快速搜索命令。

语法:

grep [-EFbcihlnvxef] [查找模式] [文件名1,文件名2,……]

egrep [选项] [查找模式] [文件名1,文件名2,……]

fgrep [选项] [查找模式] [文件名1,文件名2,……]

例子: grep "text file" example

grep data *

grep goto *.c

怎样通过命令行给linux传输文件

怎样通过命令行给linux传输文件,方法如下

一、从服务器下载文件到本机

1、修改文件所属

由于只能下载文件所属为自己的文件,所以要做修改文件所属的操作。

chown hudelei /opt/logs/tomcat/app/tomcat_stk_nm/stk-time.log

2、下载到本机

scp hi@10.10.30.10:/opt/logs/tomcat/app/tomcat_stk_nm/stk-time.log /Users/hvvi/Desktop

3、输入密码

二、上传文件夹到服务器

1、scp -r /Users/hddvvi/Desktop/load hi@10.10.30.10:/opt/logs/tomcat/app/tomcat_stk_nm/

注意:加上 -r,否则会报错:not a regular file

2、输入密码3、文件移动上上层 mv filename.java 。。/

注:本文使用的是mac本机和linux服务器。

linux怎样命令行上传git

你是你是要通过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上传命令行 linux命令行传输文件
网站路径:https://www.cdcxhl.com/article32/dodhhsc.html

成都网站建设公司_创新互联,为您提供网站维护商城网站网站排名网站内链品牌网站制作微信小程序

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

绵阳服务器托管