-1
votes
3answers
64 views

cat /dev/null emptied my log file but size did not change

I'm quite new to Unix. Using Solaris 10 I faced the below issue. There is a large log file with size 9.5G. I tried to empty the file using the below command. # cat /dev/null file_log.txt By doing ...
3
votes
1answer
48 views

Does cat never read from terminal?

Chapter 43. Redirecting Input and Output of Unix Power Tools, Third Edition has to say this about cat command: Standard input (stdin) normally comes from your keyboard. Many programs ignore ...
10
votes
5answers
1k views

Difference between cat and '>' to zero out a file

Are these two commands any different on how they go about zero-ing out files? Is the latter a shorter way of doing the former? What is happening behind the scenes? Both $ cat /dev/null > ...
2
votes
1answer
68 views

< and << in UNIX /Linux

What is the option <<and < are used in linux for??? For example cat << abc.txt I know its a stupid question, but i was not able to search it on google as i did not know what ...
8
votes
3answers
395 views

Why does the less-than sign not work as a replacement for cat in bash?

I heard about "useless use of cat" and found some suggestions, but the following outputs nothing in my bash shell. < filename Using cat works as expected though. cat filename I'm using Fedora ...
16
votes
2answers
454 views

Why does this command create an enormously large file?

I was experimenting today with some append operations and, in my curiosity, ran this (where file1.txt was non-empty and file2.txt was empty): $ cat file1.txt >> file2.txt >> file1.txt ...
7
votes
1answer
816 views

Append same text to many files using cat or echo?

How can I write the same content to many text files by using cat or echo in only one command? For example I want to write "hello" to file1 and file2. I tried: echo "hello" >> file1 file2 ...
5
votes
2answers
985 views

Performance difference between stdin and command line argument

For some commands, it is possible to specify certain input as either stdin or a command line argument. Specifically, suppose command can take stdin input and a filename as command line argument, and ...
0
votes
1answer
234 views

Is 'some_program <some_file' faster than 'cat some_file | some_program'? [duplicate]

Possible Duplicate: Should I care about unnecessary cats? Both would be functionally equivalent, but when using cat wouldn't it be slower because you have a process first reading the file ...