Editors
To edit files use the following editors
- vi editor
- nano editor
Viewers
more
To read file use more command
and press space to scroll it down. To quit more press q
less
To read file use less command
less is more advanced and has many commands
Command | Description |
/abc | search and highlight abc text (use n to go to next occurrences |
g | goes to the top of the file |
G | goes to the bottom of the file |
q | quit |
head
To see first 10 lines o text file use
To see first *num* lines use
tail
To see last 10 lines o text file use
To see last *num* lines use
To update automaticaly on file change use fresher option
to quit fresher mode use Ctrl+c
cat
To see hidden characters use cat command
options:
- -A shows all non-printable characters
- -b numbers line with text but skip empty lines
- -n shows numbers of lines
- -s suppresses repeated empty lines
Text utilities
cut
Filter output from the text file
sort
sort files (often uses in pipes
tr
translate upper case to lower case
sed
powerful text editing tool
to print line #5 from text file
to delete line #2 from text file myfile
replace 'how' to 'HOW' in text file myfile
awk
search for specific patterns
to print 4th column from text file
to print 4th column for line contains amy from text file