Commands tagged sparse files (3)

  • This causes cp to detect and omit large blocks of nulls. Sparse files are useful for implying a lot of disk space without actually having to write it all out. http://en.wikipedia.org/wiki/Sparse_file You can use it in a pipe too: dd if=/dev/zero bs=1M count=5 |cp --sparse=always /dev/stdin SPARSE_FILE Show Sample Output


    4
    cp --sparse=always <SRC> <DST>
    h3xx · 2011-09-07 08:02:50 0
  • Prints the path/filename and sparseness of any sparse files (files that use less actual space than their total size because the filesystem treats large blocks of 00 bytes efficiently).


    2
    find -type f -printf "%S\t%p\n" 2>/dev/null | gawk '{if ($1 < 1.0) print $1 $2}'
    thetrivialstuff · 2011-07-02 19:22:49 1
  • Prints the path/filename and sparseness of any sparse files (files that use less actual space than their total size because the filesystem treats large blocks of 00 bytes efficiently). Uses a Tasker-esque field separator of more than one character to ensure uniqueness. Show Sample Output


    0
    find -type f -printf "%S=:=%p\n" 2>/dev/null | gawk -F'=:=' '{if ($1 < 1.0) print $1,$2}'
    TommyTwoPuds · 2019-02-06 14:12:32 0

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

tcpdump top 10 talkers
capture 2000 packets and print the top 10 talkers

Print info about your real user.
To get your effective user: whoami

get a rough estimate about how much disk space is used by all the currently installed debian packages
The vaule is expressed in megabytes

Finding files with different extensions
This is the way how you can find header and cpp files in the same time.

Which Twitter user are you?
This will tell you which twitter user you are chronologically. For example, a number of 500 means you were the 500th user to create a twitter account.

Find the package that installed a command

Execute a file in vim with the #!/bin/interpreter in the first line

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Mortality Countdown
watch the seconds of your life tick away - replace YYYY-mm-dd HH:MM:ss w/ your birthtime.

Flush and then immediately start watching a file
This is useful for keeping an eye on an error log while developing. The !^ pulls the first arg from the previous command (which needs to be run in a sub-shell for this shortcut to work).


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: