CLI - Command Line Interface
-p to recursively create any parent folders that don't already exist)
-a to view hidden files)
ps cax | grep node or
ps aux | grep node (enter search term instead of "node")
cat file.js to view file contents, without bothering with
This is a command line text editor, and is very annoying, but can be used efficiently if you know all the shortcuts:
dd - delete entire current line
G - last line
$ - last character in line
Users, Groups, and Permissions
chmod -R 600 ~/.ssh/YOUR-FILE you'll need to do this on any newly created SSH key file before GIT can use it
chown $USER -R /www or whatever folder or file you want to take back ownership of, if you run into write permission issues
More tips coming soon, but generally for a very basic setup, for a beginner server administrator, it is not good to change any permissions other than this. Definitely don't ever do
chmod -R 777 /some-folder
When someone visits your domain, http://paulshorey.com, the domain is not connected to the server, so nothing loads.
To connect a domain to the server, go into DNS settings, in the registrar (Name.com) and:
- add a type "A" DNS record with the value of your server's IP address.
After doing that, http://paulshorey.com is the same as http://220.127.116.11
Also set up any subdomains, for example, http://api.paulshorey.com will go to http://18.104.22.168
Servers only have IP addresses, not domain names, so now the domain will connect to the IP address.
In PHP and local filesystem, you open some folder in your browser, and if that folder has an "index.html" or "index.php" file, the folder path "file:///volumes/Users/admin/desktop/my-website" will render as a web page.
In a Node.js server, it doesn't work like that. Your "index.js" file can be anywhere, and can be called anything, like "app.js". When it is run, inside the script you have to tell it what urls to use, and what to do when each url is visited. This will be covered later.