TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Lesser-Known Options of Well-Known Unix/Linux Commands

1 pointsby GarethXover 2 years ago

1 comment

dementisover 2 years ago
This is where reading both the &quot;man&quot; pages and the &quot;info&quot; page on a command really pays dividends. I would also recommend going back and revisiting the man pages for a command after every major OS update as new features sometimes get added.<p>For example on the df command there is a &quot;-P --portability&quot; option to have the output format changed to be POSIX compatible which isn&#x27;t very helpful by itself. But if you look at what command options does with &quot;info df&quot; then it paints a more complete picture. I use that command option for bash scripting since it forces all the output to be on a single line and makes some things easier.<p>‘-P’ ‘--portability’ Use the POSIX output format. This is like the default format except for the following:<p><pre><code> 1. The information about each file system is always printed on exactly one line; a mount device is never put on a line by itself. This means that if the mount device name is more than 20 characters long (e.g., for some network mounts), the columns are misaligned. 2. The labels in the header output line are changed to conform to POSIX. 3. The default block size and output format are unaffected by the ‘DF_BLOCK_SIZE’, ‘BLOCK_SIZE’ and ‘BLOCKSIZE’ environment variables. However, the default block size is still affected by ‘POSIXLY_CORRECT’: it is 512 if ‘POSIXLY_CORRECT’ is set, 1024 otherwise. *Note Block size::. </code></pre> Another favorite which I don&#x27;t see getting used a lot(and isn&#x27;t available on older systems) is &quot;du --apparent-size&quot; which calculates the disk usage with any sparse files fully expanded. Which is a niche use case but does come in handy to know.