Linux: Logs, Cron & Archiving

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/48

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:53 AM on 7/18/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

49 Terms

1
New cards

/var/log

Standard directory where most system and application logs live

2
New cards

syslog (Ubuntu) vs messages (RHEL/CentOS)

General system log — same purpose, different filename by distro

3
New cards

auth.log (Ubuntu) vs secure (RHEL/CentOS)

Authentication/security events — SSH logins, sudo usage — same purpose, different filename by distro

4
New cards

dmesg

Kernel ring buffer messages — boot-time and hardware-level events

5
New cards

dmesg command

Can also be run directly as a command to view the kernel ring buffer live, not just read from a log file

6
New cards

/var/log//

Many applications (nginx, mysql, etc.) get their own log subdirectory

7
New cards

tail -f (log files)

Follow/watch a flat log file live — same purpose as journalctl -f, but for non-systemd-managed logs

8
New cards

journalctl

Queries systemd's journal — a structured, binary log store, the modern complement to flat log files

9
New cards

journalctl -u

Logs for one specific systemd service

10
New cards

journalctl -f

Follow/tail logs live

11
New cards

journalctl -xe

Recent logs with extra context, common after a failure

12
New cards

journalctl --since

Time-scoped filtering (e.g. --since "1 hour ago")

13
New cards

journalctl -b

View logs since the last boot

14
New cards

journalctl -p err

Filter by priority/severity level

15
New cards

journalctl disk usage

The journal can grow large over time — journalctl --disk-usage shows current size, vacuum flags can trim it

16
New cards

journalctl --vacuum-size / --vacuum-time

Trims the journal down to a target size or age

17
New cards

logrotate

Automates management of log files — prevents excessive disk usage, maintains performance

18
New cards

/etc/logrotate.conf

Main global config — default rotation settings (frequency, compression, retention)

19
New cards

/etc/logrotate.d/

Per-service/application config files — take precedence over the global default

20
New cards

logrotate directives (common)

rotate (how many old logs to keep), compress, daily/weekly/monthly, size (rotate at a threshold instead of schedule)

21
New cards

Why logs matter for timestamps

Log correlation across multiple servers depends on accurate/synced clocks (NTP) — otherwise event ordering during an incident becomes unreliable

22
New cards

Cron

Time-based scheduler for running commands/scripts automatically

23
New cards

Cron field order

minute (0-59) hour (0-23) day-of-month (1-31) month (1-12) day-of-week (0-6, Sun=0)

24
New cards

Cron: 0 2 * * *

Every day at 2:00 AM

25
New cards

Cron: */15 * * * *

Every 15 minutes

26
New cards

Cron: 0 9 * * 1

Every Monday at 9:00 AM

27
New cards

Cron env variable gotcha

Cron jobs don't inherit your interactive shell's PATH or other env vars — use absolute paths or set PATH explicitly in the job

28
New cards

/etc/cron.d/

System-wide cron jobs, one file per job — often used by installed packages

29
New cards

/etc/crontab

The main system crontab — not tied to any single user's personal crontab

30
New cards

/etc/cron.allow and /etc/cron.deny

Control which users are permitted/denied use of crontab — allow takes precedence if both exist

31
New cards

cron.allow vs cron.deny precedence

If cron.allow exists, ONLY listed users may use crontab (deny is ignored). If only cron.deny exists, everyone EXCEPT listed users may use it

32
New cards

crontab -e

Edit your personal crontab

33
New cards

crontab -l

List current cron jobs

34
New cards

crontab -r

Remove all cron jobs

35
New cards

crontab -u

Edit another user's crontab (requires privileges)

36
New cards

Systemd Timers

Modern cron alternative — better logging (via journalctl), dependency management, catch-up on missed runs

37
New cards

tar

(tape archive) Bundles files/directories into a single .tar file — archiving, NOT compression

38
New cards

gzip

Compresses a single file, usually paired with tar first

39
New cards

Compression concept

Finds and eliminates redundancy in data, re-encoding it more efficiently rather than removing information

40
New cards

tar -cvf

Create an archive (c=create, v=verbose, f=filename)

41
New cards

tar -xvf

Extract an archive

42
New cards

tar -tvf

List contents without extracting

43
New cards

tar -czvf

Create AND compress (gzip) in one step

44
New cards

tar -xzvf

Extract a gzip-compressed tarball

45
New cards

gzip

Compress in place — DELETES the original file by default

46
New cards

gzip -k

Compress but keep the original file

47
New cards

gunzip

Decompress a .gz file

48
New cards

zip / unzip

Alternative archive format, cross-platform (Windows-compatible unlike tar), bundles AND compresses in one format

49
New cards

tar vs zip

tar+gzip is the Linux-native standard