Viewing The Log File
Part of the Fundamentals section of Coddy's Terminal journey — lesson 49 of 82.
Challenge
EasyNow that you've seen the full log file, let's practice viewing specific portions of it. When analyzing large log files, you often want to see just the beginning or end rather than the entire file.
Use head to display only the first 5 lines of server.log.
head -n 5 server.logTip: The
headcommand is useful for quickly previewing the structure of a log file. In the next lesson, you'll start filtering this log to find specific types of entries.
Try it yourself
cat server.logAll lessons in Fundamentals
4Directories
Create A DirectoryCopy A DirectoryMove And Rename A DirectoryDelete A DirectoryRecap - Directory Operations7File Content
Head And TailWord CountSort CommandUnique CommandGrep BasicsGrep With FlagsRecap - Text Detective10Log Analyzer Project
Project OverviewViewing The Log File2Navigation
Print Working DirectoryList FilesChange DirectoryAbsolute vs Relative PathsHome And Root DirectoryRecap - Find Your Way8Redirection
Standard OutputOverwrite To A FileAppend To A FileStandard InputStandard ErrorRecap - Log Builder6Wildcards And Patterns
The Star WildcardThe Question Mark WildcardBracket WildcardsCombining WildcardsRecap - Selective Operations9Piping
What Is A PipeChaining Two CommandsChaining Multiple CommandsPipe With GrepRecap - Data Pipeline