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
- Copy one directory or file from one folder to other
- Change Directory
- Create a tar file to compress files
- Move files from one server to other server
- Dump mysql database
- Start server applications
- Restart server applications
- Stop server applications
- Repalce string on server
We will learn more about server commands in next post. Stay connect with 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.
No comments:
Post a Comment