Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

useful difference between hardlink and copy

You can make multiple hard links to the same file without worrying about disk space. This is very useful (depending on how you use or implement it) in taking snapshots of directories, yum repositories, etc.

[Linux: marc@localhost tmp]$ dd if=/dev/zero of=bigfile bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB) copied, 0.0149572 s, 1.4 GB/s
 
[Linux: marc@localhost tmp]$ ln bigfile bigfile-ln
 
[Linux: marc@localhost tmp]$ cp bigfile bigfile-cp
 
[Linux: marc@localhost tmp]$ ls -lh bigfile*
-rw-r--r-- 2 marc marc 20M Feb 26 00:32 bigfile
-rw-r--r-- 1 marc marc 20M Feb 26 00:33 bigfile-cp
-rw-r--r-- 2 marc marc 20M Feb 26 00:32 bigfile-ln
 
[Linux: marc@localhost tmp]$ du -sh bigfile*
20M     bigfile
20M     bigfile-cp
 
[Linux: marc@localhost tmp]$ rm bigfile
 
[Linux: marc@localhost tmp]$ du -sh bigfile*
20M     bigfile-cp
20M     bigfile-ln

neat crontab header

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * (user) command to be executed


kudos to schurzi for this. I find it helpful, and I think the format is equally usable on script output having a multitude of tight columns.