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:
1 |
ssh usr@host |
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:
1 2 |
#these are fake details use your user name and server in their place ssh peter@watson.com |
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.
1 2 |
#this is how you comment if you where to write a script file ls |
Type that and it will list all the files and folders
1 |
ls -a |
That will show all the hidden files too.
1 |
cd somefolder/ |
Primary navigation command.
1 |
cd .. |
goes up a folder.
1 |
cd folderName |
navigates to the folder with the name folderName
1 |
cd ~ |
Takes you to your home directory.
1 |
mkdir newDirName |
creates a directory
1 |
cp txtFile.txt somefolder/copyOfFile.txt |
copies file.txt to someFolder and renames the file.
1 |
mv txtFile.txt somefolder/copyOfFile.txt |
moves file.txt to someFolder and renames the file.
1 |
rm txtFile.txt |
deletes txtFile.txt
1 |
touch newTextFile.txt |
touch creates the file with no content
1 |
top |
Displays resources and process
Downloading
1 |
wget http://www.google.co.uk/index.html |
wget downloads a file at a location the above line downloads googles index.html page
1 |
git clone https://github.com/joyent/node.git |
git clone will clone a git repository to your current location
1 |
svn checkout http://as3-youtube-data-api.googlecode.com/svn/trunk/ as3-youtube-data-api-read-only |
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
1 |
pico textFile.txt |
this one is easy all shortcuts (^ is ctrl) are listed at the bottom but not as powerful as the other two.
Medium
1 |
vi textFile.txt |
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
1 |
vim textFile.txt |
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
1 |
./configure |
set settings in the build for your machine its automated it just does it
1 |
make |
compiles your code
1 |
make check |
tests the compile
1 |
make install |
installs your compiled code
1 |
make clean |
Removes all the compiled files and cleans up for you
Comming soon 🙂 sudo pico /etc/motd