![]() |
![]() |
| Linux news | Newbie's Linux manual | Linux links | Link us | ||
| The Linux columns | Book reviews | ||
| DistroWatch + TuxReports | November 2, 2002 | |
Contents | Previous | Next | Download
head report.txt
View first 10 lines of the file, report.txt.
head -5 report.txt
View first 5 lines of the file, report.txt.
tail weblog
View last 10 lines of the file, weblog.
tail -20 weblog
View last 20 lines of the file, weblog.
cat /etc/fstab
View all of file /etc/fstab.
cat a.txt b.txt > ab.txt
Append (concatenate) b.txt to a.txt and redirect (>) result to ab.txt.
Intermediate tip:
You can also use cat on files in the /proc directory to display information about your system. For example, cat /proc/modules displays the kernel modules loaded, and cat /proc/pci displays information on your PCI devices. For further details, enter man proc.
tac log.txt
View all of file log.txt in reverse (last line first to first line last).
less dirs.txt
View the dirs.txt file in the less program, allowing you to view large files, line by line. (Press q to quit.)
Note:
The more program allows you to view text screen by screen, displaying at the bottom of the screen something like '--More--(86%)' to indicate 86% of the text has been viewed. The less program is the improved more that allows you to scroll up and down, line by line, using the cursor keys.
sort list.txt
Display contents of list.txt file in alphabetical order.
sort -r list.txt > sorted_list.txt
Same as above, but in reverse (-r) order, and output result to file, sorted_list.txt.
Contents | Previous | Next | Download
| About us | |
| Latest stable kernel: 2.4.19 | Latest development kernel: 2.5.44 Copyright © 1998-2002 Linuxdot.org. Linux ® is a registered trademark of Linus Torvalds. |
|