Thứ Ba, 8 tháng 1, 2013

Basic SSH Commands for Magento Developers

Basic SSH Commands for Magento Developers


During my long time developing with Magento I’ve very rarely had to use SSH to make changes to the server environment for the benefit of my store. However, as you look around the Internet it quickly becomes apparent that Magento can make real use of actions provided by shell. Some examples are:
  • Setting up Magento on multiple domains with SSL certificates
  • Installing / upgrading Magento
  • Installing extensions
  • Resetting file permissions
ssh commands
I’m not going to go into how to do all these things because it’s documented very well on the Internet already. However with my experience, here’s a few basic SSH commands a Magento Developer should know before going in with shell.

Navigating Folders

ls 
List all items in current directory
cd foldername 
Change directory to specified folder name (e.g cd httpdocs/downloader)

Creating Editing Files

vim filename
Create specified file in current directory (e.g vim vhost.conf)
vi filename
Go into and edit the specified file (e.g vi vhost.conf)
Esc + :wq 
Save and quit when you’re editing a file, press Escape key followed by :wq to get out of file editing mode.

Removing Copying Files

rm filename
Deletes the file specified within current folder (e.g rm vhost.conf)
rmdir
Removes the specified directory (e.g rmdir /httpdocs/var/session)
cp filename
Copies the file specified within current folder (e.g cp vhost.conf)
cp –a /var/www/public_html/* /var/www/public_ftp/
Copies all files from one directory into a new specified directory (e.g above all files from public_html go into public_ftp)
This is all stuff that helped me out so hopefully it will for you too. My one word of caution will be to be very careful when creating important server files in shell, as one wrong move can bring your server down. You often need to restart your server after making such changes, so remember to do that after you’re done.

Không có nhận xét nào:

Đăng nhận xét