Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

unix xyz user size and cleanup

hi

on the unix box various users like xyz, abc etc.

Looks like disk space is running out of server and i need to cleanup.

How to know how much user xyz occupying size and how much abc user is occupying size. please advise
Avatar of Jan Bacher
Jan Bacher
Flag of United States of America image

su to root:

either "su -" or "sudo su -"

cd /
du -sh *

and drill down one level to the directories consuming disk space.

If all of these accounts are in /home, then cd /home and start from there.
Avatar of gudii9

ASKER

how to delete some hidden files
i see some files
.nfx00000aaaeeevvv etc of 2 GB

wht is that file why it occupyes so much space?
First find out what service is writing to that file:

lsof | grep -i nfx00000aaaeeevvv
Avatar of gudii9

ASKER

su to root:

either "su -" or "sudo su -"

cd /
du -sh *

and drill down one level to the directories consuming disk space.

If all of these accounts are in /home, then cd /home and start from there

any command which gives all statistics in one stroke? i hate to drill down to 1000 different directories
Avatar of gudii9

ASKER

does
ls -al
gives the size of the user folder?
ASKER CERTIFIED SOLUTION
Avatar of Jan Bacher
Jan Bacher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ls -ld /home/userfolder
Avatar of gudii9

ASKER

says permission denied even i logged as super user?
Avatar of gudii9

ASKER

when i say
ls -al
i see
drwxrwxrwx  4 lms      lms         45 Jan  4  2017 GGG3RR

WHAT IS 4 HERE AND
WHAT IS 45 HERE?

PLEASE advise
Avatar of gudii9

ASKER

Does below command deletes hidden as well as regular files and directories under current directory?
file_permissions    number_of_links   owner_name   owner_group   file_size   time_of_last_modification   filename/or/directoryname

4 = where number of links are directories inside of this directory
45 = file_size
I don't see a command which deletes anything.
Avatar of gudii9

ASKER

i mean

rm -rfi .*
Avatar of gudii9

ASKER

is it file or directory/folder size?
Look at the permissions.  If the first character is a "d" then it's a directory.  If the first character is a "-" it's a file.

So, in your example above, that's a directory.
Avatar of gudii9

ASKER

drwxrwxrwx  4 lms      lms         45 Jan  4  2017 GGG3RR

then it is directory
find . -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

to search from your location.  or you can do a "find /path/to/GGG3RR" or "find GGG3RR" from the directory directly above it.
Avatar of gudii9

ASKER

-rw-r--r--  1 lms      lms        532 Oct 10  2014 Register.sh

what is above?
it starts with - neither d nor a??
It starts with a "-", so it's a file.  The filename suggests that it's a script but the permissions are not set to execute and, therefore, cannot be run until the permissions change.
Avatar of gudii9

ASKER

for one directory shows like below when i do
ls -al

drwxr-xr-x 2 abc lms      0 Aug  1 10:24 diag_images

here what is abc
and
what is lms
please advise
Avatar of gudii9

ASKER

Please read my answer above.  

https://www.experts-exchange.com/questions/29050619/unix-xyz-user-size-and-cleanup.html?anchorAnswerId=42255665#a42255665

to remove a hidden file (like rm -rfi .*) why i have to login as owner group i.e lms


where s to stop and start server i have to login as owner name i.e abc?


file_permissions    number_of_links   owner_name   owner_group   file_size   time_of_last_modification   filename/or/directoryname

why first owner_name coming then owner_group. I thought owner_group come first followed by owner_name?
please advise
it's owner name then owner group.

never do an rm -rfi on .*

use find appropriately to find dot files and delete those files are needed with minimal globbing.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's not true, serialband -- at least not on all platforms.  Permissions are different.  That's why I stick with sudo su - when I'm changing to the privileged account.
unless you're using some ancient posix unix.
 Some old Unix will not have a current version of sudo and therefore not have sudo -s or sudo -i options.  Not sure what permissions you mean.  You can limit sudo with /etc/sudoers configurations.
On Ubuntu, root doesn't inherit the environment with "sudo -s" that "sudo su -" provides.  This is not an old distribution.  It's about making sure that the account is privileged enough or has inherited the environmental variables properly.

I haven't thoroughly tested the two because I work mostly with CentOS.  And then, I don't use sudo except when called from scripts.
Author, would you please close this question?  It, along with several others, have been answered.
Avatar of gudii9

ASKER

5 ~]$ $ find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
-bash: $: command not found

when i gave above command says command not found how to fix this?
please advise
It looks like you copied an extra character.  Don't include the dollor ($) sign at the front of the command string when you copy the command.

find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'


P.S.
If you want the full root environment, then you need the -i option for sudo.
sudo -i
Avatar of gudii9

ASKER

find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
find: `/boot/lost+found': Permission denied

what it means?
It means that it's running the find through all directories and found /boot/lost+found' to be inaccessible to the find command.
Do you still need help?
Avatar of gudii9

ASKER

why it say inaccessable same sudo root issue?
Yes.  Only the root user has full access to everything.  Everyone else is a regular user and some directories are set off limits by default.  You may still get access denied if read and execute permissions are still set off for the root owner.


sudo find / -type f -size +500M -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
@gudi9
Is your system running nfs?  It's been a while since I've worked on nfs and I seem to recall that they create these temporary files that you can't remove because they're being held open over the network share.
.nfx00000aaaeeevvv suggests that it's an nfs file.