web-linux-shell实现 阿里方案canvas+wss。
wss://shell.aliyun.com/terminals?cols=92&rows=35
- [root@webshell ~]# python
- Python 3.6.8 (default, Apr 25 2019, 21:02:35)
- [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import subprocess
- >>> output = subprocess.Popen(['ls','-l'],stdout=subprocess.PIPE,shell=True).communicate()
- >>> output = subprocess.Popen(['free ','-g'],stdout=subprocess.PIPE,shell=True).communicate()
- >>> output
- (b' total used free shared buff/cache available\nMem: 3880404 988888 118752 25140 2772764 2561112\nSwap: 0 0 0\n', None)
- >>> output = subprocess.Popen(['tree /'],stdout=subprocess.PIPE,shell=True).communicate()
- ^CTraceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "/usr/lib64/python3.6/subprocess.py", line 850, in communicate
- stdout = self.stdout.read()
- KeyboardInterrupt
- >>>
- KeyboardInterrupt
- >>>
- KeyboardInterrupt
- >>> output = subprocess.Popen(['top'],stdout=subprocess.PIPE,shell=True).communicate()
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- File "/usr/lib64/python3.6/subprocess.py", line 850, in communicate
- stdout = self.stdout.read()
- KeyboardInterrupt
- >>>
- KeyboardInterrupt
- >>> output = subprocess.Popen(['ls'],stdout=subprocess.PIPE,shell=True).communicate()
- >>> output
- (b'config.json\nnohup.out\nnpm-debug.log\npkgTmp\n', None)
- >>> output = subprocess.Popen(['ll'],stdout=subprocess.PIPE,shell=True).communicate()
- /bin/sh: ll: command not found
- >>> output = subprocess.Popen(['ls','-l'],stdout=subprocess.PIPE,shell=True).communicate()
- >>> output[0]
- b'config.json\nnohup.out\nnpm-debug.log\npkgTmp\n'
- >>> output = subprocess.Popen(['tree','./pkgTmp/'],stdout=subprocess.PIPE,shell=True).communicate()
- >>> output[0]
- b'.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 config.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 nohup.out\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 npm-debug.log\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pkgTmp\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 mysql57-community-release-el7-10.noarch.rpm\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Python-3.7.4.tgz\n\n1 directory, 5 files\n'
- >>> output[0].decode('utf-8')
- '.\n├── config.json\n├── nohup.out\n├── npm-debug.log\n└── pkgTmp\n ├── mysql57-community-release-el7-10.noarch.rpm\n └── Python-3.7.4.tgz\n\n1 directory, 5 files\n'
- >>>
- [root@webshell ~]# tree ./pkgTmp/
- ./pkgTmp/
- ├── mysql57-community-release-el7-10.noarch.rpm
- └── Python-3.7.4.tgz
- 0 directories, 2 files
- [root@webshell ~]#
https://www.cnblogs.com/snow-backup/p/5035792.html
web-linux-shell实现 阿里方案canvas+wss。的更多相关文章
- 阿里Linux Shell脚本面试25个经典问答
转载: 阿里Linux Shell脚本面试25个经典问答 Q:1 Shell脚本是什么.它是必需的吗? 答:一个Shell脚本是一个文本文件,包含一个或多个命令.作为系统管理员,我们经常需要使用多个命 ...
- Linux云主机 监控方案浅析
1.为何需要监控 监控是运维工程师的眼睛,它可帮助运维工程师第一时间发现系统的问题. 对于服务器的整个生命周期,都要和监控打交道: 当有服务器上架,都需要加入比如CPU负载.内存.网络.磁盘等基础监控 ...
- Linux Shell脚本攻略 读书笔记
Linux Shell脚本攻略 读书笔记 这是一本小书,总共253页,但内容却很丰富,书中的示例小巧而实用,对我这样总是在shell门前徘徊的人来说真是如获至宝:最有价值的当属文本处理,对这块我单独整 ...
- Linux Shell脚本教程
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...
- 【转】Awk 命令学习总结、AWk命令系列学习(linux shell)
前面的话 学习linux 的同人,都知道linux shell文本处理能力非常强大.有一组强大的文本处理工具:grep,sed,awk . 其中grep 经常用作查找匹配文本.sed用作文本编辑替换. ...
- 读《Linux Shell脚本攻略》(第2版) 总结
前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 说下这本书的难度吧.纯新手或者只懂少部分编程知识的人,读起来还是有很大难度的.以我为 ...
- laravel项目使用appnode部署linux系统到阿里云服务器流程记录(待补充)
使用 SSH 连接工具,如 PuTTY.XShell.SecureCRT 等,连接 Linux 服务器后(阿里云服务器命令行内直接输入appnode安装命令,版本:mysql选5.7.php选7.2) ...
- 读《Linux Shell脚本攻略》(第2版) 一遍、二遍体会
前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 第一遍体会解读:就像黑夜中的灯塔,指明前进的道路. 推荐指数:强烈推荐. 书中讲解的 ...
- Awk 命令学习总结、AWk命令系列学习(linux shell)
AWK基本语法 下面没有提到awk命令怎么使用了,你可以通过 运行:awk –h 查询到所有命令及参数!下面把awk作为一门语言分节介绍. linux awk 内置变量使用介绍 awk语言中,怎么 ...
随机推荐
- 爬虫之post请求与请求传参
一.POST请求 class Postspider(scripy.Spider): name = "post" # allowed_domains = ["www.xxx ...
- (多核DSP快速入门)SYS/BIOS入门
(多核DSP快速入门)SYS/BIOS入门 原创文章 转载请注册来源http://blog.csdn.net/tostq 系列教程目录:http://blog.csdn.net/tostq/art ...
- php与ajax技术
web2.0的到来,ajax逐渐成为主流,什么是ajax,ajax的开发模式,优点,使用技术.(ajax概述,ajax使用的技术,需要注意的 问题,在PHP应用ajax技术的应用) 什么是ajax,a ...
- Linux 绑定 ttyUSBn 串口方法。
Linux 绑定 ttyUSBn 串口方法. 在linux下, 使用usb转串口, 经常会碰到一个问题: 如果有多个串口, 以不同顺序插入的时候, /dev/ttyUSB0 /dev/ttyUSB1的 ...
- 个人第5次作业:Alpha2项目的测试
这个作业属于哪个课程 <课程的链接> 这个作业要求在哪里 <作业要求的链接> 名字 易林 学号 201731062134 团队名称 <巧克力王子和六个小矮人> 第一 ...
- 大量javascript代码的项目如何改善可维护性
项目中有点javascript文件,javascript代码行数达到7000多行,维护很费力,主要体现在以下几个方面: 1,方法没有注释,没有注释方法的作用,从上到下罗列,很难知道这个方法应该啥时候调 ...
- 【转】Guava cache使用总结
缓存分为本地缓存和远端缓存.常见的远端缓存有Redis,MongoDB:本地缓存一般使用map的方式保存在本地内存中.一般我们在业务中操作缓存,都会操作缓存和数据源两部分.如:put数据时,先插入DB ...
- Java精通并发-多线程同步关系实例剖析与详解
在上一次https://www.cnblogs.com/webor2006/p/11422587.html中通过实践来解了一个案例,先来回顾一下习题: 编写一个多线程程序,实现这样的一个目标: 1.存 ...
- 《The One!团队》第八次作业:ALPHA冲刺(三)
项目 内容 作业所属课程 所属课程 作业要求 作业要求 团队名称 < The One !> 作业学习目标 (1)掌握软件测试基础技术.(2)学习迭代式增量软件开发过程(Scrum) 第三天 ...
- JanusGraph 创建索引步骤(composite index)踩坑总结
前言 JanusGraph是一个图数据库引擎,安装及入门可以参考 JanusGraph 图数据库安装小记.为了提高查询速度,在使用过程中一般要为某些属性创建索引.这篇随笔主要是记录创建索引过程中踩过的 ...