The Linux Command Line 1-10章总结

原创 2016年08月28日 17:34:12

之前用ubunut大概有一个学期吧,尝试做过网站,中间遇到问题都是依靠搜索引擎,觉得还是有必要系统的学习Unix/Linux。尝试了两章Advanced Programming in the Unix Environment,感觉还是有点吃力,之前有看过《鸟叔的Linux私房菜》觉得不是我的菜。直到发现The Linux Command Line,嗯,TLCL是我的菜。

  • 一些重要的话
    Graphical user interfaces makes easy tasks easy, while command line interfaces make difficult tasks possible.

    One of the common ideas in Unix-like operating system is that “everything is a file”.

    In fact one of the most cherished goals of the command line is laziness; doing the most work with the fewest keystrokes.

  • 一些重要的事实
    When we speak of the command line, we are really referring the shell.

    Each time you type a command line and press the enter key, bash performs several processes upon the text before it carries out your command.

    When the enter key is pressed, the shell automatically expands any qulifying characters on the command line before the command is carried out.

    bash: a shell program from GNU program Bounce again shell

    when using a graphical user interface we need another program called terminal simulator to interact with shell

    virtual terminal: ctrl+alt+{F1-F6}

    User’s home directory is symbolized by the “~” character
    “./” is implied in almost all cases.

    It is possible to put more than one command on a line by separating each command with a semicolon character.

    The multi-user capability of Linux is not a recent “innovation”, but rather a feature that deeply embedded into the design of the operating system.

    We rarely want files and directories have the same permissions.

    One important difference between su and sudo is that sudo does not start a new shell, nor does it load another users environment.

  • 一些命令
    cd:change the working directory to your home directory
    cd-:change the working directory to the previous directory
    file:determine file type
    less:view file contents
    type:indicate how a command name is interpreted
    which:display which executable program will be executed
    man:display a commands manual page
    apropos:search the manual page names and descriptions
    info: display a commands info entry
    whatis:display a very brief description of a command
    alias:create an alias for a command
    cat:concatenate files
    sort:sort lines of text
    uniq:report or omit repeated lines
    wc:print newline, word, and byte counts for each line
    head:output first part of the file
    tail:output last part of the file
    tee:read from standard input to standard output and files
    echo: display a line of text
    clear: clear the screen
    history: display the content of the history list.
    id: display user identity
    chmod: change a files mode
    umask: set the default file permission
    su: run a shell as another user
    sudo: execute a command as another user
    chown: change files owner
    chgrp: change files group ownership
    passwd: change a users password

  • 一些参数
    -a:archive, copy the files and directories and all of their attributions, including ownerships and permissions. Normally, copies take on the default attributes of the user performing the copy.
    -i:interactive, if this option is not specified, command will silently overwrites files.
    -u:update
    -v:verbose, display informative messages as the copy is performed
    -f:force, ignore nonexistence files and do not prompt. This overwrite -i.

  • 符号连接和硬连接

    • ln file link
      Hard links are the original Unix way of creating links, compared to symbolic links. By default, every file has a single hard link that gives file its name. When create a hard link we create an additional directory entry for a file.
      Hard links have two important limitations. It may not reference a file that is not on the same disk partition as the link itself. And a hard link may not link a directory.
      A hard link is indistinguishable from the file itself. When a hard link is detected, the link is removed but the contents of file itself continue to exist (that is its space is not deallocated) until all links to the file are deleted.
    • ln -s file link
      Symbolic links are created to overcome the limitation of hard links. Symbolic links work by creating a special type of file that contain a text pointer to the reference file or directory.
      Using relative pathnames is more desirable because it allows a directory containing symbolic links to be renamed and/or moved without breaking the links.
      One thing to remember about symbolic links is that most file operations are carried out on the links’ target, not the link itself. rm is an exception.
  • 到底什么是命令?
    A command can be one of four things

    • An executable program like all those files we saw in /usr/bin. Within this category, programs can be compiled binaries such as programs written in C and C++, or programs written in script languages such as shell, perl, python, ruby, etc.
    • A command built into the shell itself. bash supports a number of commands internally called shell builtins. For example the cd command.
    • A shell function. These are miniature shell scripts incorporate into the environment.
    • An ailas.
  • 重定向
    When we redirect output with the “>” redirection operator, the destination file is always rewritten from the beginning. Use the “>>” we can append redirected output to a file instead of overwriting the file from the beginning.

    To redirect standard error we must refer to its file descriptor.

    Use “&>” redirects both standard output and standard error to files.

    The ability of commands to read data from standard input and send to standard output is utilized by a shell feature called pipelines. Using the pipe operator “|”, the standard output of one command can be piped into standard input of another.

  • expansion
    The mechanism by which wildcards work is called pathname expansion.

    With brace expansion, you can create multiple text strings from a pattern containing braces.{}

    Parameter expansion many of its capabilities have to do with the systems ability to store small chunks of data and to give each chunk a name. $

    Command substitution allows us to use the output of a command as expansion. $()

    The shell provides a mechanism called quoting to selectively suppress unwanted expansions.

    If you place text inside double quotes, all the special characters used by shell lose their special meaning and are treated as ordinary characters. The exceptions are $, (back-slash), `(back-quote). This means word-splitting, pathname expansion, tilde expansion and brace expansion are suppressed but parameter expansion, arithmetic expansion and command substitute are still carried out.

    Single quotes suppress all expansions.

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

The Linux Command Line 11-20章总结

之前用ubunut大概有一个学期吧,尝试做过网站,中间遇到问题都是依靠搜索引擎,觉得还是有必要系统的学习Unix/Linux。尝试了两章Advanced Programming in the Unix...

The Linux Command Line 21-30章总结

linux command

A note on Cmake - 1 Command-Line Tools

It is necessary to briefly introduce the commands used in CMake. cmakeThe “cmake” executable is the...

The_Linux_Command_Line

  • 2016-05-08 01:32
  • 2.02MB
  • 下载

The Linux Command Line 读书笔记 第九章 Permissions

这章讲了 linux 的多用户特性,基本指令如下: id – Display user identity  chmod – Change a file's mode  umask – Set the ...

The_Linux_Command_Line

  • 2016-03-31 16:08
  • 2.02MB
  • 下载

Linux command line

  • 2014-11-05 15:45
  • 2.77MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)