Check These Out
I have come across a situation in the past where someone has unlinked a file by running an 'rm' command against it while it was still being written to by a running process.
The problem manifested itself when a 'df' command showed a filesystem at 100%, but this did not match the total value of a 'du -sk *'.
When this happens, the process continues to write to the file but you can no longer see the file on the filesystem. Stopping and starting the process will, more often than not, get rid of the unlinked file, however this is not always possible on a live server.
When you are in this situation you can use the 'lsof' command above to get the PID of the process that owns the file (in the sample output this is 23521).
Run the following command to see a sym-link to the file (marked as deleted):
$ cd /proc/23521/fd && ls -l
Truncate the sym-link to regain your disk space:
$ > /proc/23521/fd/3
I should point out that this is pretty brutal and *could* potentially destabilise your system depending on what process the file belongs to that you are truncating.
The command shows the real power of the pdftk tool, you can do basically everything you want with multiple pdf's.
In the command a book is created from chapters, headings and covers.
queries local memcached for stats, calculates hit/get ratio and prints it out.
dir1 and all its subdirs and subdirs of subdirs ... but *no files*
will be copied to dir2 (not even symbolic links of files will be made).
To preserve ownerships & permissions:
$ cp -Rps dir1 dir2
Yes, you can do it with
$ rsync -a --include '*/' --exclude '*' /path/to/source /path/to/dest
too, but I didn't test if this can handle attributes correctly
(experiment rsync command yourself with --dry-run switch to avoid
harming your file system)
You must be in the parent directory of dir1 while executing
this command (place dir2 where you will), else soft links of
files in dir2 will be made. I couldn't find how to avoid this
"limitation" (yet). Playing with recursive unlink command loop
maybe?
PS. Bash will complain, but the job will be done.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
Output the current time in Swatch “Internet Time”, aka .beats. There are 1000 .beats in a day, and @0 is at 00:00 Central European Standard Time. This was briefly a thing in the late 1990s. More details:
https://2020.swatch.com/en_ca/internet-time/
The alias is rather quote heavy to protect the subshell, so the bare command is:
$ echo '@'$(TZ=GMT-1 date +'(%-S + %-M * 60 + %-H * 3600) / 86.4'|bc)
Shows all block devices in a tree with descruptions of what they are.
A similar version for Bash that doesn't require cut and shortens the function in a few places. And it uses local variables. (similar to a version by eightmillion in a comment on the another version)