How To List Installed Packages In CentOS, Fedora?
I have a vm named fedora_dev2. I want to create new vm but do not want to dig to install all packages in fedora_dev2 so I need a script that list allready installed packages in fedora_dev2 and install them with dnf or yum in new vm. Here is what I need.
List Packages With Yum
yum list installed | cut -d " " -f 1 | sed '/^\s*$/d' | sed ':a;N;$!ba;s/\n/ /g'
First list all ready installed packages. There is three colon list we need the first one that is separeted with space. We use cut to accomplish this. Here we need some make up. First sed command removes empty lines. Second sed commands replace new lines with single space. And here what we want.