Linux Tutorial | Matt Cooper - Open Source Support
Linux Tutorial | Matt Cooper - Open Source Support
Command line Tutorial

Find log entries between timestamps

 sed -rne '/Wed Aug 19 21:34:00/,/Wed Aug 19 21:40:00/ p' logfile.log

The timestamp in the log file in this case was in the following format:

Wed Aug 19 21:39:59 2020

August 20, 2020by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Command line Tutorial

Display the last reboot – Linux

last reboot | less
December 9, 2019by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Command line Tutorial

Find the reason for shutdown or reboot – Linux

last -x | head | tac

Examples of output:

runlevel (to lvl 0)   ... <-- first the system shuts down (init level 0)
reboot   system boot  ... <-- afterwards the system boots
runlevel (to lvl 2)   2.6.24-... Sat Sep 10 11:07 - 11:01 (2+23:34)
runlevel (to lvl 3)   ... <-- the system was running since this momemnt
reboot   system boot  ... <-- then we've a boot WITHOUT a prior shutdown
runlevel (to lvl 3)   3.10.0-693.21.1. Sun Jun 17 15:40 - 09:51  (18:11) 
December 9, 2019by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Command line Tutorial

Disk space not released after deleting files – Linux

Disk space remains the same pre and post file deletion. It is likely a process is still using the deleted file. To get a list of deleted files which are still marked open by processes:

lsof +L1

COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NLINK    NODE NAME
tuned   111 root    7u   REG  202,2     4333091     0 2141 /tmp/jar_cache23323.tmp (deleted)

Simply kill the process to dump the file in question:

kill -9 111
May 23, 2019by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Apache, Command line Tutorial

How much memory is apache using?

ps -o rss -C httpd | tail -n +2 | (sed 's/^/x+=/'; echo x) | bc

December 23, 2018by Matt Cooper
FacebookTwitterPinterestGoogle +Stumbleupon
Page 1 of 512345»

About me

Hi, I'm Matt Cooper. I started this blog to pretty much act as a brain dump area for things I learn from day to day. You can contact me at: matt@linuxtutorial.co.uk

Recent Comments

  • Andrew on Export list of Amazon EC2 Instances to CSV
  • Matt Cooper on Proxmox – add a second hard drive to node for Backups
  • karis on Proxmox – add a second hard drive to node for Backups
  • Matt Cooper on Remote MySQL Database – Slow Connection
  • Matt Cooper on Bash script to send public IP address to Email

Categories

  • AdvancedTomato
  • Amazon AWS
  • Amazon Linux
  • Amazon S3
  • Apache
  • Apache Kafka
  • Backup Tutorial
  • Bash Scripting
  • Centos Tutorial
  • CloudFlare
  • Command line Tutorial
  • CPanel Troubleshooting
  • CPanel Tutorial
  • Debian Troubleshooting
  • Debian Tutorial
  • DKIM
  • Docker
  • EC2
  • ESXi
  • Faildows
  • Google Adwords
  • Google Analytics
  • Google Chromebook
  • Google Mail
  • graylog
  • IAM
  • imapsync
  • iRedmail Tutorial
  • ISPConfig3 Tutorial
  • Java
  • ldap
  • letsencrypt
  • MyDNS
  • MySQL Troubleshooting
  • MySQL Tutorial
  • Nest Install
  • Netbeans
  • Nginx
  • Nginx Troubleshooting
  • openssl
  • PCI Compliance
  • Percona
  • PHP
  • Plex Media Server Tutorial
  • Postfix
  • Proxmox Tutorial
  • Pure FTPd
  • Resourcespace Tutorial
  • Route 53
  • Rsync Tutorial
  • Security
  • Smoothwall Troubleshooting
  • Smoothwall Tutorial
  • SSH
  • tcpdump
  • Thunderbird
  • Tomcat Troubleshooting
  • Ubuntu Tutorial
  • Uncategorized
  • Unison
  • vmware
  • vzdump
  • WHM
  • Wireshark
  • Wordpress Troubleshooting
  • WordPress Tutorial

“See, you not only have to be a good coder to create a system like Linux, you have to be a sneaky bastard too." Linus Torvalds

© 2017 copyright www.linuxtutorial.co.uk // All rights reserved