The learning content comes from the experimental building linux tutorial + Mofan python linux tutorial
1. Terminal
By default, Linux provides 6 "terminals" with pure command line interface (6 virtual consoles to be precise) to allow users to log in. On the physical machine system, you can use [Ctrl]
+ [Alt]
+ [F1]~[F6]
to switch. When you switch to one of the terminals and want to switch back to the graphical interface, you can press [Ctrl]
+ [Alt]
+ [F7]
to do so.
2. shell (shell)
Shell refers to the software (command parser) that "provides user interface". Shell under Unix/Linux operating system is not only an interface for user interaction, but also a scripting language to control the system. The more popular common shells are bash, zsh , ksh, csh, etc. Ubuntu terminal uses bash by default.
3. Important shortcut keys
[Tab]: Used to complete commands, complete directories, and complete parameters
[Ctr+c]: Forcibly stop the current program and restore it to a controllable state
button | effect |
---|---|
Ctrl+d |
end of keyboard input or exit the terminal |
Ctrl+s |
Tentatively set the current program, after pause, press any key to resume running |
Ctrl+z |
Put the current program into the background to run, and restore to the foreground as the commandfg |
Ctrl+a |
Move the cursor to the beginning of the input line, equivalent to the Home key |
Ctrl+e |
Move the cursor to the end of the input line, equivalent to the End key |
Ctrl+k |
Delete from the cursor position to the end of the line |
Alt+Backspace |
delete a word forward |
Shift+PgUp |
Scroll the terminal display up |
Shift+PgDn |
Scroll the terminal display down |
4. Wildcards
There are mainly "*" and "?", which are used for fuzzy matching of strings.
Common wildcards in the shell:
character | meaning |
---|---|
* |
matches zero or more characters |
? |
matches any character |
[list] |
matches any single character in list |
[!list] |
matches any character other than any single character in list |
[c1-c2] |
Match any single character in c1-c2 such as: [0-9] [az] |
{string1,string2,...} |
matches one of sring1 or string2 (or more) |
{c2..c2} |
Match all characters in c1-c2 such as {1..10} |
5. Learn to use man
segment | illustrate |
---|---|
1 | general order |
2 | system call |
3 | Library functions, covering the C standard library |
4 | Special files (usually devices in /dev) and drivers |
5 | File formats and conventions |
6 | Games and Screensavers |
7 | Miscellaneous |
8 | System Administration Commands and Daemons |
Use search in man, /<你要搜索的关键字>
, and after finding it, you can use the n
key to switch to the location of the next keyword, which is the location of shift+n
the previous keyword. Use Space
(Spacebar) to turn pages, Enter
(Enter) to scroll down a line, or use j
, k
(the vim editor's movement key) to scroll forwards and backwards one line. Press h
the key to display the help (because man uses less as the reader, which is actually less
the help of the tool), press q
to exit
You can also use info. If you know the function of a certain command and just want to quickly check the function of some of its specific parameters, then you can use --help
parameters. Most commands will have this parameter.