ebooksgratis.com

See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
cat (Unix) - Wikipedia, the free encyclopedia

cat (Unix)

From Wikipedia, the free encyclopedia

The cat command is a standard Unix program used to concatenate and display files. The name is from catenate, a synonym of concatenate.

Contents

[edit] Specification

The Single Unix Specification specifies the behavior that each of the files given in sequence as arguments will write their contents to the standard output in the same sequence, and mandates one option, -u, where each byte is printed as it is read.

If the filename is specified as -, then cat will read from standard input at that point in the sequence. If no files are specified, cat will read from standard input.

[edit] Extensions

Both the BSD versions of cat (as per the OpenBSD manpage) and the GNU coreutils version of cat specify the following options:

  • -b (GNU only: --number-nonblank), number non-blank output lines
  • -n (GNU only: --number), number all output lines
  • -s (GNU only: --squeeze-blank), squeeze multiple adjacent blank lines
  • -v (GNU only: --show-nonprinting), displays nonprinting characters as if they were visible, except for tabs and the end of line character
  • -t on BSD, -T on GNU, implies -v but also display tabs as ^I
  • -e on BSD, -E on GNU, implies -v but also display end-of-line characters as $

[edit] Unix culture

[edit] Jargon File definition

The Jargon File version 4.3.3 lists this as the definition of cat:

  1. To spew an entire file to the screen or some other output sink without pause (syn. blast). 2. By extension, to dump large amounts of data at an unprepared target or with no intention of browsing it carefully. Usage: considered silly. Rare outside Unix sites. See also dd, BLT.
Among Unix fans, cat(1) is considered an excellent example of user-interface design, because it delivers the file contents without such verbosity as spacing or headers between the files, and because it does not require the files to consist of lines of text, but works with any sort of data.
Among Unix critics, cat(1) is considered the canonical example of bad user-interface design, because of its woefully unobvious name. It is far more often used to blast a single file to standard output than to concatenate two or more files. The name cat for the former operation is just as unintuitive as, say, LISP's cdr.

[edit] cat and UUOC

UUOC (from comp.unix.shell on Usenet) stands for "Useless Use of cat". As received wisdom on comp.unix.shell observes, "The purpose of cat is to concatenate (or 'catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process." Nevertheless one sees people doing

cat file | some_command and its args ...

instead of the equivalent and cheaper

<file some_command and its args ...

or (equivalently and more classically)

some_command and its args ... <file

Since 1995, occasional awards for UUOC have been given out, usually by Perl luminary Randal L. Schwartz. There is a web page devoted to this and other similar awards. In British hackerdom the activity of fixing instances of UUOC is sometimes called demoggification.

[edit] Zcat

zcat is a UNIX program similar to cat (Unix), that operates on gzip or compress -compressed files. It uncompresses the file to the standard output. It is equivalent to gunzip -c.

[edit] See also

[edit] External links

[edit] Manual pages

[edit] Other


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -