Linuxgym
Chapter 1: The Filesystem
Create a file
Create a file called "hello.world" (without the quotes).
[nour@localhost ch1]$ touch hello.world
Create a directory
Create a directory called "otherworld" (without t
...
Linuxgym
Chapter 1: The Filesystem
Create a file
Create a file called "hello.world" (without the quotes).
[nour@localhost ch1]$ touch hello.world
Create a directory
Create a directory called "otherworld" (without the quotes) within your ch1-fdr directory.
[nour@localhost ch1]$ mkdir otherworld
Store a calendar
Store the 2008 calendar produced by the "cal" command in the file "calendar" with no modifications to the output of
the "cal" command.
[nour@localhost ch1]$ cal > calendar
List visible files
List all (non-hidden) files in the directory "/usr/local/linuxgym-data/gutenberg" and store this list into a file called
"listvis". Ensure that this is exactly the output of the command "ls".
[nour@localhost ch1]$ ls /user/local/linuxgum-data/gutenberg > listvis
List all files
List all files in the directory "/usr/local/linuxgym-data/gutenberg" (including hidden files, but NOT including
directories) and store this list into a file called "allfiles". Ensure that this is exactly the output of the command "ls". It
may be helpful to consider the "all" and "almost-all" options in the ls manual page.
[nour@localhost ch1]$ ls –A /user/local/linuxgum-data/gutenberg > allfiles
Top of file
The "cat" function prints out the contents of a file. For example "cat /usr/local/linuxgym-data/census/aj_malenames.txt" shows you an alphabetically ordered list of male names recorded by the US Census Bureau.
Because the list scrolls off the top of the screen, you can not easily read the first 10 names. The "head" command
solves this problem. Experiment with the "head" command and store the first 10 lines from the file aj_malenames.txt into a file called "first-ten-names.txt".
[nour@localhost ch1]$ head /user/local/linuxgum-data/census/a-j_malenames.txt >
first-ten-names.txt
Merging files
The "cat" function which prints out the contents of a file, can be used to print the contents of several files by giving it
more than one argument. In the directory /usr/local/linuxgym-data/census/ there are two files: a-j_malenames.txt
and k-z_malenames.txt.
Use "cat" to print out both of these files and store the output in a file called "a-z_malenames.txt" in the correct
order.
[nour@localhost ch1]$ cat /user/local/linuxgum-data/census/a-j_malenames.txt >
a-z_malenames.txt
[nour@localhost ch1]$ cat /user/local/linuxgum-data/census/k-z_malenames.txt >>
a-z_malenames.txt
[Show More]