Ch4. Create, View, and Edit Text Files
Standard input, standard output, and standard error:

[root@master ~]# date > /tmp/saved-timestamp
[root@master ~]# tail -n 100 /var/log/dmesg > /tmp/last-100-boot-messages
[root@master ~]# cat file1 file2 file3 file4 > /tmp/all-four-in-one
[root@master ~]# ls -a > /tmp/my-file-names
Append output to an existing file:

[root@master ~]#echo "new line of information" >> /tmp/many-lines-of-information
[root@master ~]# find /etc -name passwd 2> /tmp/errors
[root@master ~]# find /etc -name passwd > /tmp/output 2> /tmp/errors
[root@master ~]# find /etc -name passwd > /tmp/output 2> /dev/null
[root@master ~]# find /etc -name passwd &> /tmp/save-both
[root@master ~]# find /etc -name passwd >> /tmp/save-both 2>&1
Constructing pipe lines:


[root@master ~]# ls -l /usr/bin | less
[root@master ~]# ls | wc -l > /tmp/how-many-files
[root@master ~]# ls -t | head -n 10 > /tmp/ten-last-changed-files
[root@master ~]# ls -l | tee /tmp/saved-output
[root@master ~]# ls -l | tee /dev/pts/0 | mail -s subject
Editing files with Vim:
Vim Operating Modes

[root@master ~]# vim file1
• The u key undoes the most recent edit.
• The x key deletes a single character.
• The :w command writes (saves) the file and remains in command mode for more editing.
• The :wq command writes (saves) the file and quits Vim.
• The :q! command quits Vim, and discards all file changes since the last write.
Editing files with gedit:
Applications > Accessories > gedit
[root@master ~]# gedit file1
Editing files with nano:
[root@master ~]# nano file1