Essential Linux and Windows Log Commands for Troubleshooting

Classified in Technology

Written on in English with a size of 3.49 KB

Terminal and Log Command Examples

grep -i system /etc/passwd
grep -i ubuntu /etc/passwd
grep -i '*ubuntu*' /etc/passwd
grep -i "sync$" /etc/passwd
grep -E 'info|warn' /var/log/*log* && history | tail -n 2
Windows
findstr "*error*" C:\Windows\Logs\CBS\CBS.log
Select-String -Path "C:\Windows\Logs\dism\dism.log" -Pattern "2024-04 Manager"
findstr "^2024-01 | Manager" C:\Windows\Logs\DISM\dism.log
findstr /S /I /N "failed" C:\Windows\Logs\*.log
Get-EventLog -List
Get-EventLog -LogName System -Newest 25 | Format-List
wevtutil qe System /c:200 /rd:true /f:text | findstr /i "kernel"
wevtutil qe System /q:"*[System[TimeCreated[@SystemTime>='2023-09-01T00:00:00.000Z']]]" /f:text | findstr /i /c:"ProviderName: Disk"

Disk and Mount Commands

fdisk -l
mount /dev/sdb /mnt/windisk
mount /dev/sdb1 /mnt/windisk
touch /mnt/windisk/proba.txt
cat /mnt/windisk/proba.txt
umount /dev/sdb1
cat /mnt/windisk/prueba.txt
  • lsblk -o NAME,UUID
blkid

Package Management and APT Commands

apt list
apt search inkscape
apt show inkscape

dpkg -i /home/edu/Descargas/FreeFileSync_13.3.deb

dpkg -r FreeFileSync_13.3.deb

Cron and Anacron Entries

crontab -e
5 15 1 2 4 updatedb
cat /etc/anacrontab
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly

crontab -e
5 15 1 2 4 updatedb
45 23 * * * rm -r /var/spool/cups/tmp/

nano /etc/anacrontab
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
@monthly 30 touch /var/disk-free.log > %YY%%MM%%DD% +

Tarea Examples

Tarea 5
Tarea 3

System Information Commands

free -h
df -h
du -h -d 1 /var/
who
hardinfo
lsusb
lspci -v

Duplicate / Raw Entries (preserved)

The original document included duplicated and raw entries; all content is preserved below with corrected typos and capitalization.

grep -i system /etc/passwd
grep -i ubuntu /etc/passwd
grep -i '*ubuntu*' /etc/passwd
grep -i "sync$" /etc/passwd
grep -E 'info|warn' /var/log/*log* && history | tail -n 2
Windows
findstr "*error*" C:\Windows\Logs\CBS\CBS.log
Select-String -Path "C:\Windows\Logs\dism\dism.log" -Pattern "2024-04 Manager"
findstr "^2024-01 | Manager" C:\Windows\Logs\DISM\dism.log
findstr /S /I /N "failed" C:\Windows\Logs\*.log
Get-EventLog -List
Get-EventLog -LogName System -Newest 25 | Format-List
wevtutil qe System /c:200 /rd:true /f:text | findstr /i "kernel"
wevtutil qe System /q:"*[System[TimeCreated[@SystemTime>='2023-09-01T00:00:00.000Z']]]" /f:text | findstr /i /c:"ProviderName: Disk"
  • VFS
fdisk -l
mount /dev/sdb /mnt/windisk
mount /dev/sdb1 /mnt/windisk
touch /mnt/windisk/proba.txt
cat /mnt/windisk/proba.txt
umount /dev/sdb1
cat /mnt/windisk/prueba.txt
  • lsblk -o NAME,UUID
blkid

Terea 3
apt list
apt search inkscape
apt show inkscape

dpkg -i /home/edu/Descargas/FreeFileSync_13.3.deb

dpkg -r FreeFileSync_13.3.deb

crontab -e
5 15 1 2 4 updatedb
cat /etc/anacrontab
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly

crontab -e
5 15 1 2 4 updatedb
45 23 * * * rm -r /var/spool/cups/tmp/

nano /etc/anacrontab
@monthly 15 cron.monthly run-parts --report /etc/cron.monthly
@monthly 30 touch /var/disk-free.log > %YY%%MM%%DD% +

Tarea 5
free -h df -h du -h -d 1 /var/ who hardinfo lsusb lspci -v

Related entries: