Questions tagged [cat]

A UNIX utility for concatenating files or input streams together. Do not use for questions about the animal.

148 questions
426
votes
4 answers

What is the Windows equivalent of the Unix command cat?

I want to do exactly what unix "cat" does, but on my PC. Is there a simple equivalent command for the Windows command line? Specifically I want to create a file from all the files of a given type in a folder In Unix: cat *fna…
Kirt
  • 7,561
58
votes
5 answers

Unix cat starting from line

What is the best way to output from a file starting from a specific line (big number like 70000). Something like: cat --line=70000
vonhogen
  • 2,459
53
votes
8 answers

What is the general consensus on "Useless use of cat"?

When I pipe multiple unix commands such as grep, sed, tr etc. I tend to specify the input file that is being processed using cat. So something like cat file | grep ... | awk ... | sed ... . But recently after a couple of comments left on my answers…
arunkumar
  • 643
42
votes
2 answers

Why can I cat /dev?

I can cat /dev, I can ls /dev, I can't less /dev. Why does cat let me cat this directory but no other directories?
41
votes
4 answers

Change Behavior of Linux Power Button

I have a headless linux mint machine that I use for a file server and other things. It's been working great for me for a few years, but there's one issue - my cat likes to hang out on top of it, and when she climbs off and on she occasionally steps…
41
votes
1 answer

Why is cat not changing the access time?

Calling cat a second time on a file doesn't update its access time. I was expecting the access time to be updated every time a file's contents get displayed. I see the same behaviour if I open the file in a web browser. Its access time does not get…
nelaaro
  • 14,139
  • 30
  • 88
  • 115
34
votes
4 answers

Using -replace on pipes in powershell

I want to test out a replace before I use it, so I'm trying to write a quick online command to see what the output is. However, I'm not sure what the syntax is. What I want to do is something like cat file | -replace "a", "b" What is the correct…
31
votes
18 answers

List only the device names of all available network interfaces

I want to get a list of all available Network-Device Names on my Linux server. I figured that ifconfig would do the job, however ifconfig produces quite much output: eth0 Link encap:Ethernet Hardware Adresse 08:00:27:fc:5c:98 inet…
26
votes
4 answers

Why does this not work? "ls *.txt | xargs cat > all.txt" (all files into single txt document)

Why does this not work? ls *.txt | xargs cat > all.txt (I want to join the contents of all text files into a single 'all.txt' file.) find with -exec should also work, but I would really like to understand the xargs syntax. Thanks
ajo
  • 945
  • 2
  • 12
  • 20
24
votes
4 answers

Are there any options to let cat output with color?

If I want to output a C source code file with syntax highlighting, can I use cat?
Jichao
  • 7,940
22
votes
2 answers

pipe and stdin redirection to cat

Why does echo "hello world" | cat works while cat < echo "hello world" does not? My (incorrect) intuition is that pipe would redirect stdout to cat as stdin.
21
votes
7 answers

how to copy entire linux root filesystem to new hard drive on with ssh and tar

I need to transfer an entire linux root filesystem off of a failing hard drive onto another computer with an open, available partition. I've pretty sure this involves tar and ssh, but I can't remember exactly how to do this. I'm imaging probably…
CHK
  • 607
21
votes
7 answers

Cat file to terminal at particular speed of lines per second

I'm lazy and I could write a script to do this, but I'm even too lazy to think of how to do it. I often do things like : cris$ python runexperiment.py > output.txt cris$ cat output.txt Sometimes when looking at the long output of an experiment I…
20
votes
7 answers

Cat command and echo

I'd like to concatenate the output from echo with content of a file. I've tried the following comand: echo "abc" | cat 1.txt > 2.txt but the 2.txt file only contains the content from 1.txt. Why doesn't it work?
Ringger81
  • 1,397
  • 3
  • 13
  • 28
18
votes
2 answers

lossless concatenation of ogg vorbis files

I have a couple of ogg vorbis files, all encoded with the exact same properties that I want to concatenate into a single file. I know that the ogg vorbis format supports plain concatenation of multiple files like: $ cat file1.ogg file2.ogg >…
josch
  • 988
1
2 3
9 10