Misc: Difference between revisions
Jump to navigation
Jump to search
Anthoanthop (talk | contribs) (Created page with "=How do I find how long ago a Linux system was installed ?= <syntaxhighlight lang="bash"> # tune2fs -l /dev/dm-0 | grep 'Filesystem created:' Filesystem created: Thu Fe...") |
Anthoanthop (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=How do I find how long ago a Linux system was installed ?= | = How do I find how long ago a Linux system was installed ? = | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
# tune2fs -l /dev/dm-0 | grep 'Filesystem created:' | # tune2fs -l /dev/dm-0 | grep 'Filesystem created:' | ||
Filesystem created: Thu Feb 4 05:46:35 2016 | Filesystem created: Thu Feb 4 05:46:35 2016 | ||
</syntaxhighlight> | |||
= Sort files/directories by size = | |||
<syntaxhighlight lang="bash"> | |||
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> | |||
= Prevent Bash to stop after the 1st command when you paste a bunch of cmds = | |||
Add: < "/dev/null" at the end. Ex: | |||
<syntaxhighlight lang="bash"> | |||
rsync -avz 172.16.2.1:/var/cache/nginx/ /var/cache/nginx/ < "/dev/null" | |||
rsync -avz 172.16.2.1:/usr/share/stickyadstv/ /usr/share/something/ < "/dev/null" | |||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 16:13, 18 January 2021
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
Prevent Bash to stop after the 1st command when you paste a bunch of cmds
Add: < "/dev/null" at the end. Ex:
rsync -avz 172.16.2.1:/var/cache/nginx/ /var/cache/nginx/ < "/dev/null"
rsync -avz 172.16.2.1:/usr/share/stickyadstv/ /usr/share/something/ < "/dev/null"