Show the content of gzipped text file
Answer:
Use the zcat command, e.g.
# zcat text.gz
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Show the content of gzipped text file
Answer:
Use the zcat command, e.g.
# zcat text.gz
Sending both output and error message to same file
Answer:
Pick any of the following methods
1.
./foobar &> output.txt
2.
./foobar >& output.txt
3. Most popular
./foobar > output.txt 2>&1
Save program output and error to different files
Answer:
Assume you are going to execute a program called foobar, and it emits to both the standard output and standard error. You want to save them into different files, try
# ./foobar 1> output.txt 2> error.txt
or simply
# ./foobar > output.txt 2> error.txt
How to save the output of ls command?
Answer:
You might have tried the following
# ls > output.txt
But the format in output.txt is not the same as you executed the ls command.
Use the -C flag
# ls -C > output.txt
How to view output in Hex
Answer:
Use the hexdump command,
# hexdump test.txt
0000000 6261 0a63
0000004
To display hex+ASCII (Canonical) altogether
# hexdump -C test.txt
00000000 61 62 63 0a |abc.|
00000004