Linux underlying command

The format of the command line is: User Name + Host Name + Current Work Contents

The command format of the input content is: command [- Short option / – long option] [parameter]

The command is "what to do", the option is "how to do", the parameter is "Who do"

For example: Changing the host name

2, common basic order

1, PWD command – Role: Display the full path to the current location

2, cd command – role: Go to a folder (a path)

Blue character represents a folder
Olive green character represents link file
Black character represents a text file
Represents the current path
.. Represents the previous layer path
~ On behalf of the current user’s home directory, the CD can be omitted

3, ls command – action: Display all content of the current folder

-l -> Displayed in the form of a long file (LS -L can be abbreviated as an LL command)
-A -> Show hidden files (in the beginning of the file)
-LA -> Show hidden files in the form of long files (LS -AL can be abbreviated into LL -A)
-r -> Recursive display file

4, man command – role: see the usage help document for a command

5, su command – action: Switch users

6, passwd command – Role: Set or change the user’s password

Notice:Only root users can change passwords using this command

7, Date Command – Role: Display or set the current system date and time

Date alone-> Details and time
Date +% T -> Show time
Date +% D -> Show Date
Date +% X% X -> Show Date and Time

8, file command – Role: View file type

Notice:Linux is kept to be customized, so don’t judge the file type with a file suffix name.

10, Head Command (Tail Command) – Role: Several lines of displaying files, default display 10 lines, can be used to specify the number of lines

11, CAT (TAC) command – the role: Show the entire document from the head to the tail (from the tail to the head)

12, wc command – action: number of rows, words, and characters in statistics file, corresponding to -l, -w, -c

13, History Command – Role: Displays the list of commands used before

You can find the previously used commands by the up and down keys.

15, init command – role: switch system status

Linux system everything is available! The path started with "/" isAbsolute pathThe path started with "/" isrelative path.

1, "/" The following important directory

  • / usr -> Store normal user command (/ usr / bin), for the system management command used by the root user, (/ usr / sbin), and data installed for software.
  • / etc -> Store the configuration file of the system server.
  • / dev -> store device files such as hard drives, CPUs, NICs and other data.
  • / HOME -> Ordinary users ‘home directory (or home directory), store regular users’ configuration files.
  • / root -> Root user’s home directory (or home directory), store the root user profile.
  • / boot -> The file, system kernel, etc. needed to store the system startup process.
  • / var -> Store dynamically changed files, such as log files, cache files, databases, etc.
  • / TMP -> Store temporary files, and files that have not accessed or visited within 10 days will be automatically deleted.
  • / Run -> Store processes that have been started with a system.

There are 4 links:

  • / bin -> / usr / bin -> Store orders used by ordinary users.
  • / sbin -> / usr / sbin -> Store the command used by the root user.
  • / lib -> / usr / lib -> library file
  • / lib64-> / usr / lib64

2, file-related commands

1, touch command – role: Create an empty text file

2, DD command – role: Create a large capacity space file

3, mkdir command – action: Create a folder
MKDIR -P creates multi-level directory

4, cp command – action: copy file
CP -R Copy Folder (-R recursive replication, that is, copy all directories in the current folder)

Notice:The old file will overwrite the new file when the old file is renamed with the new file.

5, mv command – action: mobile file, rename file

6, rm command – action: Delete file
RM -R Delete folder
RM -F forced deletion, does not prompt removal confirmation

7, echo command – action: Show out the parameters behind the command
Like the system variable, this variable can be lowercase.

Echo can also modify the text content, the syntax is: Echo "XXX">, >> FileName

3, use of wildcard

* Simple mode match -> string consisting of 0 or more characters
? Simple mode match -> any 1 character
{} Big Brand -> Bulk Execution Command, can be used continuously or nested

“ Anti-quoter command replacement


The characters from the single quotes are all appeared as ordinary characters.

4, redirect operator

One> is a redirector, role: overwrites write, the original data in the file is not retained

Two >> is an additional redirector, role: append writing, do not cover existing content, write directly in the end of the file, the original data reserved

In Linux, a running program (or process) needs to read the input from the keyboard through the shell and write the output to the terminal or file.
The process uses a number channel named file descriptor to get the input and transmit the output. All processes need at least three file descriptors at the beginning:Standard input (channel 0), standard output (channel 1), standard error (channel 2).

Role: Put the previous execution results to the command behind the duct.

Notice:When there is a redirect symbol in front of the pipe, the pipeline is added to add a TEE command.

Vim has four modes, namely:Insert mode, command mode, last line mode, and visualization mode.

1, insert mode

Press I / A / O / O -> to enter the editing state (insert mode)

2, command mode

Press ESC -> Exit Edit (Insert mode)

3, last line mode 4, visual mode

I don’t know which direction should be learned first, Python? Java? Go?

Seeing such a problem in a platform, the subject is college student, does not like to learn from our skimming time to learn computer majors.

In fact, if you study your computer, I suggest that it is C> C ++> Java … such order, because you have a lot of time you can learn. If you have already graduated, if you want to grasp the computer and then employment, this is a proposal to learn Java directly.

Many people outside the door feel that the programming language=work, actually a big mistake, Java engineer, is only a representative of the engineer of Java as the primary language, but Java actually works in: enterprise system Development, game direction development, front-end development … So the language is not the direction of the computer, to select the computer language through the direction.

The following directions are for reference only:

  • Front end: The front end is more care that the user experience and interaction, the technology update iteration, learn HTML + CSS + JS;

  • The backend: Mainly different backgrounds have different languages, mainly to develop languages ??(recommended C ++ / Java) + technology framework;

  • Database: Also known as DBA, mainly maintaining databases, deeply mastering mysql, oracle, sqleerver, etc .;

  • Embedded: More suitable for automated professional partners, mainly using C language and C ++;

  • Machine learning direction: undergraduate care, it is recommended that this major will be selected.

  • What is the program? – Computer composition principle.

  • How is the program translated? – Compilation principle.

  • How does the program do? – Category of operating systems

  • How to use others’s results to achieve better data organization? Database related

  • How to ensure that the program is easier to maintain and read? – This is a design pattern and code specification

Therefore, the computer composition principle, data structure and algorithm, operating system and computer network are very important!

In fact, the biggest self-study difference between the department and non-science class is the classmate of computer majors, and self-study students don’t know what to learn. It seems that there is an app called a super-course table that you can see the curriculum arrangement of other professional students. At this time, I will take a reference to our self-study.

Secondly, the computer related theoretical basic book recommendation:

"Computer Principle" -> Computer Operating System -> Compile Principle -> Computer Network.

If the partner of self-study feels that these content is very boring, then the University of the B station has the foundation for the foundation of many famous teachers. You can search for a teacher who likes it, listening to the teacher. But the shortcomings of this kind of teacher class are no information, so you still have to buy books.

The last side is very important to write the code, and many people will say that "the amount of change is caused" is the amount of code. Small practice + projects are important, to take an anticipation through practice questions. As for the study of the project, you must first learn to play Github.