How to find total size of all files under the ownership of a user?

Consider a domain hosted in a server. Let us say a user test has got all the privileges for managing the domain (i.e. all files related to the domain is present under the home directory of the user:: ~test) . The user test may create several temp files while running various processes (associated with apache) in the/tmp directory of the server. In order to find the size of all files (individual file size +total size) created by the user in the /tmp directory we can use the command

find /tmp/ -user test -type f -exec du -ch {} +

Clarification

Commands used

find # to find files in file system

du # Disc Usage, report the amount of disk space used by the specified files and for each subdirectory

du, options used

-c # print grant total after all arguments have been processed)

-h # output in human readable format, ie size in K(kilobyte) or M (megabyte) instead of in bytes

Command Syntax

Find command with options -user -type and -exec

find /path/to/directory/ -user <uname> -type< filetype> -exec [command] {} +

-user uname # this option is used with find to pull out all the files owned by a specific user:: replace uname with the name of the user

-user test # to pull up all files owned by user type

-type filetype # specify the type of file

filetype maybe replaced with

f for regular file

d for directory

l for symbolic link

b for block special device file and

c character special device file

-type f # used to specify that only files of type regular file should be pulled up (directories are excluded)

-exec command {} +

-exec is used to run the specified command on the selected files (in this case the files in the output of find command)

The command field in -exec command {} + maybe replaced by any linux command which can work with files

{} (in this case) specifies that the input of the command comes from the output of the -exec option

+ is part of the exec syntax

; is normally used with exec in most cases instead of + , but in this case the use of ; wont output the total size, i.e. if the option -exec du -ch \; ( \ is used to escape out ; ) is given instead of option -exec du -ch + it wont give the total size of all the files found using the find command

This occurs since, ; when used with -exec will cause execution of the command du -ch separately for each file found using the find command. Thus the total size with du -ch will mean the size of each file instead of the size of all three

Let us say the output of the find command gives 3 files a, b and c; then

-exec du -ch {} \; # after find will mean

du -ch a

du -ch b

du -ch c

but if

-exec du -ch {} + # is used then the command will execute as follows

du -ch a b c # this will give the individual size of files a b and c along with the total size of all three at the bottom.

Example::

Finding the size (total and individual file size) of all files owned by user mobile in folder /var/mobile/balu

root@Balu~#find/var/mobile/balu/-usermobile-typef-execdu-ch{}+
496K /var/mobile/balu/books/GhostStory-JimButcher.epub
1.4M /var/mobile/balu/books/PatrickRothfuss-KingkillerChronicle02-TheWiseMan’sFear.epub
1.3M /var/mobile/balu/books/RichardAKnaak-Wolfheart.epub
648K /var/mobile/balu/books/Stackpole,MichaelA-TalionRevenant.epub
104K /var/mobile/balu/deb/com.chronic-dev.greenpois0n.corona_1.0-8.deb
8.0K /var/mobile/balu/deb/cowsay_1.1.deb
3.0M /var/mobile/balu/deb/eu.heinet.ifile_1.6.1-2.deb
8.0K /var/mobile/balu/info/arguments.txt
8.0K /var/mobile/balu/info/balu.txt
8.0K /var/mobile/balu/info/dont_delete
8.0K /var/mobile/balu/info/theos_installation
293M /var/mobile/balu/ipa/AralonSwordandShadowHD(v3.9os30).ipa
4.3M /var/mobile/balu/sng/Ninne-VineethSreenivasan.mp3
6.7M /var/mobile/balu/sng/SonicAdventure-OpenYourHeart.mp3
311M total

NameserverIPs option not listing entries in WHM

When you try to access the name-server IPs from WHM >> Main >> DNS Functions >> Nameserver IPs it either shows no IPs or show incorrect information.
To fix the issue you need to correct the entries for the name-servers IP in the below two files ::
Firstly, check the entries in the /etc/nameserverips file and it should show the below output ::
==================================
root@server [~]# cat /etc/nameserverips
x.x.x.x=ns1.yourdomain.com
x.x.x.x=ns2.yourdomain.com
==================================
And if the entries in the above files are correct then check the next file it should show the below output ::
======================================
root@server [~]# cat /var/cpanel/nameserverips.yaml
x.x.x.x: 1
count: 1
x.x.x.x: 1
count: 1
==========================================
If the above entries are missing in the above file then add those as shown in the example.

ADDING SRV RECORDS IN DNS

SRV record is called Service record and it is used to defining location in a DNS especially the hostname and port number, of servers for specified services. It is defined in RFC 2782, and its type code is 33. Internet protocols like SIP, XMPP will require SRV support by network elements.

To add the SRV record looking like:

_service._protocol.name TTL class SRV priority weight port target

Examples:-

_sipfederationtls._tcp 3600 IN SRV 1 100 5061 sipfed.example.com.

_sip._tcp 3600 IN SRV 1 100 443 sipdir.example.com.

Service

Defines the symbolic service name

_http – web service

_ftp – file transfer service

_ldap – LDAP service

_imap – IMAP mail service

_PKIXREP – PKIX Repository (X.509 certificates)

Protocol

The transport protocol of the desired service

_tcp – TCP protocol

_udp – UDP protocol

name

the domain name for which this record is valid.

ttl

Optional. Standard TTL parameter

class

Optional. Standard CLASS parameter

priority

The relative Priority of this service (range 0 – 65535). Lowest is highest priority, usage is the same as the MX pref field.

weight

A relative weight for records with the same priority.Used when more than one service has the same priority. A 16 bit unsigned integer in the range 0 – 65535. The value 0 indicates no weighting should be applied.

port

the TCP or UDP port on which the service is to be found.

target

the canonical hostname of the machine providing the service.