Most Useful Linux Commands

This is a lit of commands that I find found very useful on linux and related technologies.

Command 1

sudo apachectl configtest

This command can prevent you from having a crisis.

Let’s say you make a quick change to the configuration of your website hosted in apache. You might be tempted to restart the server right away. but, as we know, quick changes are not always ‘quick’. If you somehow introduced a syntax error,  all your websites will be down, until you can track and fix your change.
By first doing a config test, it will tell you if it’s safe to restart Apache.

Command 2

du -hs * | sort -h

This command returns a lit of sub folders sorted by size. This can be very useful for cleaning up your server.

Sample output:

4.0K    drupal.bat
4.0K    index.php
8.0K    README.txt
8.0K    web.config
12K     sitemap.xml
20K     LICENSE.txt
7.6M    modules
8.9M    themes
38M     vendor
85M     core
2.5G    sites

Command 3

CTRL + R

This command does a reverse search of your command line history in linux. This is verrry handy when doing repetitive actions. It has auto complete so you don’t have to type in the full command.

Leave a Reply

Your email address will not be published. Required fields are marked *