Skip to main content
  • Multicolored Grep

    Publish Date: September 27th, 2015 | Posted in Ubuntu Linux | Last Updated

    GREP_COLORS and How to Change the Color of Grep Output Note: You may use either double or single quotes. Choose your favorite and stick with it for consistency. We decided to use double and single in these examples for illustrative purposes. Scenario 1 – Access Logs: Which IPs accessed my WordPress plugins directory on Sep […]

  • Monitor Log Files in Real-time

    Publish Date: September 23rd, 2015 | Posted in Ubuntu Linux | Last Updated

    Monitor Logs Files in Real-time By default the tail command displays the last n=10 lines of any file[1]. Hence, this can be used to monitor any log file (e.g, Apache, MySQL, error logs, etc). The FreeBSD Tail man page has the most robust explanation on usage. Here’s the basic format: $ tail -f /path_to_log/file.log Where: […]

  • Creating Aliases Using Bash

    Publish Date: September 22nd, 2015 | Posted in Advanced LAMP Techniques, Ubuntu Linux | Last Updated

    How to Create Command Line Aliases in Linux This nifty tip was provided by Maco on StackEchange’s AskUbuntu forum: $ sudo nano ~/.bash_aliases Now, add the following line to the file: alias grep=’grep -n –color=always’ Additional Notes There is an include directive in ~/.bashrc that loads ~/.bash_aliases if it exists Shell settings go into ~/.bashrc. […]

  • Grep: Searching for Keywords in a File

    Publish Date: August 28th, 2015 | Posted in Ubuntu Linux | Last Updated

    Grep: Find Which Files Contain a Keyword Use the grep command to search within files for a keyword grep -Ri my_keyword /directory/to_search/ grep “Aug 28 .*2015” /directory/to_search/file_to_search.log |more Where: Reference: Search for Apache’s ServerTokens Directive Grep for text With Wildcard in between

  • Removing Entries from Linux History

    Publish Date: September 25th, 2014 | Posted in Ubuntu Linux | Last Updated

    Removing Entries from the Linux Command Line History File First you can avoid have commands saved to the history file by preceding them with a leading space. Here’s an example: $ nano /path/to/my/file/passwords.txt ^– additional space character If there are pre-existing commands that you want removed, just open the history file in nano and delete […]

  • Linux Hard drive Space

    Publish Date: September 25th, 2014 | Posted in Ubuntu Linux | Last Updated

    Hard Drive Space The df command will show you overall disk usage. To find out how much space is used in a directory, use du -s. For example, to view the disk usage of your server’s partitions: $ df -h To list the size of a specific directory: $ du -sh /home/ List the size […]