Ubuntu Common Terminal commands

Source: Internet
Author: User
Tags clear screen

# CTRL + L-clear screen. CLear
# CTRL + C-Terminate command.
# Ctrl + D-exits the shell as if it could also represent EOF.
# CTRL + Z-the current process is placed in the background and FG is restored.
# Ctrl + R-Find from the command history. Reverse-i-search
# CTRL + A-the cursor moves to the beginning of the line. A
# CTRL + E-the cursor moves to the end of the line. End
# CTRL + U-Clears the character of the cursor to the beginning of the line. U
# CTRL + W-Clears a word before the cursor. Word
# Ctrl + K-clears the character of the cursor to the end of the line. K
# CTRL + T-swaps the first two characters of the cursor. SwiTch
# Ctrl + Y-paste the characters that were removed from the previous Ctrl+u class command. Y
# CTRL + P-Previous command. Prev
# CTRL + N-the next command. Next
# Ctrl + V-Input control word such as CTRL + V. <ENTER>, input ^m

# CTRL + F-the cursor moves back one character. Fore

# Ctrl + B-the cursor moves forward one character. Back
# Ctrl + H-deletes one character before the cursor. H
# N+<ESC>+F-Move the cursor back n words, n is 1 can be omitted
# N+<ESC>+B-the cursor moves forward n words, n is 1 can be omitted
# CTRL + S-suspends the current shell. Stop
# CTRL + Q-Re-enable
# <esc>+d is removed from the beginning of the cursor to the end of the line. Delete
# !! -Previous command
#!-n-Countdown nth History command
#!-n:p-Print previous command (not executed)
# !? String -Latest command with "string"

#!-n:gs/str1/str2/-Replaces the str1 of the last nth command with STR2 and executes (replaces the first only if no G is added)

Using the VI editor (which can be used to write programs, text, etc.), there is also a vim compiler, which is an upgraded version of VI.

VI has three modes: command-line mode, insert mode, and bottom-line mode. But there are also command-line patterns and bottom-line patterns grouped together, that is, divided into two modes, one is the command line mode, and the other is the insertion mode.

1) Enter VI filename.suffixname (such as VI first.c or VI second.cpp) in the terminal to confirm that it is equivalent to creating a new Notepad file but not yet saved. (Note that this is the command-line mode, the character cannot be entered)

2) Press I to enter insert mode (to enter the insertion mode before entering a character) and then enter the program.

3) Press ESC to exit Insert mode (enter command line mode for copying, pasting, deleting characters, etc.)

4) in command-line mode, enter the colon ":" to exit the command line mode into the bottom row mode (the cursor is located in the bottom row of the screen, the user can save or exit the file, etc.).

5) Press W in the bottom row mode to save, Q exit, q! Forced exit does not save, X exits and saves, generally can be directly entered Wq, enter, so save and exit.

6) then use LS (i.e. list, also use dir) command to view the current folder file, with Ls–l to view the file details.

7) Compile the C file just saved with the GCC compiler.

Method: ①GCC filename.c (or gcc fileName.cpp) is named after the compiled file by default a.out

②GCC Filename.c–o Filename.out, so the name of the compiled. Out file will not be named A.out by default, but File_name.out.

8) If you want to edit an existing file, such as the previously written C program has errors to modify, you can enter on the terminal

VI filename.c (or VI fileName.cpp), you can enter the editor.

9) Modify file name: MV Oldname NewName (note to the terminal interface, not the command screen in VI)

10) Run the Filename.out file directly with "./filename.out", that is, after the ". C" file is compiled with the GCC compiler to ". Out", when the ". Out" file is executed, simply precede the filename with "./".

Note: GCC (GNU Compiler Collection)

VI Delete and modify the file commands (note in edit mode instead of insert mode):

x: Deletes the character of the cursor.

DD: Deletes the column where the cursor is located.

R: Modifies the character of the cursor, and R is followed by the characters to be corrected.

R: Enter the replace state and the new text will overwrite the original text until you press [ESC] back to instruction mode.

S: Delete the character of the cursor and enter the input mode.

S: Delete the column where the cursor is located and enter the input mode.

View user group information under Linux

Groups viewing group information for the currently logged in user

Groups user_name View the group that the user_name user is in, and the members in the group

WHOAMI View the currently logged in user name

WHO displays user information for directory login system

Whois user_name Find and display user information

W Display user information currently logged into the system

Finger querying users ' information

Ubuntu Common Terminal commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.