当前位置:首页 > 虚拟机 > 正文

虚拟机建立目录命令(虚拟机创建新文件的命令)

How to create new files and folders with Linux virtual machine commands

First, let’s talk about the touch command to create files. touch can be used to create binary files, and the usage is very simple. Usage: touch + file name, there must be a space between touch and file name. In the picture, we first use the command shared before to check how many files there are under the / directory and the names of the files.

Enter the Linux system and enter the terminal, enter the command "cd/", and then press the Enter key to go to the root directory. In the root directory, enter "sudomkdir folder name" and press Enter. After entering the administrator password and pressing Enter, the folder is created successfully.

Create a folder mkdir-p folder name p Make sure the directory name exists, if it does not exist, create one.

How to use the virt-clone command to quickly clone and create a new virtual machine
View the information of the source virtual machine image file that needs to be cloned
Use the command to view the detailed information of the image file :
$
Make sure that the virtual machine to be cloned is turned off
Use the following command to shut down the virtual machine lion:
$virshshutdownlion
Use the following command to view the status of the virtual machine lion:
$virshlist-all
View the detailed parameter information of the virt-clone command
Use the following command:
$vrit- clone--help
Use the virt-clone command to create a new virtual machine and name it mouse
Use the following command:
$virt-clone-olion-nmouse-f/ home/hxb/image/
View and start the newly created mouse virtual machine
At this time, you can use the following command to view the newly created mouse virtual machine
$ virshlist--all
$virshstartmouse
View the configuration file of the mouse virtual machine
You can see the configuration file in the /etc/libvirt/qemu directory
Connect to the mouse virtual machine through the VirtualManager tool and modify the host name and IP address
Modify the IP address command:
$ifconfigens3192.168.100.5netmask255.255.255.0

Modify the host name of the mouse virtual machine to avoid having the same name as the previous virtual machine
Modify the /etc/hosts file
Add a line:
192.168.100.5mouse

In a virtual machine, how to use commands to create a new file in the current directory?
Hello, the poster,
Just use the touch command.
For example, I want to create three new files in the current directory, and the file names are a, b, and c. Then:
touchabc
-----------------
If you want to create a new directory or folder in the previous directory, use the mkdir command ,
For example, create three new folders in the current directory, and the folder names are dir1dir2dir3, then:
mkdirdir1dir2dir3
--------------- ---
mkdir also has a more commonly used parameter, which is -p. Its function is to create a multi-level directory, even if a certain level directory does not exist, it will be automatically created for us.
Example , the current directory is empty, I want to create directory a under the current directory, then create directory b under directory a, and then create directory c under directory b. If it is troublesome to create one by one, it is extremely simple to use the -p parameter: < br/>mkdir-pa/b/c
I hope the above answer will be helpful to the author, please feel free to ask questions