Linux file and user management, cat and gedit function introduction

To execute commands in the root file, you need to obtain root permissions:

   Use the su command, enter the password:
   to obtain root privileges, and use other commands to read the root directory and create files in root

Note: Under the root authority, you need to add # before the command, indicating that you have the authority as a super user, so as to prevent the computer from automatically removing the authority.

Linux basic commands


1. Modify the content of the file:

 1. Redirect: >
  

# ls -a > cat.txt


   You can write something into the cat

 2. Write the information in the root directory to cat.txt:

# ls / >  cat.txt


   
   Check if it is written in:
   # cat /cat.txt

 3. Text editor
  (1) cat syntax: input the result of viewing the directory into another file
         

# cat /home/jncan/aaa  > cat.txt


         (Indicates that the result of aaa is input into cat.txt)
           Check whether it is input:
       

# cat /cat.txt

 (2) gedit: graphic file editor

          ["g" means graphics, "edit" means edit]

[jncan@localhost ~]$ su
密码:
[root@localhost jncan]# gedit  /1.txt

(gedit:6874): GLib-GIO-CRITICAL **: 17:00:34.889: g_dbus_proxy_new_sync: assertion 'G_IS_DBUS_CONNECTION (connection)' failed

(gedit:6874): dconf-WARNING **: 17:00:34.917: failed to commit changes to dconf: 连接已关闭

(gedit:6874): dconf-WARNING **: 17:00:34.923: failed to commit changes to dconf: 连接已关闭
Error creating proxy: 连接已关闭 (g-io-error-quark, 18)
Error creating proxy: 连接已关闭 (g-io-error-quark, 18)
Error creating proxy: 连接已关闭 (g-io-error-quark, 18)
Error creating proxy: 连接已关闭 (g-io-error-quark, 18)
Error creating proxy: 连接已关闭 (g-io-error-quark, 18)


 

         A box appears in the terminal, namely Notepad cat.txt

                         

 Write a new graphic file: directly add a new file name.
                        Example: # gedit /2.txt
   
   (3) vi and vim
         command line: # vim /1.txt

                              


     Open the text editor -> enter i -> enter the insert mode
     . In the insert mode, editing and modification of the notepad is not allowed. You need to press the i key again, and the insert appears , and you can edit the notepad.

                        

     When you want to return to the command line, you need to press the esc key first, then enter: wq, press Enter to enter the command line mode, and press the i key again to enter the insert mode.

                      


     Commonly used functions in text editing:
     (1) Copy and paste function: first press the y key twice, and then move to the number of lines you want to paste and press the p key
     (2) Batch delete text: first press the number (indicates to delete several lines) two After the d key
                                        is deleted by mistake, you can press the u key to undo it
     (3) Delete a certain word in a line: move to the character and use the x key
 

Guess you like

Origin blog.csdn.net/weixin_52336311/article/details/119823306