Linux Command Line

  • man: 查看命令说明

  • export: 显示所有的环境变量

    • echo $VARIABLE_NAME 获取某个变量的详细信息
    • echo $HOME, /Users/<your-username>
    • printenv, 打印环境变量
  • echo:

    • echo Hello World or echo -ne "Hello\nWorld\n"
    • echo $SHELL
  • whereis 系统自动构建的数据库来搜索可执行文件,源文件和手册页面。

  • which 它在环境变量 PATH 指定的目录中搜索可执行文件。此命令将打印可执行文件的完整路径。

  • clear 清除窗口上的内容。

  • sudo: allows a permitted user to execute a command as the superuser or another user

  • pwd: 当前工作目录

  • ls: 列出您的文件

    • ls -a: 列出所有文件,包括隐藏文件
    • ls -l: 列出“长格式”的文件
    • ls **/* or ls *.js
  • cd: 切换目录

  • mkdir:创建 folder

  • cp: 拷贝(Copy)

    1
    2
    cp source <.|target>
    cp -r src_folder <.|target>
  • mv: 移动文件或重命名

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 将目录/usr/men中的所有文件移到当前目录(用.表示)中:
    mv /usr/men/* .
    # 移动文件
    mv file_1.txt /home/office/
    # 移动多个文件
    mv file_2.txt file_3.txt file_4.txt /home/office/
    mv *.txt /home/office/
    # 移动目录
    mv directory_1/ /home/office/
    # 重命名文件或目录
    mv file_1.txt file_2.txt
    # 重命名目录
    mv directory_1/ directory_2/
  • where: 查找引用

    • where ruby
  • ps: process status. ps aux

  • wget:
    wget 是 linux 上的命令行的下载工具。这是一个 GPL 许可证下的自由软件。wget 支持 HTTP 和 FTP 协议,支持代理服务器和断点续传功能,能够自动递归远程主机的目录,找到合乎条件的文件并将其下载到本地硬盘上;如果必要,wget 将恰当地转换页面中的超级连接以在本地生成可浏览的镜像。由于没有交互式界面,wget 可在后台运行,截获并忽略 HANGUP 信号,因此在用户推出登录以后,仍可继续运行。通常,wget 用于成批量地下载 Internet 网站上的文件,或制作远程网站的镜像。

    • install: brew install wget , about Homebrew
    • wget https://github.wdf.sap.corp/Entitlement/ems-ui-app-entl-mgmt/blob/master/webapp/Component.js
    • wget -d http://192.168.1.168 下载 192.168.1.168 首页并且显示下载信息
    • wget -q http://192.168.1.168 下载 192.168.1.168 首页并且不显示下载信息
    • wget -i filelist.txt 批量下载
    • wget -c http://example.com/really-big-file.iso 断点续传
    • wget -b 后台下载
  • IP and Mac

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    which ifconfig
    /sbin/ifconfig

    ifconfig | grep 192.168

    ifconfig en0 | grep inet | grep -v inet6 | cut -d ' ' -f2
    10.130.227.38

    host 10.130.227.38
    38.227.130.10.in-addr.arpa domain name pointer C02VR4LUHTD8.dhcp.ctul.sap.corp.
  • Copy the contents of the file id_rsa.pub to the clipboard:

    1
    pbcopy < ~/.ssh/id_rsa.pub
  • cat /proc/version kernel version

  • cat /proc/meminfo free and used memory in the system

  • cat /proc/cpuinfo cpu/hardware information

参考

感谢支持,让我安静的做蚂蚁梦!