From the initial how-to guides in the Set Up Unmanaged Ubuntu-Nginx VPS 4 Noobs tutorial series, we've got a basic Linux distribution to work with and dead easy, secure terminal access to it, from our local Windows PC.
Video: Edit bashrc for easy commands
Right. Log into the CLI using your regular user name and we'll crack on …
Using bashrc to Create a User-friendly Command Line Interface
bashrc has got a funny name all right, but believe you me
As I say – and I freely admit to getting a bit excited with this lil bit of Tux – the bashrc file makes life easier and workflow faster. Let's take a peek:-
At the bottom of the file, type:-
And close the file. To activate changes, after editing the bashrc file you type this command:-
OK. That was a basic example, but you get the picture. Pretty powerful. With the bashrc file open, let's add a few more aliases, and a little functionality. You can just leave in the descriptive references because they're commented and Linux ignores them. Copy and paste this lot:-
Of course, you can play around with all the above, to suit you. After saving the file, don't forget:-
One bashrc File Per User
It's rather easy to get confused when switching user to, say, root, and then wondering why certain bashrc aliases won't work. The reason they aren't working is because the other user has a separate bashrc file, so consider adding your aliases to both.
For example, if you escalate to superuser (typing sudo -i at the commmand line to act as the root user) then your user's bashrc aliases and functions won't work.
Like the guy said in Highlander, “There can be only one.” Of course, he'd have been more helpful, had he said “There can be only one bashrc file, per user.” But he didn't, so I am.
Try this so you can see what I mean. Type sudo -i, add the password and the CLI text is all white again (which is really useful to warn you that you are in SuperUser mode), and aliases don't work. To exit the root account, type exit, and you're back to your regular user account.
You can edit root's bashrc file by opening the file (nano ~/.bashrc) when logged in as root. Personally, and to reiterate an important point above, I prefer to leave it looking boring so I know I'm in privileged user mode and have to be serious for a change.
(Oh yes, and if you do add your aliases to the root user's bashrc file, edit the commands to omit the now-defunct sudo.)
In the next couple of guides we'll be concentrating on recording your domain to the web using that thing called DNS, then extending that to create your server's email capability. Then we'll look at PHP so you can serve those all-important pages before, at last, we'll be in the thick of setting up the Nginx web server itself so that it works for your preferred content platform.
But hey, for me it's beer o'clock, so just read the index…