Server Commands - Ubantu, Apache 2

Hi, Here we will learn about the various server command which are very useful to us.

- Move one directory or file from one folder to other

# Directory
sudo mv /var/www/html/abc /home/mysite/public_html/


# File
sudo mv /var/www/html/abc.html /home/mysite/public_html/


- Copy one directory or file from one folder to other

# Directory
cp -r /home/site_one/public_html/abc /home/site_two/public_html

# File
cp -r /home/site_one/public_html/abc.html /home/site_two/public_html

 - Change Directory

cd /path/to/your/folder

- Create a tar file to compress files

 tar -zcf abc.tar.gz public_html/abc


- Move files from one server to other server

scp abc.tar.gz root@ip_address:/home/mysite/

- Dump mysql database

mysqldump -u db_username -p database_name > dump_filename.sql


 

- Start server applications

sudo service apache2 start
sudo service mysql start
sudo service memcached start


- Restart server applications


sudo service apache2 restart
sudo service mysql restart
sudo service memcached restart

- Stop server applications

sudo service apache2 stop
sudo service mysql stop
sudo service memcached stop

- Repalce string on server

# Replace 'http://example.com/folder/' with 'https://example.com/folder/' in all html files
sed -i 's,http://example.com/folder/, https://www.example.com/folder/,g' *.html

 



We will learn more about server commands in next post. Stay connect with us.

 





Rakesh Singh Uniyal

I’m Rakesh Singh Uniyal (MCA) and I write to help people work on programming and technology. The tips, tutorials and information provided in this blog has helped many people to solve their programming and web development related issues.
I work as a Freelance PHP/Magento/Wordpress Developer.

No comments:

Post a Comment