Linux training 02
File, redirection, pipe:
- Run the following command and check what happens:
$ cal $ cal > test.txt $ cat test.txt $ ls -l test.txt $ rm test.txt $ cat test.txt
What are the meaning of ">", "ls -l", "rm"?
- Run the following command and check what happens:
$ date $ date > test.txt $ cat test.txt $ date >> test.txt $ date > test.txt $ cat test.txt
What are the meaning of ">>"? How is it different from ">"?
- Run the following command and check what happens:
$ cal $ cal | head -4 $ cal | tail -4 $ cal | head -5 | tail -2 $ cal | wc $ cal | head -4 | wc $ man head $ man tail $ man wc
What are the meaning of "|", head, tail, wc?
Check points
- A symbol ">" means "redirection". It gives outputs not to display but to a file.
- "cat" command displays contents of a file.
- "ls -l" command displays size, date of creation, etc. of a file.
- "rm" command removes (deletes) a file.
- A symbol "|" means "pipe". It gives outputs not to display but to a next command.
- Using pipes, you can connect many commands.
Keyword(s):
References: