一、使用工具:xshell、linux redhat。
站在用戶的角度思考問題,與客戶深入溝通,找到豐林網(wǎng)站設計與豐林網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術結合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都做網(wǎng)站、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、國際域名空間、網(wǎng)絡空間、企業(yè)郵箱。業(yè)務覆蓋豐林地區(qū)。
二、上傳步驟:
1、連接設置(linux客戶端)
2、linux服務器端設置
在linux主機上,安裝上傳下載工具包rz及sz;?如果不知道你要安裝包的具體名稱,可以使用yum provides */name
進行查找系統(tǒng)自帶軟件包的信息;
一般會列出軟件包的名稱及版本,還有安裝路徑;查詢到軟件包名后,使用yum
install -y 包名 進行安裝。
lrzsz包安裝完成后包括上傳rz、下載sz命令;只需要安裝這個包即可。
[root@localhost src]# yum install -y lrzsz
3、從Windows上傳文件,上傳命令為rz;在Linux命令行下輸入rz,上傳的文件在當前命令行的目錄下;
[root@localhost src]# rz
輸入rz命令后,會彈出對話框,選擇你要上傳的文件,選擇打開就上傳到Linux主機。上傳完可以使用ls
查看;
4、從Linux主機下載文件,下載命令為sz
,后面跟要下載的文件名;可以選擇下載的保存文件夾;
[root@xyx-vsver01 webapps]# sz 文件名稱
三、注意事項:
1.正確填寫用戶名和密碼;
2.在ZMODEM 添加上圖設置
Linux服務器應該開放了ssh服務的,這樣方便遠程管理,可以利用ssh服務上傳文件的,用ssh服務上傳文件時的權限,和你用ssh遠程登錄的那個用戶的權限是一樣的,這樣就不用考慮權限設置的問題。下面是上傳文件的方法:如果你的本地電腦是Linux系統(tǒng),可以打開終端,不需要登錄Linux服務器,直接用scp命令上傳文件。scp命令是scp協(xié)議的命令,scp協(xié)議就是利用ssh連接來傳輸文件的一個協(xié)議。使用scp命令時需要將登錄的用戶名作為它的參數(shù)(參數(shù)的一部分),接著scp命令會提示你輸入登錄密碼,如果連接成功就會直接傳輸文件了。scp命令的具體用法可以自行百度一下,很簡單的,就不介紹了。 如果你的本地電腦是Windows就更好辦了,可以安裝一個WinSCP,這個軟件是免費的,打開WinSCP軟件,要選擇scp協(xié)議,然后輸入ssh登錄的用戶名和密碼,連接成功后,WinSCP軟件界面的左邊是本地文件,右邊是Linux的目錄,然后就能隨便上傳文件到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服務器。
你是你是要通過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。