Questions tagged [cat]

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

144 questions
383
votes
3 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,001
  • 17
  • 51
  • 61
54
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,359
  • 4
  • 29
  • 39
47
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
  • 583
  • 1
  • 4
  • 9
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?
haboutnnah
  • 541
  • 4
  • 7
39
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…
schizodactyl
  • 493
  • 1
  • 4
  • 4
35
votes
1 answer

Why is cat not changing the access time?

The second call to cat a file does not update the access time. I was expecting the access time to be updated ever time a file contents gets displayed. I see the same behaviour if I open the file in web browser. Its access time does not get updated…
nelaaro
  • 13,149
  • 30
  • 84
  • 111
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…
ftiaronsem
  • 593
  • 3
  • 7
  • 14
30
votes
3 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…
25
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
  • 915
  • 2
  • 12
  • 20
21
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,145
  • 12
  • 52
  • 62
20
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…
Cris Stringfellow
  • 769
  • 1
  • 6
  • 15
19
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.
18
votes
6 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
  • 567
  • 2
  • 6
  • 14
17
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,097
  • 3
  • 11
  • 22
16
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
  • 867
  • 9
  • 16
1
2 3
9 10