{"id":192,"date":"2011-04-19T12:44:25","date_gmt":"2011-04-19T12:44:25","guid":{"rendered":"http:\/\/www.blogs.abeazam.com\/dev\/?p=192"},"modified":"2011-04-19T12:44:25","modified_gmt":"2011-04-19T12:44:25","slug":"unix-and-ssh-from-scratch","status":"publish","type":"post","link":"http:\/\/www.blogs.abeazam.com\/dev\/2011\/04\/unix-and-ssh-from-scratch\/","title":{"rendered":"Unix and SSH Commands From Scratch"},"content":{"rendered":"<p>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.<\/p>\n<p>I am going to assume you have a sever and are working from a Unix based machine(Linux or OSX).<\/p>\n<p><strong>Accessing your server:<\/strong><\/p>\n<p>[shell]ssh usr@host[\/shell]<\/p>\n<p>usr: would be your user name to the server for the sake if this example lets say your user name is peter<\/p>\n<p>host: is your server url\/ip lets say for this example its\u00a0Watson.com<\/p>\n<p>so in your command window type in your server details press enter:<\/p>\n<p>[shell]#these are fake details use your user name and server in their place<br \/>\nssh peter@watson.com[\/shell]<\/p>\n<p>Enter you password and you should be in.<\/p>\n<p><strong>Basic Commands:<\/strong><\/p>\n<p>Here is a list of basic commands to help you move around the folders and manipulate the files.<BR><BR><BR><\/p>\n<p>[shell]<br \/>\n#this is how you comment if you where to write a script file<br \/>\nls<br \/>\n[\/shell]<\/p>\n<p>Type that and it will list all the files and folders<BR><BR><BR><\/p>\n<p>[shell]ls -a[\/shell]<\/p>\n<p>That will show all the hidden files too.<BR><BR><BR><\/p>\n<p>[shell]cd somefolder\/[\/shell]<\/p>\n<p>Primary navigation command.<BR><BR><BR><\/p>\n<p>[shell]cd ..[\/shell]<\/p>\n<p>goes up a folder.<BR><BR><BR><\/p>\n<p>[shell]cd folderName[\/shell]<\/p>\n<p>navigates to the folder with the name folderName<BR><BR><BR><\/p>\n<p>[shell]cd ~[\/shell]<\/p>\n<p>Takes you to your home directory.<BR><BR><BR><\/p>\n<p>[shell]mkdir newDirName[\/shell]<\/p>\n<p>creates a directory<BR><BR><BR><\/p>\n<p>[shell]cp txtFile.txt somefolder\/copyOfFile.txt[\/shell]<\/p>\n<p>copies file.txt to someFolder and renames the file.<BR><BR><BR><\/p>\n<p>[shell]mv\u00a0txtFile.txt somefolder\/copyOfFile.txt[\/shell]<\/p>\n<p>moves file.txt to someFolder and renames the file.<BR><BR><BR><\/p>\n<p>[shell]rm txtFile.txt[\/shell]<\/p>\n<p>deletes txtFile.txt<BR><BR><BR><\/p>\n<p>[shell]touch newTextFile.txt[\/shell]<\/p>\n<p>touch creates the file with no content<BR><BR><BR><\/p>\n<p>[shell]top[\/shell]<\/p>\n<p>Displays resources and process<BR><BR><BR><\/p>\n<p><strong>Downloading<\/strong><\/p>\n<p>[shell]wget\u00a0http:\/\/www.google.co.uk\/index.html[\/shell]<br \/>\nwget downloads a file at a location the above line downloads googles index.html page <BR><BR><BR><\/p>\n<p>[shell]git clone https:\/\/github.com\/joyent\/node.git[\/shell]<br \/>\ngit clone will clone a git repository to your current location<BR><BR><BR><\/p>\n<p>[shell]svn checkout http:\/\/as3-youtube-data-api.googlecode.com\/svn\/trunk\/ as3-youtube-data-api-read-only[\/shell]<\/p>\n<p>svn checkout checks out a svn repo<BR><BR><BR><\/p>\n<p><strong>Editors<br \/>\n<span style=\"font-weight: normal;\">You will edit a lot of text files on server a far bit. So I will list 3 Degrees of editors. <\/span> <\/strong><\/p>\n<p>Easy<\/p>\n<p>[shell]pico textFile.txt[\/shell]<\/p>\n<p>this one is easy all shortcuts (^ is ctrl) are listed at the bottom but not as powerful as the other two.<\/p>\n<p>Medium<\/p>\n<p>[shell]vi \u00a0textFile.txt[\/shell]<\/p>\n<p>this is obviously more powerful than pico but to achieve that it uses states when u start you can&#8217;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.<\/p>\n<p>i<br \/>\npress i when u are not in edit mode and it will insert the cursor to allow you to type<\/p>\n<p>press ESC then :wq<br \/>\nesc enters command mode w stands for write and q stands for quite so save and exit<\/p>\n<p>press ESC then :q!<br \/>\nquit with out saving<\/p>\n<p>Hard<\/p>\n<p>[shell]vim \u00a0textFile.txt[\/shell]<\/p>\n<p>best text editor i could write a whole post on it. If you wana use google it.<\/p>\n<p><strong>Compiling Code<br \/>\n<span style=\"font-weight: normal;\">In Unix you can tailer a build for your system. so its compiled for you and you alone \ud83d\ude42 Lets say you downloaded a project from the internet using git or svn.<\/span><\/strong><\/p>\n<p><strong><span style=\"font-weight: normal;\">Complete in order below<\/span><\/strong><\/p>\n<p>cd<br \/>\nto the location of the files<\/p>\n<p><span class=\"command\"> <\/span><\/p>\n<p>[shell].\/configure[\/shell]<\/p>\n<p>set settings in the build for your machine its automated it just does it<\/p>\n<p><span class=\"command\"><br \/>\n<\/span><\/p>\n<p>[shell]make[\/shell]<\/p>\n<p>compiles your code<\/p>\n<p><span class=\"command\"> <\/span><\/p>\n<p>[shell]make check[\/shell]<\/p>\n<p>tests the compile<\/p>\n<p><span class=\"command\"> <\/span><\/p>\n<p>[shell]make install[\/shell]<\/p>\n<p>installs your compiled code<\/p>\n<p><span class=\"command\"> <\/span><\/p>\n<p>[shell]make clean[\/shell]<\/p>\n<p>Removes all the compiled files and cleans up for you<\/p>\n<p>Comming soon \ud83d\ude42\u00a0sudo pico \/etc\/motd<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,34,42,46,49],"tags":[63,104],"_links":{"self":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/192"}],"collection":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/comments?post=192"}],"version-history":[{"count":0,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/posts\/192\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/media?parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/categories?post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.blogs.abeazam.com\/dev\/wp-json\/wp\/v2\/tags?post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}