Seems like a lot of extra overhead here -- honestly it just seems easier to become the root user and and do a simple rm command.Code:doug@s15:~/sudo/test$ printf '%s ' *.txt | xargs --max-procs=6 --max-args=1000 sudo rm
Seems like a lot of extra overhead here -- honestly it just seems easier to become the root user and and do a simple rm command.Code:doug@s15:~/sudo/test$ printf '%s ' *.txt | xargs --max-procs=6 --max-args=1000 sudo rm
Yes, agreed. However that particular example was for when even that doesn't work, because the number of files even exceeds the regular (not sudo) limit. Example (200,000 .txt files and 6 .save files that I want to keep):
EDIT: at the risk of self embarrassment, here is the script I use for to remove the files after my many many files types tests. The old way is still there, but commented out:Code:root@s15:/home/doug/sudo/test# ls -l | wc -l 200006 root@s15:/home/doug/sudo/test# rm *.txt bash: /bin/rm: Argument list too long root@s15:/home/doug/sudo/test# root@s15:/home/doug/sudo/test# printf '%s ' *.txt | xargs --max-procs=6 --max-args=1000 rm root@s15:/home/doug/sudo/test# ls -l | wc -l 6 root@s15:/home/doug/sudo/test#
Code:doug@s15:~/c$ cat rm_many_files #!/bin/dash # rm_many_files 2020.03.24. # Seems I should have been using xargs # for this all along. # # rm_many_files 2019.05.26. # Add some progress feedback. # Try other, faster, method. # # rm_many_files 2018.08.19. # Someimtes, for tests, I have so many files # that rm doesn't work due to "Argument list too long" # break it doen into smaller chunks. # COUNTER2=0 # while [ $COUNTER2 -lt 10 ]; # do # COUNTER1=0 # while [ $COUNTER1 -lt 10 ]; # do # echo "Deleting: *$COUNTER2$COUNTER1???.txt" # # time rm *$COUNTER2$COUNTER1.txt # # time find . -name "*$COUNTER2$COUNTER1.txt" -delete # time rm *$COUNTER2$COUNTER1???.txt # COUNTER1=$(($COUNTER1+1)) # done # COUNTER2=$(($COUNTER2+1)) # done printf '%s ' *.txt | xargs --max-procs=6 --max-args=1000 rm
Last edited by Doug S; March 27th, 2020 at 07:42 AM.
Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.
Hi!
I finished reading many pages,
then I have come back now!
What I understood that...
·Running as always the root privilege user is
extreamly dangerous, so Ubuntu does not allow
the user use the root account in default.
·In default, the user can not use su command,
because the root account is not made in
the installation.
·The root account does not exist in default,
so it has no possibility to be taken over
by anybody.
.sudo requires the users to type THEIR OWN password.
It is cashed for 15minutes, which could be changed
for the user's preference.
·In Linux, users do not use su command,
but sudo. It is better to carefully run
command after sudo, though it expires in
15 minutes, but during that time the novice
use may run destructive commands.
·sodo leaves log that tells the users
what they have done, which is useful for
troubleshooting.
****
To kevdog
Thank you for tell me your experience!
In some case, two commands are not
interchangeable.
The each power is sometimes different
between sudo and su.
It is a interesting point!
***
To Tadaen_Sylvermane
Thank you for a subjective opinion!
Su allows the users do anything,
but sudo could be limited for
the range on the situation.
Very important point for deploying
the Linux machine.
***
To TheFu #8 #10 Reply
A document I read says
same as you tell me.
The sudo is also good to
manage user accounts.
Short procedure, better for
the long run manage.
"Lots of Linux distros don't
for the use of sudo like Ubuntu does."
from #10 reply
I knew the new fact that in the RHEL family
the user use su.
Does Ubuntu go along the more secure way?
It is nice!
***
I will also reply for others next time!
Thank you, the members of the community for a lot of supports!
Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.
If you want to know the differences between su and sudo, then start with the basics.
Start learning about Unix/Linux file permissions (including setuid bits).
Did you know that a simple `ping' command must run as root? Or when you change your password you are escalating your privileges to root!
Most people on a modern Unix/Linux distro don't even realize when they are acting as root.
And there is PAM and polkit ....
Disagree.
Example:
Code:doug@s18:/media$ ping google.com PING google.com (172.217.3.174) 56(84) bytes of data. 64 bytes from sea15s11-in-f14.1e100.net (172.217.3.174): icmp_seq=1 ttl=57 time=21.8 ms 64 bytes from sea15s11-in-f14.1e100.net (172.217.3.174): icmp_seq=2 ttl=57 time=22.2 ms 64 bytes from sea15s11-in-f14.1e100.net (172.217.3.174): icmp_seq=3 ttl=57 time=22.1 ms 64 bytes from sea15s11-in-f14.1e100.net (172.217.3.174): icmp_seq=4 ttl=57 time=22.2 ms ^C --- google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 21.763/22.057/22.168/0.170 ms
Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.
Thank you, Doug S!
Now I have checked replies.
I have assumed that ubuntu does not make the root account.
But Just impossible to log in directly.
I got it!
Hello, sisco311.
I have learnt command and scripts from scratch. People around me, nobody uses any Linux and Unix-like OS, so the community is only one that I can rely on.
Thank you!
Bookmarks