(server
主機172.25.254.101
,client
主機172.25.254.201)
系統中的檔案傳輸
一、基於sshd服務的scp遠端傳輸命令:
1、將server
端桌面下的
fig目錄上傳到
client
主機的桌面上。
這裡使用了client
主機的sshd
服務。[root@server1 desktop]# scp -r /root/desktop/fig/ [email protected]:/root/desktop/
[email protected]'s password:
[root@client1 desktop]# pwd
/root/desktop
[root@client1 desktop]# ls
fig2、在
client
server
端的fid
目錄到當前目錄。
這裡使用了server
主機的sshd
服務。[root@client1 mnt]# scp -r [email protected]:/mnt/fid/ .
[email protected]'s password:
[root@client1 mnt]# ls
fid-r
。tip2:
scp 二、rsync同步傳輸
rsync [引數] file username@ip:/dir
rsync -r ##同步目錄
-l ##不忽略鏈結
-p ##不忽略檔案許可權
-t ##不忽檔案時間戳
-g ##不忽檔案所有組
-o ##不忽檔案所有人
-d ##不忽略裝置檔案
tip:用rsync -r同步目錄時候發現未和scp一樣把目錄中的鏈結對應的檔案也傳輸過去
[root@server1 mnt]# rsync -r /etc [email protected]:/mnt/ #將/etc目錄同步到client1主機/mnt/下
tip:注意這裡:/etc後面加『/』和不加『/』是有區別的:不加『/』會將/etc目錄本身同步過去,加上『/』則只會將/etc這個目錄下的所有檔案同步過去而不包含etc目錄名本身
[root@server1 mnt]# du -sh /etc/
33m /etc/
[root@client1 mnt]# ls
etc[root@client1 mnt]# du -sh /mnt/etc/
33m /mnt/etc/
測試:1.建立一些特徵檔案
[root@server1 mnt]# touch /mnt/file
[root@server1 mnt]# ln -s /mnt/file5 /mnt/vaon
[root@server1 mnt]# chmod 777 /mnt/*
[root@server1 mnt]# chown server1.server1 /mnt/*
[root@server1 mnt]# ls -l
總用量 0
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file1
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file2
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file3
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file4
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file5
lrwxrwxrwx. 1 root root 10 10月 25 11:20 vaon -> /mnt/file5
2.執行同步
[root@server1 mnt]# rsync /mnt/ -rlptgo [email protected]:/mnt
[email protected]'s password:
[root@client1 mnt]# ll
總用量 0
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file1
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file2
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file3
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file4
-rwxrwxrwx. 1 server1 server1 0 10月 25 11:20 file5
lrwxrwxrwx. 1 root root 10 10月 25 11:20 vaon -> /mnt/file5
現在在client1端檢視同步過來的檔案屬性、時間、所屬使用者、許可權等和server1端的都是一樣的,這是scp做不到的。
3.同步裝置檔案
一般裝置檔案是不能傳輸的,但可以加上-d引數同步
[root@server1 mnt]# rsync -r /dev/pts [email protected]:/mnt/
[email protected]'s password:
skipping non-regular file "pts/0"
skipping non-regular file "pts/ptmx"
[root@server1 mnt]# rsync -rd /dev/pts [email protected]:/mnt/
[email protected]'s password:
[root@client1 mnt]# ls
file1 file2 file3 file4 file5 pts vaon
[root@client1 mnt]# ll pts/
總用量 0
crw-------. 1 root root 136, 0 10月 25 12:05 0
c---------. 1 root root 5, 2 10月 25 12:05 ptmx
一般系統中的檔案傳輸都會配合tar、zip等打包、壓縮使用以加快傳輸效率。
linux中的定時系統
修改 etc crontab,將游標移動至最後一行,按o鍵新開一行輸入以下內容 20 root rm rf root febhost dat root febhost log 給你解釋下此行的含義吧,前五個以4個空格分隔開的值依次表示 分 時 日 月 周,如果取所有值就是打 號,如果你想週期性的執行...
Linux系統中的訊號
訊號 signal 是linux系統中用於程序之間相互通訊或操作的一種機制。訊號是乙個相當廣泛的課題 在這裡,我們僅僅 幾種最重要的訊號以及利用訊號控制程序的技術。訊號是乙個傳送到程序的特殊資訊。訊號機制是非同步的 當乙個程序接收到乙個訊號時,它會立刻處理這個訊號,而不會等待當前函式甚至當前一行 結...
linux系統中的時間
朱老師物聯網大講堂 學習筆記 linux系統中的時間,jiffies的引入,是linux核心中的乙個全域性變數,記錄核心節拍時間的數值,核心在開機啟動的時候會讀取rtc獲取乙個時間作為基準值,這個基準時間對應乙個jiffies jiffies值的獲取方式是rtc時間減去1970 01 01 00 0...