• Unix commands in Mac OS X


    参考:http://www.renfei.org/blog/mac-os-x-terminal-101.html

    One command line includes 4 parts: Command Name、Options、Arguments、Extras . 

    man <command-name> :  Give the manual of this command.

    绝对和相对路径

         / : Root directory

         ..  : Parent directory. 

    目录操作

         pwd : Print working directory, which will show the absolute path of current folder.

         ls  : List directory contents.      Ls –la  : List all contents including hidden contents.

         cd : Change directory.

       mkdir : Make directories.

         rmdir:  Remove directories.

       mvdir:  Move or rename a directory.

          处理特殊字符(space, bracket, quotation mark, !, $, &, *, ;, \, …)

           : Use back slash before the character.        cd Punlic/Drop Box/      ( = cd “Public/Drop Box”).

    文件操作

          cp  : Copy files.  

          mv : Move files.

          rm :  Remove files

          vi:  or vim :  A programmers text editor

          nano:  Nano's another editor, an enhanced free pico clone.

        cat : Concatenate and print files.  It reads files sequentially, writing them to the standard output.

                   cat file1 : Will print the contents of file1 to the standard output.

                   cat file1 file2 > file3:  Will sequentially print the cntents of file1 and file2 to the file3.

                   cat file1 – file2 – file3:   ???

          od:  Octal, decimal, hex, ASCII dump

          less:

          which:  Locate a program file in the user’s path.

          find :   find . -name "*.c" -print

        file:  Determine file type. 

          head:  Display first lines of a file.  head -10 filename.

      tail:  Display the last part of a file. 

          cut:  Cut out selected portions of each lie of a flie.

          colrm:  Remove columns from a file.    colrm 8 20 filename

          diff: Compare files line by line.

          sort: Sort lines of text file.       

          uniq:  Report or filter out repeated lines in a file.

          comm: Select or regject lines common to two files.

          wc:  Word, line, character, and byte count.  

          nl: Line numbering filter.        nl file1 > file2

    进程操作

      ps : Process status     ps u

      kill : Terminate or signal a process.               kill -9 30142

                 The kill utility sends a signal to the processes specified by the pid operand(s).

         Only the super-user may send signals to other user's processes.

                 Some of the more commonly used signals:

          1  HUP (hang up)

          2  INT (interrupt)

          3  QUIT

          6   ABRT (abort)

          9  KILL (non-catchable, non-ignorable kill)

          14   ALRM (alarm )

          15  TERM (software termination signal)

    时间操作: 

      date:  Display or set date and time.

      cal:  Display a calendar and the date of easter        cal 4 2015.   

          time: time command execution (totoal time elapsed.)

           

    系统管理

          w:  Display who is logged in and what they are doing.

      who

          whoami

          su  : Substitute user identify. 

          Sudo : Substitute user do, or super user do.  It allows a permitted user to execute a command as the superuser or another user.

  • 相关阅读:
    Jenkins常见的构建触发器
    NTP服务器搭建
    Jenkins钉钉通知
    Jenkins邮件通知
    升级到k8s的17.0出现问题
    推荐K8s的一键安装和一键升级
    Pipeline流水线项目构建
    Jenkins构建Maven项目
    Jenkins构建自由风格的项目
    Codeforces Round #570 (Div. 3 )A
  • 原文地址:https://www.cnblogs.com/fdyang/p/4418371.html
Copyright © 2020-2023  润新知