zoukankan      html  css  js  c++  java
  • IPython使用UNIX的Shell

    1:alias:别名

    alias nss netstat -lptn

    nss

    结果....

    nss | grep 80

    alias achoo echo "|%1|"

    achoo

    结果:||

    achoo these ar args

    |these are args|

    store achoo可以将别名存放起来,下次继续使用

    2:直接执行

    使用叹号可以直接执行。

    !netstat -lptn

    传递参数的方法:使用$符号

    user="jmjones"

    process="bash"

    !ps aux | grep $user |grep &precess

    3:rehash

    __IP.alias_table

    len(__IP_alias_table)

    rehash

    4:cd pwd等命令可以直接使用

    dihist 访问历史记录

    cd -也可

    5:可变扩展

    for i in range(10):

            !data>${i}.txt

    创建十个txt文件,并将时间记录到这些文件中

    6:字符串处理

    import os

    file_list=!ls

    file_list.grep(os.path.isfile)#过滤掉目录

    输出结果:

    ...

    file_list.grep(os.path.isfile).fields(0,1)#输出第一二列

  • 相关阅读:
    C++命名法则
    腾讯附加题---递归
    决策树
    ubuntu16.04安装后干的事
    node
    iview datetime日期时间限制
    GitLab CI/CD
    本地项目上传到github
    npm--配置私服
    gitlab添加yml文件.gitlab-ci.yml
  • 原文地址:https://www.cnblogs.com/macula7/p/1960726.html
Copyright © 2011-2022 走看看