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语言中,怎么 ...
随机推荐
- mysql 优化修复表
OPTIMIZE TABLE `table_name` 优化表 MyISAM 引擎清理碎片 OPTIMIZE语法: OPTIMIZE [LOCAL | NO_WRITE_TO_BINLOG] TABL ...
- Problem G: STL——整理唱片(list的使用)
#include<iostream> #include<list> #include<iterator> #include<algorithm> usi ...
- python3 tkinter模块
一.tkinter 1.tkinter--tool kit interface工具包接口,用于GUI(Graphical User Interface)用户图形界面, 2.python3.x把Tkin ...
- Ecshop漏洞通杀0day【最新入侵手法】
昨晚上翻阅一本技术书籍中,找到灵感,发现的ECshop漏洞. 搜索关键字:关键字:powered by ecshop 方法一: 普通代码: user.php?act=order_query&o ...
- Mybatis 不支持通配符扫包起别名问题
typeAliasesPackage 默认只能扫描某一个路径下,或以逗号等分割的 几个路径下的内容,不支持通配符和正则,采用重写的方式解决 package com.xxxx.xxx.util.comm ...
- Requset作用域
案例:当登陆密码或账号不正确时 提示 使用Requset对象中的作用域存储数据 语法:req.setAttribute(key, value);//键值对存在 当密码不存在时,设置作用域 else { ...
- postgresql分布式集群之citus简介(转载)
一.Citus是什么 citus是PG的一个sharding插件,可以把PG变成一个分布式数据库.目前在苏宁有大量的生产应用跑在citus+pg的环境中.大家可以看it大咖视频. citus是一款基于 ...
- postgresql 修改用户密码
本文链接:https://blog.csdn.net/pg_hgdb/article/details/79202912如果客户端认证方式为密码验证,那么必然会涉及到修改密码 如何安全地修改密码: ...
- nowcoder73E 白兔的刁难 单位根反演+NTT
感觉很套路? #include <bits/stdc++.h> #define ll long long #define setIO(s) freopen(s".in" ...
- asp.net MVC 使用wifidog 协议实现wifi认证
在网上看到的很多实现的wifidog 协议一般都是PHP 的,了解一下PHP 但是比较喜欢.net ,所以实现了简单的一个进行登录认证的功能 (好多协议中的功能目前没有实现) 1. 开发环境(vs20 ...