Tuesday, June 18, 2013

UNIX/Linux Shell Script to delete multiple users



Example 1:

To delete the users: dummy1, dummy2, dummy3, dummy4 and dummy5

for  counter in {1..5}; do userdel dummy$counter; done

It can also be written as,

for counter in {1..5}
 do 
       userdel dummy$counter
 done

NOTE: {1..5} syntax will not work in certain shell. But it will work definitely in bash.

Example 2:

cat > user.list
vijay
sanjay
ajay
sujay


for  user in `cat  user.list`;do userdel $user;done

4 comments:

Oracle Fusion said...

It is really very excellent; I find all articles were amazing. Awesome way to get more tips from everyone............... R12 Financials Online Training

Isabella Olivia said...


This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.


Pawn Shop

Pawn Loans

Pawn Shops

Pawn Loan

Pawn Shop near me

Sports education worldwide said...

Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
appvn
hotmail sign up login

shivani said...

A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
Oracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training