MacOS系统使用系列-3.Mac命令行命令学习

来源:互联网 发布:神机妙算软件升级 编辑:程序博客网 时间:2024/05/22 08:17

1.文件查找

find命令

$ find <指定目录> <指定条件> <指定动作>
http://www.ruanyifeng.com/blog/2009/10/5_ways_to_search_for_files_using_the_terminal.html

示例:

$ find ~/code -name '*.py' | head
/Users/chenwenxin/code/arcanist/scripts/breakout.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/__init__.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/__init__.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/__init__.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/__init__.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/Adaline.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/DecisionTree.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/GBDT.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/LogisticRegression.py
/Users/chenwenxin/code/ml/MLP/machielearning-MLP/com/wenxin/mlp/algorithm/Perceptron.py

2.查找钥匙串

command+空格,点开keychain工具,找到想要找的账号的密码,比如wifi密码,右键复制密码到剪切板,然后输入账号密码即可

3.brew

1)安装

ruby -e"$(curl -fsSLhttps://raw.github.com/mxcl/homebrew/go)"

2)使用

搜索
$ brew search science

正则搜索
$ brew search /python*/

列出已安装列表:
$ brew list

4.pip安装scikit-learn

因为brew工具不提供scikit-learn包

示例:

$ brew install scikit-learn

可以通过python库安装工具,pip工具来安装,具体

示例:

Error:No available formula with the name "scikit-learn" 
$ sudo easy_install pip
$ pip install -U scikit-learn

5.python中science包的使用

>>> from sklearn import datasets;
>>> import scipy;
>>> import numpy;
>>> import matplotlib;

6.type命令

type <快捷命令>

示例1:cd命令

$ type cd
cd is a shell builtin

示例2:fuck命令

$ type fuck
fuck is a function
fuck ()
{
    TF_PYTHONIOENCODING=$PYTHONIOENCODING;
    export TF_ALIAS=fuck;
    export TF_SHELL_ALIASES=$(alias);
    export TF_HISTORY=$(fc -ln -10);
    export PYTHONIOENCODING=utf-8;
    TF_CMD=$(
                    thefuck THEFUCK_ARGUMENT_PLACEHOLDER $@
                ) && eval $TF_CMD;
    unset TF_HISTORY;
    export PYTHONIOENCODING=$TF_PYTHONIOENCODING;
    history -s $TF_CMD
}
原创粉丝点击