You are not logged in.
I would like the result of the following command to be written to /etc/pacman.d/mirrorlist
I have tried several ways but I either get permission denied or it doesn't write the file
[demo@mail ~]$ curl -s "https://archlinux.org/mirrorlist/?country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 -
Server = https://volico.mm.fcix.net/archlinux/$repo/os/$arch
Server = https://mirror.dal10.us.leaseweb.net/archlinux/$repo/os/$arch
Server = https://mirror.mia11.us.leaseweb.net/archlinux/$repo/os/$arch
Server = https://us.mirrors.cicku.me/archlinux/$repo/os/$arch
Server = https://arlm.tyzoid.com/$repo/os/$arch
Among other ways I have tried this:
[demo@mail ~]$ sudo curl -s "https://archlinux.org/mirrorlist/?country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 >> /etc/pacman.d/mirrorlist
I know this is simple and I should know how to do this but I can't figure it out. Just need a little help.
This got the file to write but didn't have the above as shown.
demo@mail ~]$ sudo curl -s "https://archlinux.org/mirrorlist/?country=US&protocol=https&use_mirror_status=on" -o /etc/pacman.d/mirrorlist | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 -
Last edited by MAYBL8 (2024-04-14 14:53:02)
Online
You can invoke shell with "-c" option to pass command - look at the "man sudo", EXAMPLES section:
To make a usage listing of the directories in the /home partition. The commands are run in a sub-shell to allow the
‘cd’ command and file redirection to work.$ sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"
Offline
Add a final pipe with "sudo tee /etc/pacman.d/mirrorlist" to the end would work as well
Offline
Mod note: moving to NC
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Thanks for the help guys.
Sometimes I amaze myself
This worked for me:
sudo sh -c 'curl -s "https://archlinux.org/mirrorlist/?country=US&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - > /etc/pacman.d/test'
Online
Add a final pipe with "sudo tee /etc/pacman.d/mirrorlist" to the end would work as well
Rule of thumb, the less stuff you have behind sudo, the less harm you're gonna prompt
Offline