Linux: How to find size of the current directory

In linux, the directory is just a pointer to the location. What we really want if the size of all the files that are contained in that directory. To see the individual sizes of all the directories inside the current directory:

du -sh *

the ‘s’ option provides a summary, the ‘h’ option provides the output in a human readable format. There is a ‘c’ option which can combine the sizes and give a total.

du -h --max-depth=1 | sort -hr

provides the size of all sub-folders at the first level. Sort command sorts the output, with the ‘r’ option meaning ‘reverse’, i.e. the largest one first.




Documentum: How to find physical file location

In order to find the physical file location of any file:

select i_contents_id from dm_document where folder('/<CABINET_NAME>', descend) and object_name = '<File Name>'

execute GET_PATH for '<content_id returned from above>'


SQL: How to insert new rows that are copies of existing rows

In SQL you can create/insert new rows that are essentially copies of the old rows, without needing to specify every column value.

Let’s say you have a table called “EVENTS” with the following columns:

  • event_name
  • location_name
  • promoter_name
  • event_date
  • promote_address
  • location_address

Now, let’s say you want to create a new row with all the same information except the event_name and event_date.

insert into events (event_name, location_name, promoter_name, event_date, promote_address, location_address) 
select 'new event' as event_name, location_name, promoter_name, 'todays date' as event_date, promote_address, location_address where promoter_name='Test1';

In the above sql, the select statement becomes the input for the insert statement. All the rows returned by the select statement will be inserted as new rows exactly as returned. Which means that instead of the ‘event_name’ as stored in the database, it will insert ‘new event’ as the event_name for each and every row. This is useful if you are trying to create new rows with the same “event_name” value.


Documentum: How to recover database password


Copy the content of dbpasswd.txt file from the following folder:


Content will be in this format:


Open IAPI, and do the following:

$>Please enter a docbase name (docubase): <REPOSITORY NAME>
Please enter a user (dmadmin):
Please enter password for dmadmin:



Linux: vi search and replace command


The format of the command is given below:



In order to replace the word “hate” with “love”.

  • Open the file in vi
  • Hit [Esc] (Esc in vi lets you type commands instead of typing content)
  • Type : (colon) followed by %s/hate/love/ and hit [Enter] key.

Above command will replace first occurrence of word hate with love on all lines. The % represents all lines.

To replace all occurrences of word hate with love on all lines, use the g option (g stands for global, indicating all occurrences).


You can replace g with a number 1,2,…N to change only the n’th occurrence on each line.
Use find and replace on line ranges (match by line numbers)

You can also make changes on range of lines i.e. replace first occurrence of hate with love on lines 5 through 20 only, enter:


Following command will replace first occurrence of hate with love starting at the current line for the next 100 lines:


Word Match

You can match by words i.e. find the next line containing a word “test”, then replace all occurrences of hate with love:


To specify ranges:


Documentum D2: About D2 returns

If you click on the About D2 link, it returns the complete file which may include your servername or ip address. This is a security vulnerability. To resolve this issue, open the D2.war and D2-Config.war files, find the following file:


Open the file above and find the following file:

Comment out the lines below:
<tab id="tabDebug" condition_visible="getValue(ctrlKey).notEquals('') &amp;&amp; getValue(altKey).notEquals('')">
                        <memo id="properties" rows="18" wrap="off" condition_enabled="false" assistance_type="java" assistance_java="com.emc.d2fs.dctm.ui.assistances.DebugProperties">