Monday, February 16, 2015

February 2015 Wordpress Tips

In Wordpress, entering commands for terminal is easy. Obviously you can simply type the words "sudo apt-get..." and hope that everyone removes the quote marks, but there is actually a better way: the code command.
This results in text that looks like this:
this space intentionally left blank
It looks very polished and is ready to paste into the terminal.
On another note, Wordpress will not accept Wordpress code inside the code markup, so I used a screen shot of the example. However, there is a non-intuitive way to show code markup. To use the code tag, you need to be in "text" mode. If you switch from text to visual, the markup code will fail to render correctly.
<code><div>This is an example of incorrectly entered code markup text.</div><code>
Note that the font also did not change.
<code><div>This is an example of correctly entered code markup text.</div><code>
Did you see what I did there?

Sunday, February 15, 2015

Terminal Refresh - Chromebook Users and Terminal

Years ago, I wrote a terminal cheat sheet over on pretendertothepower.com I think it is time for an update.
One command that I misunderstood from the beginning was sudo. This concept troubled me as there is a root account, which is sort of analogous to being an admin on Windows. Windows is bad news, because the admin account is so handy, or worse, required to do many standard things. This is not the case in all the various forms of Linux. xPud is a notable exception as you are always logged in as root.
By way of example, in Windows, the Admin account will not allow you to delete critical files from your system. At least, not without a lot of effort. Linux will happily allow the root user to delete ANYTHING!
Linux Rule One: If you don't know what outcome you need, root is NOT the tool for you.
On the other hand, you can gain temporary access to elevated privileges with the sudo command. This is actually the correct method for gaining privileges. Let's say you want to install some software, and you intend for all users to access it. The sudo command allows a user to gain privileges using their own password, not the root account password. The process creates a log of what is done in /var/log/auth.log; if mistakes are made, you can easily figure out what and when it was done.
In this example of sudo, we are going to install gedit. But we need to get ready for it.
sudo apt-get update
This command will tell your system to go and check what versions you have against what versions are available on the servers. It installs nothing. This is very important, because your linux computer has a local list of software available and it could be out of date. Update, update, Update!
The command for installing is:
sudo apt-get install gedit
Linux is made up of packages of software, in discrete chunks to make it more useable. The command apt-get install will put these packages on your system and make them useable.
You can go ahead and try to run both commands without the sudo. It will throw a nasty looking error.
Ok. Now we have gedit installed. We can open gedit without the sudo command. Type
gedit
As you can see, gedit is a very basic editor. We are going to use our elevated privileges and use gedit to do something a normal user cannot do. I am using a Chromebook with Crouton and I would like my Linux system to default to the $HOME/Downloads directory.
Let's fix this. Type sudo gedit .config/user-dirs.dirs to open the protected .config file.
What is not shown is all the activity in the terminal. At this point, since terminal opened gedit with elevated privileges, you should not close the terminal window.
Go ahead and change the text $Home/Desktop to $Home/Downloads.
I changed them all, but obviously you don't need to do that. Click save. You should see some activities in the terminal window.
Tomorrow we will look at using sudo for other purposes.