If apache server failed to restart like this :

sudo service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [FAILED]

then you need to check error logs which might be under this directory if you are running CentOS:


inside this directory you will see error_log. Open this file and read last few entries with:

trail -100 error_log

and if you spot that last few entries are like this :

[Fri Apr 14 19:59:25 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Then probably you have mis-configured your ssl.conf file or its got corrupted. This file can be under directory:


now to fix this error you need to rename your existing ssl.conf file with mv command:

mv ssl.conf ssl.conf.old

and then create one new ssl.conf and put the defaults contents in it from this comment:
or download from attached post and rename from ssl.conf.txt to ssl.conf and save it on your server.

and press :wq to save and quit.

Now restart your apache server to see if problem is gone:

sudo service httpd restart

Stopping httpd: [ OK ]
Starting httpd: [ OK ]

The password is failed to login because special character symbol like “$”(dollar sign) is considered to be special character in Linux.
drush upwd USERNAME --password="PASSWORD"

This command is actually running for Linux in which some special characters always needs to be escaped with “\”. So if you try the password:

 drush upwd root --password="S$1gma"

The above password will never work, to make the above password work you need to escape it in Linux like:

drush upwd root --password="S\$1gma"

Of course the new password now is S$1gma but this is the way how bash deals with some characters.

So either you escape all the special characters in your string or use some SAFE SET of characters like [,._+:@%/-] which don't need to be escaped.

To count total number of directories within specific directory you have to go to one step back from the directory you want to count.
For example you have to count number of modules in modules folder on path /sites/all/modules. First navigate to folder /sites/all and then run the below command :

ls -l modules | grep -c ^d 

where "modules" is the name of the folder inside which you need to count directories.

Run following on Linux terminal :

ps -ef | grep apache

which will yield the result like

root  3753   1  0 Jul12 ?    00:00:19 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

The last parameter above ( /etc/apache2/httpd.conf) will show the apache directory and the path of httpd.conf .

To download the file use :
scp username@serveraddress:file_location_from_copy file_location_to_copy
For example :

scp root@ ./downloads/

To upload the file use :
scp -P port_name file_location_to_be_copied_from username@serveraddress:file_location_to_replace_on_server
For example :

 scp -P 222 abc/abc.module UserX@

Note : Upload command will replace the file from its new content

1) For RedHat Linux (Fedora Core/Cent OS) use the following command:
# To Start MySql Server:

/etc/init.d/mysqld start
service mysqld start

# To Stop MySql Server:

/etc/init.d/mysqld stop
service mysqld stop

# To restart MySql Server :

 /etc/init.d/mysqld restart
service mysqld restart

2) For Debian / Ubuntu Linux use the following command:
# To Start MySql Server:

/etc/init.d/mysql start

# To Stop MySql Server:

/etc/init.d/mysql stop

# To Restart MySql Server :

/etc/init.d/mysql restart

To get all information about PHP :

 php -i 

To get only specific version of PHP

 php -v 

You can copy the directory to another directory :

1. Without copying that directory itself

cp -R one_directory/* another_directory

Here cp is copy command and R is used for recursive copying.

2. By copying the whole directory

cp -R one_directory another_directory

To remove all files and folders inside a folder you have to use :

rm -rf FolderName

You can use the following command : 

$ cat /etc/*release
Subscribe to RSS - Linux