When we use Linux, we do not deal directly with the system, but through the Shell's intermediate programs. In order to realize the input and output of windows in the graphical interface, the Linux system provides us with Terminal Simulator terminal, and the common terminal simulator has gnome-terminal,konsole,xterm,kvt,eterm. I'm using Xfce.
The shell is a command parser that is provided to the user to use the interface, similar to command and Cmd.exe.
1. Command-Line Operations
(1) Shortcut keys
[Tab]
Use the TAB key to complete the command line.
[Ctrl + C]
You can press CTRL + C to stop the current program when you enter an error command on the Linux command line, causing the terminal to appear unexpected, such as blinking or unable to continue typing the command, or a lot of results you don't know. For example, when you enter the Find/command in the terminal, there will be a lot of unpredictable results, you can press CTRL + C to stop.
[Ctrl+d]
Keyboard input ends or exits the terminal.
[Ctrl+s]
Pause the current program and press any key to resume after pausing.
[Ctrl + Z]
Put the current program in the background to run and revert to the foreground command as FG.
(2) Historical input command
Use the direction up arrow on the keyboard.
(3) wildcard characters
Mainly have * and? Two symbols. Used to blur a string, such as a file name, the parameter name.
For example, if you create a file, but forget the name, you can use wildcards.
Use
$ Touch A.txt B.txt
$ ls *.txt
You can find the file you created.
(4) Get help at the command line
In a Linux environment, encountering difficulties using the man command,
2. View the user
At Terminal input $who am I terminal outputs information such as the user's user name startup time.
Common parameters of the WHO command
-A print all
-D Print dead process
-Q Prints the number of currently logged on users and user names
-R print Run level
3. Permissions
The root account in Linux has the highest rights. System files can be added to the search and deletion. We normally log in to the account is a normal account, to create users need root permission, then use the sudo command. Use the sudo command to know the user name and password.
(1) Create a user
Use
$ sudo adduser Wangpeng
To create a new user. Use
$ ls/home
Create a home directory for the new user. Use
$ su-l Wangpeng
In order to create a user login.
Add Wangpeng to the sudo user group, by default the newly created user is not rooted, and the sudo user group can be added to the sudo user group to gain root privileges. Use the following command:
$ su-l wangpeng$ sudo ls
You will be prompted that Wangpeng is not in the sudoers file, meaning Wangpeng does not belong to the sudo user group. Use the Usermod command to add a user group to a user.
$ su wangpeng# Enter password $groups wangpeng$sudo usermod-g sudo wangpeng$ groups Wangpeng
(2) Delete user
$sudo Deluser Wangpeng--remove-home
4.Linux file Permissions
The LS command is used to list and display files in the current directory, listing longer formats
$ ls-l
5. Installation
$sudo apt-get update$sudo apt-get Install tree
6. Path
Use the CD command to switch directories and use "." In Linux. Represents the current directory, using ".." to represent the previous level of the directory, (. The file that starts with is a hidden file, use the $ ls-a command to view the hidden file), "-" represents the last directory, "~" represents the home directory of the current user. Use the PWD command to get the current path (absolute path).
(1) Go to the previous level directory: (Note the CD and the. Space between them)
$ CD.
(2) Enter the home directory:
$ cd ~
(3) Absolute path
The full path starting with the "/" directory, ending with the directory you want to reach. such as/usr/local/bin
$ cd/usr/local/bin
(4) Relative path
to the current directory. "As the starting point, the directory to be reached is the end point, and the representation is: Usr/local/bin
Notice no use for ". "Instead, start with a directory, because the USR directory is a subdirectory of the/directory, you can omit the". "
If it is the top-level directory of the current directory, you need to use the ".. "For example, if your current directory is home, the root directory should be represented as
.. /.. /, which represents the top level directory (/directory) of the previous level directory (home directory).
$ cd . /.. /usr/local/bin
7. Basic operation of the file
(1) New
The touch command is used to create a blank document because there are no permissions in other directories, so switch to the user directory first.
$ cd ~
$ Touch Test
mkdir command to create an empty directory
$ mkdir Mydir
Use the-p parameter to create a parent directory at the same time, such as creating a multilevel directory at the same time (this is required for software installation and configuration paths)
$ mkdir-p Father/son/grandson
(2) Copy
Use the CP command to copy a file to the specified directory.
Copy the test file that you created earlier to: /.. In the/father/son/grandson directory
$ CP Test Father/son/grandson
(3) Delete
RM command to delete a file
$ RM Test
Basic Linux Concepts and operations