Skip to content
KAGETERM

$ ./metin

Viewing text

Last updated: status: in effect

Look inside files, follow them live, count and sort.

About this topic

Tool
Core commands
Level
Basic
Commands
6
Access
Free

Commands

cat /etc/hostname

Prints the whole file to the screen.

cat
prints file contents
/etc/hostname
the file that holds the machine name

less /var/log/syslog

Lets you page through a long file.

less
pager: move with arrow keys, search with /, quit with q
/var/log/syslog
the system log

head -n 20 access.log

Shows the first 20 lines of the file.

head
shows the start of a file
-n 20
number of lines
access.log
file

tail -f app.log

Follows lines as they are added to the file.

tail
shows the end of a file
-f
follow: keep printing as new lines arrive
app.log
file

wc -l users.csv

Prints the number of lines.

wc
word count: counts lines, words, bytes
-l
line count only
users.csv
file

sort names.txt | uniq -c

Counts repeated lines.

sort
sorts lines
|
pipe: feeds the output on the left to the command on the right
uniq
merges adjacent duplicates
-c
prefixes each line with its count

Start practising

Practise the commands in your browser: learn mode explains every part, exam mode shows only the question.

Open KAGETERM All topics