Now that we know how to move about our file system, it's time to start interacting with some of our files! For this portion, we'll start in our c2s2
folder from before, and assume that we have another empty folder named test
inside of the c2s2
folder:
cd ~/c2s2 ls
We'll also start by creating a file called foo.txt
with the text "foo bar" inside of it. We'll use the following command to do this - don't worry too much about it right now, we'll cover it later, but we can think of it as sending "foo bar" to the new file:
echo "foo bar" > foo.txt
Feel free to also do this with a code editor, if you've used one already!
For the sake of having another text file that's somewhat larger - we'll use the Gutenberg Bible, which you can store in a text file named gutenberg.txt
with the following command (don't worry, we'll cover this later as well):
wget https://www.gutenberg.org/cache/epub/10/pg10.txt -O gutenberg.txt
Viewing Files
To view the text of a file in the terminal, we can use the cat
command, which takes in as an argument the file we want to view the text of, and simply prints it all to the terminal