You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Mac上仅删除以"SAMSUNG"开头的网络服务?

Batch Delete SAMSUNG-Named Network Services on Mac

I feel your pain—deleting over a thousand SAMSUNG modem services manually is totally a waste of time. Here's a simple, efficient way to automate the process:

One-Liner Command

Run this directly in your Terminal (you’ll need to enter your admin password when prompted):

networksetup -listallnetworkservices | grep "^SAMSUNG" | while read service; do sudo networksetup -removenetworkservice "$service"; done

Let’s Break It Down

Each part of the command works together to target only the services you want to delete:

  • networksetup -listallnetworkservices: Pulls up the full list of your network services, just like you did manually.
  • grep "^SAMSUNG": Filters the list to keep only services that start with "SAMSUNG" (the ^ ensures we don’t accidentally match any services that mention SAMSUNG later in the name).
  • while read service; do ... done: Loops through every filtered service name one by one.
  • sudo networksetup -removenetworkservice "$service": Runs the delete command with admin privileges for each SAMSUNG service.

Important Pre-Checks & Tips

  • Preview First: Before deleting anything, run this command to confirm you’re only targeting the right services:
    networksetup -listallnetworkservices | grep "^SAMSUNG"
    
  • Admin Rights: The sudo is mandatory here—modifying network services requires administrator access.
  • Safe for Critical Services: Since we’re only filtering for services starting with "SAMSUNG", your Wi-Fi, Thunderbolt Bridge, and other essential connections won’t be touched.

Alternative: Verbose Script (Easier to Follow)

If you prefer something more readable (great if you’re new to shell commands), save this as delete_samsung_services.sh:

#!/bin/bash

# Fetch all network services starting with SAMSUNG
samsung_services=$(networksetup -listallnetworkservices | grep "^SAMSUNG")

echo "Found the following SAMSUNG services to delete:"
echo "$samsung_services"
echo "---------------------------------------------"

# Delete each service one by one
for service in $samsung_services; do
    echo "Deleting: $service"
    sudo networksetup -removenetworkservice "$service"
done

echo "---------------------------------------------"
echo "All SAMSUNG network services have been deleted!"

Then run it in Terminal with:

sudo chmod +x delete_samsung_services.sh && sudo ./delete_samsung_services.sh

Either method will wipe out all those unwanted SAMSUNG modems in seconds instead of hours.

内容的提问来源于stack exchange,提问作者Francisco Souza

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 04:12:32