*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> truncate (1)              
Title
Content
Arch
Section
 

TRUNCATE(1)

Contents


NAME    [Toc]    [Back]

     truncate -- truncate or extend the length of files

SYNOPSIS    [Toc]    [Back]

     truncate [-c] -s [+|-]size[K|M|G] file ...
     truncate [-c] -r rfile file ...

DESCRIPTION    [Toc]    [Back]

     The truncate utility adjusts the length of each regular file given on the
     command-line.

     The following options are available:

     -c      Do not create files if they do not exist.	The truncate utility
	     does not treat this as an error.  No error messages are displayed
	     and the exit value is not affected.

     -r rfile
	     Truncate files to the length of the file rfile.

     -s [+|-]size[K|M|G]
	     If the size argument is preceded by a plus sign (+), files will
	     be extended by this number of bytes.  If the size argument is
	     preceded by a dash (-), file lengths will be reduced by no more
	     than this number of bytes, to a minimum length of zero bytes.
	     Otherwise, the size argument specifies an absolute length to
	     which all files should be extended or reduced as appropriate.

	     The size argument may be suffixed with one of K, M or G to indicate
 a multiple of Kilobytes, Megabytes or Gigabytes respectively.


     Exactly one of the -r and -s options must be specified.

     If a file is made smaller, its extra data is lost.  If a file is made
     larger, it will be extended as if by writing bytes with the value zero.
     If the file does not exist, it is created unless the -c option is specified.


     Note that, while truncating a file causes space on disk to be freed,
     extending a file does not cause space to be allocated.  To extend a file
     and actually allocate the space, it is necessary to explicitly write data
     to it, using (for example) the shell's `>>' redirection syntax, or dd(1).

DIAGNOSTICS    [Toc]    [Back]

     The truncate utility exits 0 on success, and >0 if an error occurs.  If
     the operation fails for an argument, truncate will issue a diagnostic and
     continue processing the remaining arguments.

SEE ALSO    [Toc]    [Back]

      
      
     dd(1), touch(1), truncate(2)

STANDARDS    [Toc]    [Back]

     The truncate utility conforms to no known standards.

HISTORY    [Toc]    [Back]

     The truncate utility first appeared in FreeBSD 4.2.

AUTHORS    [Toc]    [Back]

     The truncate utility was written by Sheldon Hearn
     <sheldonh@starjuice.net>.


FreeBSD 5.2.1			 July 4, 2000			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
ftruncate OpenBSD truncate or extend a file to a specified length
truncate FreeBSD truncate or extend a file to a specified length
ftruncate FreeBSD truncate or extend a file to a specified length
truncate OpenBSD truncate or extend a file to a specified length
truncate HP-UX truncate a file to a specified length
truncate Linux truncate a file to a specified length
ftruncate NetBSD truncate a file to a specified length
ftruncate HP-UX truncate a file to a specified length
truncate NetBSD truncate a file to a specified length
uitrunc Tru64 truncate a floating-point number
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service