0% found this document useful (0 votes)
42 views1 page

Chapter4 Creating Viewing and Editing Text Files

Uploaded by

Hassan Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views1 page

Chapter4 Creating Viewing and Editing Text Files

Uploaded by

Hassan Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

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:
[root@master ~]# vim file1
===============================================
Editing files with gedit:
Applications > Accessories > gedit
[root@master ~]# gedit file1
===============================================
Editing files with nano:
[root@master ~]# nano file1
===============================================

Best wishes
Abeer :)

You might also like