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
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
How to send message to a syslog
Answer:
Basically you need to use the logger command, e.g.
logger "have fun with logger"
You will find the log went to /var/log/messages
Jan 15 23:08:34 www john: have fun with logger