- FTP:ftp传输方法使用透明密码,因此不安全。ftp在shell中传输文件非常方便,因为它不需要交互式登录
不管SCP还是SFTP,都是SSH的功能之一。都是使用SSH协议来传输文件的。
不用说文件内容,就是登录时的用户信息都是经过SSH加密后才传输的,所以说SCP和SFTP实现了安全的文件传输。
- SFTP SFTP的功能则比较多。
- SCP比较简单,是轻量级的,SCP可以方便地传输目录和子目录
- sshpass sshspass可以避免交互模式。所以在shell使用非常方便。另外,它是一种安全的转移方法。sshspass可用于轻松传输目录和文件。
ssh & telnet的区别
1)telnet使用透明密码,因此不安全
2)对于Linux,ssh包由默认,但Telnet需要安装额外的包。telnet & nc
两个命令都可以检测对方服务器TCP端口是否正在侦听,例如,检测22端口: - 端口进程查询命令–netstat&lsof
压缩文件:tar ,gzip
- 如何使用tar(仅包装,不压缩尺寸)
root@lhctest[/root/test]#tar -cvf b.tar b.txt b.txt root@lhctest[/root/test]#ls -l b.* -rw-r--r-- 1 root root 10240 Jun 18 23:57 b.tar -rw-r--r-- 1 root root 0 Jun 12 18:55 b.txt
- 如何压缩(compress b.tar)
root@lhctest[/root/test]#gzip b.tar root@lhctest[/root/test]#ls -l b.* -rw-r--r-- 1 root root 115 Jun 18 23:57 b.tar.gz -rw-r--r-- 1 root root 0 Jun 12 18:55 b.txt root@lhctest[/root/test]#
- 如何同时打包和压缩:
root@lhctest[/root/test]#ls -l b.* -rw-r--r-- 1 root root 0 Jun 12 18:55 b.txt root@lhctest[/root/test]#tar -zcvf b.tar.gz b.txt b.txt root@lhctest[/root/test]#ls -l b.* -rw-r--r-- 1 root root 109 Jun 19 00:01 b.tar.gz -rw-r--r-- 1 root root 0 Jun 12 18:55 b.txt
- 如何解压tar文件
root@lhctest[/root/test]#tar -xvf b.tar b.txt root@lhctest[/root/test]#
-如何解压gzip文件
root@lhctest[/root/test]#gunzip b.txt.gz root@lhctest[/root/test]#ls -l b.* -rw-r--r-- 1 root root 0 Jun 12 18:55 b.txt
- 如何解压tar.gz包
root@lhctest[/root/test]#tar -zxvf b.tar.gz b.txt root@lhctest[/root/test]#
- 如何压缩和解压缩zip包
root@lhctest[/root/test]#zip b.zip b.txt adding: b.txt (stored 0%) root@lhctest[/root/test]#unzip b.zip Archive: b.zip extracting: b.txt
which & ldd
- 用于显示shell命令的完整路径:
root@lhctest[/root/test]#which telnet /usr/bin/telnet root@lhctest[/root/test]#
- ldd打印指定的每需的共享库
在命令行上
root@lhctest[/root/test]#ldd /usr/bin/telnet linux-vdso.so.1 => (0x00007ffdaa727000) libutil.so.1 => /lib64/libutil.so.1 (0x00007f5a5ac45000) libncurses.so.5 => /lib64/libncurses.so.5 (0x00007f5a5aa23000) libc.so.6 => /lib64/libc.so.6 (0x00007f5a5a68e000) libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f5a5a46d000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f5a5a269000) /lib64/ld-linux-x86-64.so.2 (0x00000036be800000) root@lhctest[/root/test]#