Sikau

Linux and the shell · Day 4 · about 30 min

Reading and finding files

cat, head, tail, wc, file, globs and find.

Look before you touch

On a server you'll constantly peek at config files and logs, and hunt for files whose location you don't know. globs like *.log match many names at once, and find searches whole trees.

Peek, count, search

cat /etc/hostname
head -n 3 /etc/passwd
tail -n 2 /var/log/nginx/access.log
wc -l /var/log/nginx/access.log
file /etc/passwd /usr/bin/ls
ls /etc/*.conf /etc/host*
find /var/www -name "*.html"
find ~ -type d -name "*cafe*"

The rest of this lesson

  • Paging through big filesexplain
  • find in practiceexplain
  • What does the shell pass?predict
  • Which tool?match
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 16 lessons of Linux and the shell