Archive for April, 2011

Unix and SSH Commands From Scratch

Tuesday, April 19th, 2011

In my last post I discussed node.js. This can be installed on a server. Originally I wanted to talk through how I installed Node.js and what plugins I have come to use. I took a look around and found a few ppl struggling with ssh. I figured best to cover some of the basics of server based commands first. I expect any one reading this have some Technical/Programming experience.

I am going to assume you have a sever and are working from a Unix based machine(Linux or OSX).

Accessing your server:

usr: would be your user name to the server for the sake if this example lets say your user name is peter

host: is your server url/ip lets say for this example its Watson.com

so in your command window type in your server details press enter:

Enter you password and you should be in.

Basic Commands:

Here is a list of basic commands to help you move around the folders and manipulate the files.


Type that and it will list all the files and folders


That will show all the hidden files too.


Primary navigation command.


goes up a folder.


navigates to the folder with the name folderName


Takes you to your home directory.


creates a directory


copies file.txt to someFolder and renames the file.


moves file.txt to someFolder and renames the file.


deletes txtFile.txt


touch creates the file with no content


Displays resources and process


Downloading

wget downloads a file at a location the above line downloads googles index.html page


git clone will clone a git repository to your current location


svn checkout checks out a svn repo


Editors
You will edit a lot of text files on server a far bit. So I will list 3 Degrees of editors.

Easy

this one is easy all shortcuts (^ is ctrl) are listed at the bottom but not as powerful as the other two.

Medium

this is obviously more powerful than pico but to achieve that it uses states when u start you can’t type you need to enable typing. This is just a taster of how to use it. There are entire pages on the web that list all the shortcuts.

i
press i when u are not in edit mode and it will insert the cursor to allow you to type

press ESC then :wq
esc enters command mode w stands for write and q stands for quite so save and exit

press ESC then :q!
quit with out saving

Hard

best text editor i could write a whole post on it. If you wana use google it.

Compiling Code
In Unix you can tailer a build for your system. so its compiled for you and you alone 🙂 Lets say you downloaded a project from the internet using git or svn.

Complete in order below

cd
to the location of the files

set settings in the build for your machine its automated it just does it


compiles your code

tests the compile

installs your compiled code

Removes all the compiled files and cleans up for you

Comming soon 🙂 sudo pico /etc/motd

Node.js

Friday, April 1st, 2011

links: Node.js npm forever

Over the years I have dipped in and out of a few different server side languages. PHP, Ruby, ColdFusion and Java to mention some. I guess the root of my issues with them is how infrequently I need to use them. It does not help that none of them share any development paradigms outside OO.

Some one mentioned Node.js to me when I discussed some ideas I was toying with. I immediately blanked them on the grounds that JS is client side and I specifically had a server side problem to resolve. I brushed the dust of my PHP book and got to work.

As what always happens to me when I am building things in PHP I ran into problems. As always I vent at a few friends to blow of some steam. As I did this people I knew kept on mentioning Node.js.

I eventually caved and looked it up. What no one had mention or in some case I didn’t give them a chance to mention. Is that Node.js is Googles V8 engine running on a server doing all those pesky backend Networking tasks in JavaScript. A Open Source ECMAScript platform will the internet ever ceases to amaze me.

After watching the video on the node.js website see link above I was flabbergasted at how easy it was. I figured I could build my solusion in no more than one day. I installed it on my server. Which took  all of 10 min. no really thats how long it took me to download the files compile the latest build and install it. It was disgracefully fast.

So I got to work. One and a half hours later I was was looking at my editor thinking surely i cant be done there must be now way its that easy to set up two TCP servers and an http server. Yet it was done plain as day all running and working.

If you are going to give it a try i recommend npm which is the plugin manger for Node.js and using it to install forever which helps you manege which servers you want to keep up. all links are at the top of the post. Obviously i would recommend it. I have even heard it runs on some shared hosts admittedly a little cut down but more than enough to inspire.