Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I clean Nm from all the network ID I never get connected too ?

Traveling and moving here and there increase the list of net and I don't need many of them ... so I would like to clean all the network that I never connect too.

I wonder if there is a built in command to clean the list.
I'm not good with bash but I think it is easy to create script and so a cron job.

A good starting point could be nmcli tool and in particular those command:

  • nmcli con delete
  • nmcli con list
share|improve this question

1 Answer 1

Solution

nmcli --fields UUID,TIMESTAMP-REAL con list | grep never |  awk '{print $1}' | while read line; do nmcli con delete uuid  $line;    done

It will be possibe also to use TIMESTAMP field to know how many day/month are passed from last connection, like for example we want to remove connection older than 1 year

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.