Misc: Difference between revisions

From Anthony Pastor Wiki Notes - Verba volant, scripta manent
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
du -skh * | sort -rn
du -skh * | sort -rn
</syntaxhighlight>
= List opened files for a specific thread =
When we have a process with many threads and we're looking for opened files for a specific child we could proceed that way:
* Get the PiD with ps / top / whatever.
* Get the TiD (thread id) we are interested in.
* Execute the following command (replace PiD & TiD with expected values):
<syntaxhighlight lang="bash">
ls -l /proc/PiD/task/TiD/fd
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:19, 5 June 2016

How do I find how long ago a Linux system was installed ?

# tune2fs -l /dev/dm-0  | grep 'Filesystem created:'
Filesystem created:       Thu Feb  4 05:46:35 2016

Sort files/directories by size

du -skh * | sort -rn

List opened files for a specific thread

When we have a process with many threads and we're looking for opened files for a specific child we could proceed that way:

  • Get the PiD with ps / top / whatever.
  • Get the TiD (thread id) we are interested in.
  • Execute the following command (replace PiD & TiD with expected values):
ls -l /proc/PiD/task/TiD/fd