# The Linux Command Line 1-10章总结

• 一些重要的话
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

• 一些参数
-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.

• 符号连接和硬连接

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.
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.

• 本文已收录于以下专栏：

linux command

## The Linux Command Line 详细说明

• 2016-09-21 21:59
• 5.69MB
• 下载

## Linux Command Line and Shell Scripting Bible(3rd) 无水印pdf

• 2017-09-27 10:19
• 9.80MB
• 下载

## A note on Cmake - 1 Command-Line Tools

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

## Linux Command Line and Shell Scripting Bible

• 2017-02-24 14:20
• 17.00MB
• 下载

## The_Linux_Command_Line

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

## The_Linux_Command_Line

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

## Linux command line

• 2014-11-05 15:45
• 2.77MB
• 下载

举报原因： 您举报文章：深度学习：神经网络中的前向传播和反向传播算法推导 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)