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
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
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
Display a calendar in Linux
Answer:
Try the cal command.
# cal
January 2010
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
How to create a command shortcut
Answer:
Sometimes, it is useful to set a command shortbut, by using the alias command
E.g.
# alias hello='echo world'
# hello
world
How to set a shell variable
Answer:
Use the export command
# export foo=bar
# echo $foo
bar