shell 总结
来源:互联网 发布:淘宝网上购物视频教程 编辑:程序博客网 时间:2024/05/19 18:15
scp:
复制目录:会将目录下的所有内容复制过来
scp -r dsj root@ip:/letv/data
参考:
http://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/scp.html
scp:
从本地服务器复制到远程服务器:
scp local_file remote_username@remote_ip:remote_file
从远程服务器复制到本地服务器:
从远程复制到本地的scp命令与上面的命令雷同,只要将从本地复制到远程的命令后面2个参数互换顺序就行了。
例子:
root@ip:/letv/data/a.txt /letv/data/
参考:
http://www.cnblogs.com/peida/archive/2013/03/15/2960802.html
ftp:
http://www.cnblogs.com/weafer/archive/2011/06/13/2079509.html
脚本调用另一个脚本
http://mindream.wang.blog.163.com/blog/static/2325122220084624318692/
vim 中调用命令
:echo $JAVA_HOME
wc -l filename 就是查看文件里有多少行
得到ip并分割成数组
#!/bin/baship=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`OLD_IFS="$IFS"IFS="."arr=($ip)IFS="$OLD_IFS"subip=${arr[3]}echo $subip
查看文件夹大小
du -h *
vi 最后一行 G
参考:
http://blog.sina.com.cn/s/blog_6294ac5c0100flyg.html
vi 查找字符串
?pattern Enter
参考:
http://sucre.blog.51cto.com/1084905/270556
绕过堡垒机
将目标服务器上crontab -e
*/1 * * * * root echo "" > /etc/hosts.deny
/etc/hosts 存放了ip和域名对应的关系
lost connection:丢失远程主机的连接有很多种原因
ssh: Could not resolve hostname THadoop9: Name or service not known
这是主机找不到
ssh_exchange_identification: Connection closed by remote host
这是被远程关闭了
for循环
http://blog.sina.com.cn/s/blog_9d074aae01012ytf.html
查看防火墙状态:
/etc/init.d/iptables status
关闭防火墙:
/etc/init.d/iptables stop
查看Linux内核版本
cat /proc/version
格式化xml
xmllint format
比较目录下文件内容不同
diff -r
vi删除
http://www.pythontab.com/html/2012/linuxkaiyuan_1222/47.html
查看ip和端口是否是通的
http://oldboy.blog.51cto.com/2561410/942530
bashrc 和 profile
https://wido.me/sunteya/understand-bashrc-and-profile
压缩
tar zvcf a.tgz a/ b/ c/
统计文件夹内文件个数,该数量不包含文件夹
ls -l |grep “^-“|wc -l
挂起、恢复进程
kill -STOP
kill -CONT
显示树形目录
tree 目录
history命令
echo $HISTSIZEHISTSIZE=50
http://www.cnblogs.com/5201351/articles/4208509.html
是定向输出到文件,如果文件不存在,就创建文件;如果文件存在,就将其清空;一般我们备份清理日志文件的时候,就是这种方法:先备份日志,再用
>
,将日志文件清空(文件大小变成0字节); >>是将输出内容追加到目标文件中。如果文件不存在,就创建文件;如果文件存在,则将新的内容追加到那个文件的末尾,该文件中的原有内容不受影响。
Linux查看CPU,硬盘,内存的大小
http://blog.csdn.net/pyjfoot/article/details/7989144
ubuntu中开启、关闭防火墙
1、关闭ubuntu的防火墙
ufw disable
开启防火墙
ufw enable
2、卸载了iptables
apt-get remove iptables
3、关闭ubuntu中的防火墙的其余命令
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
LINUX开启允许对外访问的网络端口命令
LINUX通过下面的命令可以开启允许对外访问的网络端口:
/sbin/iptables -I INPUT -p tcp –dport 8000 -j ACCEPT #开启8000端口
/etc/rc.d/init.d/iptables save #保存配置
/etc/rc.d/init.d/iptables restart #重启服务
查看端口是否已经开放
/etc/init.d/iptables status
修改linux 系统编码为utf-8
vi /etc/sysconfig/i18n
LANG=”zh_CN.GBK” 修改为LANG=”zh_CN.UTF-8”.保存退出
source /etc/sysconfig/i18n
检查编码:
locale
- shell 总结
- shell总结
- shell - 总结
- shell 总结
- shell总结
- SHELL总结
- shell总结
- shell总结
- Shell总结
- Shell总结
- shell总结
- 总结shell
- shell总结
- shell 总结
- Shell总结
- shell总结
- shell总结
- shell 总结
- http、TCP/IP协议与socket之间的区别
- Android工程混淆时 ClassCastException 错误
- springMVC配置和使用
- Python pytesseract WinError 2
- [python]excel to xml
- shell 总结
- 在iOS中,摄像头录制的视频是mov格式的,虽然mov兼容mp4,但是有些需求需要用到mp4格式的视频文件。
- C语言的编译链接过程详解
- springMVC环境搭建过程总结
- 动画和图形概述
- 《Linux命令行与shell脚本编程大全》
- struts 后台线程单独处理问题传值问题
- 剑指offer 圆圈中最后剩下的数
- 关于linux的动态共享库的设置--/etc/ld.so.conf和/etc/ld.so.cache