Connect, manage and update files on your Linux Server like a PRO

I’ve been using Linux (Ubuntu) for a year now. Mind you that this post was written by a newbie guy.
In this post, I am going to show you how to connect to a Linux Server using SSH and add,update,delete files on your web applications, etc. The first time I setup a server and upload web application, I use FileZilla for uploading files and PuTTY for SSH connection. But not this time.

What we need?

  1. A Linux distro (preferably Ubuntu)
  2. Linux Server (of course!) – deb
  3. A text editor for updating our code (recommended – Sublime Text)

1. Let’s open up a folder (Home folder). From the Menu bar, click File>Connect to Server.
connect_server

2. A window will appear. You will need to fill up the fields.
2
Server: the IP address of the server
Port: 22
Server: the IP address of the server
Username and Password: user account to connect to server (account from server)

Note: Make sure the server has OpenSSH installed. Default port is 22

3. Another window will appear and we can now start adding,updating our files on the server.
Selection_001

This is way faster than using WinSCP/FileZilla. You just navigate to the server’s directory and drag and drop files from your desktop to server, open files from the server using text editor from your desktop.

Advertisements

Installing ZenCoding in Sublime Text 2

import urllib2,os; pf=’Package Control.sublime-package’; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),’wb’).write(urllib2.urlopen(‘http://sublime.wbond.net/’+pf.replace(‘ ‘,’%20’)).read()); print ‘Please restart Sublime Text to finish installation’

Video Tutorial  <- here

Localhost 403 forbidden

Open httpd.conf file. (see image below)

Search for this line. onlineoffline tag and put a # to comment out the Deny from all and put this: Allow from all

Restart your WAMPServer and it should work now.

If it does not work, please watch the video below.

Please leave comment/feedback and be sure to check http://village88.com for free learning.Thank You

Choosing your Text Editor

Sublime Text 2 logo

Platforms: Windows/Mac/Linux

Sublime Text 2 – is a sophisticated text editor for code, html and prose. You’ll love the slick user interface and extraordinary features.

Sublime Text 2 is my favorite text editor. I love the nice user interface and has a lot of plugins like ZenCoding. It cost $59 but you can use the unregistered version. You can also download Textmate theme .tmTHEME put into the Color Scheme folder to use. – http://www.sublimetext.com/

Notepad++ logo

Platform: Windows

Notepad++ 

is a free (as in “free speech” and also as in “free beer”) source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.

Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.  – from http://notepad-plus-plus.org/

This is a free text editor and only run in Windows platform but I guess you can install this on a Linux platform using Wine.

Notepad++ is also a good text editor because of its simplicity and ease of use. If you’re looking for a free text editor better than Notepad, then Notepad++ is yours!

Textmate logo

Platform: Mac

Textmate – Whether you are a programmer or a designer, the production of code and markup is hard work. Without an editor dedicated to the task, it is also often cumbersome, overwhelming, and repetitive. Especially when you are dealing with a lot of files at once — like most projects do. TextMate puts you back in control, reduces the mental overhead, and turns manual work into something the computer does. – from http://macromates.com/

Unfortunately, this text editor is not free but you can use the 30-day trial. I haven’t tried this one so I don’t talk much in this but I’ve seen this in many video tutorials and it looks nice.

Bluefish logo

Platforms: Windows/Mac/Linux

Bluefish – is a powerful editor targeted towards programmers and webdevelopers, with many options to write websites, scripts and programming code. Bluefish supports many programming and markup languages. See features for an extensive overview, take a look at the screenshots, or download it right away. Bluefish is anopen source development project, released under the GNU GPL licence.

I tried using this text editor when I am using Linux to test and its lacking of features. This is similar to Notepad but you can add plugins.

I just listed few text editors because I know when developing we only use one. I didn’t put known applications like Dreamweaver, Komodo IDE, Aptana Studio, NetBeans, PhpStorm, UltraEdit, etc. because they are heavy and load lots of resources. Text Editors are easy to use and they are lightweight when it comes to processes. IDE’s have a great feature but cost much. There are still a lot of text editors out there but I recommend Sublime Text 2 and Notepad++ since these two are performing well doing their job!

Village88!

Learn how to code for FREE | Get Certified! | Get a Job!

Come and learn how to code in a proper way!

Learn HTML, CSS, jQuery, Ajax, PHP, MySQL, OOP, MVC framework, cloud server, scrum, and a lot more!

Join Facebook Group > https://www.facebook.com/groups/ngfp.2012/

Click to view the Newsletter

No know more about Village88, visit their website here

How to change default wamp document root directory

In this tutorial, I will teach you how to change the default document root directory of wamp. You configure this when installing WAMP. But what if you want to change? Ok, so let’s start.

First, fire up your WAMP then left click on the wamp icon (located at the taskbar) > Apache > httpd.conf.

(see image below)

The file (httpd.conf) will open into your notepad.

Second, hit Ctrl+F and type documentroot. At the first result, find the line DocumentRoot “c:/wamp/www/ but in my case it’s DocumentRoot “c:/local_development/www/”. Put a hashtag in front of the line to comment out and below the line, put DocumentRoot “c:/directory/” (where directory is where you want to put your document root. In my case, DocumentRoot “d:/development/”.

(see image below)

Third, again hit Ctrl+F and type documentroot to and below you will find this line <Directory “c:/wamp/www/”>, but in my case its <Directory “c:/local_development/www/”>. Again put a hashtag in front of the line to comment out and below the line put <Directory “d:/documentrootdirectory/”> where documentrootdirectory is the directory/folder you configured in the second step. In my case it’s <Directory “d:/development/”>.

(see image below)

Finally, restart your WAMPServer and test.

THAT’S ALL

Running PHP script as background process

Ok, I’ll do this quickly. This will only work on a linux machine.

What is Crontab?

cron is a time-based job scheduler in Unix-like computer operating systems. cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix , solaris. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times.

So here’s the code…

59 7 * * * /var/www/dummy/mail.php

Simple code explanation

59 – minutes (0 – 59)
7 – hour (0 – 23)
* – day of month (1 – 31)
* – month (1 – 12)
* – day of week (0 – 6) Sunday = 0
/var/www/dummy/mail.php – path to file

What the code does?

The code actually executes the script in php file (mail.php) everyday 7:59 in the morning. The php file contains php scripts to send email notifications.

Where to put these code?

Open up your terminal (Ctrl+Alt+T) and type “crontab -e” (without quotes). Enter your password if asked.

At the end of the line, put your code to run your script as a background process.

Then, Ctrl+O -> Enter (to save) and Ctrl+X to close. Now restart your system and it should work!

Sorry for my bad english but I hope you learned something.

http://www.adminschoice.com/crontab-quick-reference