Author's Foreword
Welcome little cuties to come and learn from my gtiee Qin Boss (qin-laoda) - Gitee.com
——————————————————————————————————
Table of contents
sudo
whoami
who
exit
reboot、shutdown
Software Installation
editor vim
————————————————————————————————
author small nonsense
After the simple learning of the previous LInux commands, the cuties with a good memory have already memorized them, and the cuties with a bad memory should not be discouraged. This is how learning works. Learn the new by reviewing the old. I myself don’t remember a lot, but as long as I can find it, I can learn it well, let it be,
Immediately after the previous article, I have briefly introduced some commonly used commands of linux. In this article, I will introduce the last few and end the simple commands of linux.
Interstitial knowledge
1. When compressing all files and directories, you can use "*" to
sudo
sudo vim 文件名称
Temporarily has administrator privileges
When we modify a read-only file, we cannot modify it. For example:
this cannot be modified
If we apply to the administrator for permission, we can modify it
Run here to enter the password, the password here is your password to log in to the virtual machine
Here may be a little cute and you will think what is the difference between sudo and chmod
Sudo is equivalent to our leader leader can manage all things in our work scope. When a colleague creates a file and uses chmod to give us a read-only permission, sudo (leader) has full permission. When we want to modify this file when:
1. Ask permission from the creator of the file
2. Ask the administrator for permission (borrow it)
sudo -s
sudo -s
Switch to an administrator account
It can be seen that tisugou has become root
Switch to an administrator account. Because general tourist permissions cannot
write or execute files on
Linux , so when you do not have permission, you can execute this command to write to the administrator account of the server, but you must know the password.
whoami
view current account
whoami
Generally, if you use this command on your own computer, all the root administrator privileges
appear
. However, when logging in on the company server, the authority of guest visitors may appear. So combined with
sudo -s
, you can change permissions
who
View all logged in users. The login user here does not include
the root
administrator. Therefore, it will not be displayed when checking in general. Simply put, it is to check all the accounts in your group
Because this group only has my account, so only one account information is displayed
exit
Sign out of your account. The graphical interface is to exit the current terminal; if you use
ssh
to log in remotely, log out of the login account; if you log in after switching
If you log out, you will return to the last login account.
Prominent writing in the root account
exit;
Log out from personal account
exit ;或者exit
reboot、shutdown
reboot reboot
shutdown shut down
This command will not be demonstrated. Because the general server does not require you to shut down and restart (you must not do this
Do). There are many running programs and services on the company's server, so a hasty shutdown and restart may affect other businesses, so the taboo level of this command is second only to the execution of rm -rf
.
And most of the current server usage is displayed in the form of a window interface, such as the virtual machine we use to demonstrate
Linux
code. If you need to shut down or restart, just operate it directly on the graphical interface.
Software Installation
sudo apt-get update 更新源
Download the installation package from the update source with administrator privileges. The update source here is a URL, which means to make a request to this URL and download the software package on the URL
sudo apt-get install package 安装包
Install this package with administrator privileges. The installation package is the one downloaded from above.
sudo apt-get remove package 安装包
Delete this installation package with administrator privileges.
apt-get is an installation command, there are many installation commands in linux, here is just one of them
editor vim
This is
the editor that comes with
Linux , which is used
to edit text or code inside Linux . Enter vim directly to enter directly
editor. In
the shell
environment ( like
Python
, it is also a scripting language. The prompt at the beginning is
$
), and entering
vi
can also enter this editor. The Linux environment we use
is a direct
shell
environment. If
vim cannot be entered,
vi
is used
.
The simple understanding is that vim==vi
vim has three modes:
command mode
At any time, just press
the ESC
key to enter the command line mode. The editor command at this time is used to complete the corresponding
action. If the command is correct, it will be executed. If it is incorrect, it will be marked in red at the bottom, telling you that the command does not exist or is incorrect. In vim
's command mode, be sure to pay attention to the case of the command.
edit mode
In the command mode, input lowercase letters
i
,
a
,
o
,
c
,
r
,
s
will enter the edit mode, although their command operation results are not
same. In this mode, you can edit text.
last row pattern
In the command mode, enter the English colon
:
, and you can see the colon at the bottom of the window, which also means that the last line mode has been executed.
Entering the last line mode, we use the most to exit the file.
To say so much is to make us clear that there are three modes: command mode, edit mode, and last line mode
Vim basic operation
sentence, any input operation will not edit the text content. The command mode is equivalent to a transfer station. For example, we can
enter the edit mode through the command
i or
:
enter the last line mode, but we cannot directly jump between the edit mode and the last line mode. We must first use the esc
key to enter the command mode , to enter another mode during operation.
picture demo
say something here
in last line mode
q: quit
q! : force quit
wq: save and exit
wq! : force save and exit
In command mode:
The following command is more important
Pressing / will have a cursor in the lower left corner,
Writing:
/ 查找的内容
Then press n or N
edit mode
Summarize:
This is the end of the introduction of the simple commands of linux, and some commands will be explained later, welcome to chat privately