I used Linux for a while back in 2014. At one point, it seemed to feel a little. Later, the reason for the change of work content and so on was put down, until today, it has basically been forgotten. Now pick up again, how much or a little impression. Write it down anyway.

1. Create folders

Create a folder redis in the root directory (not the current directory) and subfolders data

mkdir /redis    /redis/data
Copy the code

Run the following command to view the creation

CD / # to the root directory lsCopy the code



About directory location in Linux, it is similar to MS-DOS, both are CD, and the parameters are similar. Such as

CD WWW, means to WWW directory; cd .. , which means to go up to the directory; CD -, which means to go back to the last directory, like Windows does; CD /, which means go back to the root directory. CD ~ To the current working directoryCopy the code

2. Create and edit the file

The previous step is to create a folder to store the created configuration file. It looks like this configuration file is separate and has nothing to do with Docker. This means that this profile is available to all instances of Redis.

Create and edit the redis.conf file. Vi seems to be a great text editor for Linux.

vi /redis/redis.conf
Copy the code

Vi When the file is first opened, you can use the back key to delete it, but cannot write it in. To enter the editing mode, enter I, press ESC, and enter: :wq to save and exit. Vi has a lot of other commands that you can look up.

Yy: Copy the current line dd: delete the current line x: delete the current character P: Paste All the above commands must press ESC first to exit the current editing stateCopy the code

3. Delete folders or files

sudo rm redis.conf -rf
Copy the code

Parameter r: indicates that the descendant directories and files are deleted. R, recursive also. F: forcible deletion. F, force also.