Lecture 2 - File Transfer and Working with Commands
I. File Transfer
One easy way to create a file is using touch
Some common options:
For example:
We want to modify time create of a file we do the following steps.
*Working with file contents*
clear (Ctrl + L): clear screen.
cat: display contents of a file. Can also use to create text files by using cat > filename. You can choose an end marker for cat with << This construction is called a here directive and will end the cat command. And we can also use cat to copy contents of one file to another file cat file1 > file2
tac: display contents from bottom to top of a file.
less: writes the contents of a file onto the screen a page at a time. Press [space-bar] if you want to see another page, type [q] if you want to quit.
more: After each page, asks the user to hit a key to continue. Can also jump to the first occurrence of a keyword (/ command).
head -n: The command head writes the first n lines of a file to the screen.
tail -n: The command head writes the last n lines of a file to the screen.
wc: Word Count.