Linux creator Linus Torvalds last night announced the release of version 3.9 of the kernel. Available for download at kernel.org, Linux 3.9 brings a long list of improvements to storage, networking, file systems, drivers, virtualization, and power management.
What will that 4.0 milestone bring us? The Year of Linux?
If you want to monitor system performance on a Debian based machine, you could use
top but the
saidar package will help you with a user friendly interface. It features up-time, memory usage, processor performance, disk hits and network utilization. Typcically, those five things are all that you need.
sudo apt-get install saidar.
My dad and I were trying to figure out what would come after Oneiric Ocelot or Ubuntu 11.10. Well, you can read some of the suggestions for the 12.04 name.
Some of my favorites are:
- Perpetual Phoenix
- Philosophical Pegasus
- Pragmatic Penguin
I installed a little ftp-server on my ubuntu dev-server. After configuring some ports and other users, I needed to restart the service. Since most daemons run as services now, anything
/etc/init.d/name restart is now just
service name restart. But of course, nothing is that easy.
ryan@ryan-desktop:~$ service vsftpd restart
I ran this to restart the service for the ftp daemon but I was rejected.
Funny thing. I blog about Ubuntu all the time but I don’t have a category for Ubuntu. No, I have a category for Linux. I don’t have a catch-all category for crappy-closed-source-operating-systems either. No, I have one for Windows.
No, it wasn’t my idea. johntkucz from a thread on the Ubuntu Forums mentioned that he made an alias, sagi.
His reasoning for it is, “to make my ‘trip to the linux store’ even more ridiculously easy.” I think that sums up the power of apt-get and Linux quite nicely. sagi becomes a bonus in that case.
You could make the alias be anything, but the acronym is fitting because it describes each of the key pieces of
sudo apt-get install.
alias sagi='sudo apt-get install'
With this, you could install my new favorite text editor just like this:
sagi kate. It would probably prompt you for your password and then it would install kate thereafter. It’s a shortcut that looks nice and saves time.
After writing the post and actually using this in person and via ssh, it seems that sagi only remains during the session it is defined in. To make it stay around for ever, put it in your
.bashrc file in your home folder. That should do it.
I ssh into my server multiple times a day. Connecting is fine but the password prompt is horrendously slow. It takes up to fifteen seconds for it to appear sometimes. If I ssh in four times a day, that’s a minute wasted in just sitting around waiting. That sucks.
I know Ubuntu does some strange things to logical networking settings, but I didn’t think it would mess with ssh. I wondered if others had this trouble too. I found a thread on the Ubuntu Forums where the poster would have to wait 20-30 seconds. After asking for logs and configurations, a great suggestion was given.
Add the following to /etc/ssh/sshd_config on your SSH server
Then restart the ssh daemon and your pauses should be gone.
Well, that’s a start. So a quick
sudo vim /etc/ssh/sshd_config adding a comment for notes and the
UseDNS no line at the end. Finally, a restart
service ssh restart and it was done. I quickly tried to ssh back into my server and it went in fast. Very fast, the prompt was there within a second. I was impressed.
This beg’s the question, what is UseDNS? According to the man-page for sshd:
UseDNS Specifies whether sshd should look up the remote host name and
check that the resolved host name for the remote IP address maps
back to the very same IP address. The default is “yes.
It appears to prevent spoofing by looking up the host name and IP and checking if they match when doing a reverse lookup. This would work very well in theory if a real DNS server was being used. If a lame Qwest modem is being used, this doesn’t work as well because it’s not a real DNS server and it is as slow as molasses itself. Turning this check off means that it’s possible someone could spoof a host name or IP connecting to the server, but that’s pretty unlikely in my case.
Happy fast ssh-ing!
If you have a command that needs to run when you login there’s a way to do just that.
cd ~/.config/autostart/.to jump into the autstart directory. To make a command run when you login, you need to make a file.
vim somename.desktop. The someone part isn’t so important, but the .desktop part is. Here’s the file template.
Exec=Put Your Command Here
Name[en_US]=Name of Command Here
Name=Name of Command Here Again
Comment[en_US]=Description of Command Here.
Comment=Description of Command Here Again.
Then just save your file with
:wq! and you should be all set. If you go to System > Preferences > Start Applications, you should see an entry of your newly made start up command.
If Firefox is too slow for you now, Google Chrome might be worth it. I’ve used the Ubuntu Software Center since I started using Ubuntu last year to grab Chrome from the official open source channels, but lately it’s been outdated because Google releases Chrome at the speed of light.
Since the USC is slow to update you’ll end having to wait a much longer time to get updates. To fix this, skip the USC altogether and go straight to the source – Google. The Google Chrome website automatically detects the OS you are using so you have to do this on Ubuntu directly. Once there, do not click Download Google Chrome! Instead, look below it for Try the latest BETA version or
Get Google Chrome beta or developer releases which will ensure you always have a cutting edge more than up to date version of Chrome.
On the next page, you’ll see the Early Access Release Channels header. Scroll way down to Subscribing to a channel and then to Linux. Look for Beta Channel. You’ll need to pick either an x32 or an x64 version to download. Once you click the link, it’ll bring you to the beta release page and show you the Google Chrome terms of service. Accept and the download should start.
You’re downloading a .deb file so it is basically an installer. If it doesn’t open automatically upon finishing, just go to your downloads folder and click on it a few times. Once the installer is open, click Install Package and then enter your password if prompted.
Once it’s installed, you should take a look in the Applications menu:
Applications > Internet > Google Chrome. You’ll see the new Google Chrome browser right there.
Another thing I’d like to point out is the difference between the icons. Looking at the icons – the bland blue washed icon is the open source Chromium while the colorful icon is the true Google Chrome.
Now you can use Google Chrome and it’ll be always mostly updated!
Finally, I was looking for a reliable way to transfer or import the Chromium profile into the newer Chrome. However, on Linux, it doesn’t appear to be very straight forward so I’ll leave that for another day.
Enjoy Google Chrome on Linux!
I’m not sure when the little pencil icon disappeared from the Nautilus window. In Windows 7, I love being able to edit the path in the window to jump anywhere in the system quickly. This is even more useful in Linux actually because there are loads of hidden folders you cannot get to unless you jump there directly. You’d think the Ubuntu equivalent to Windows Explorer would offer this feature in a more obvious way.
When I look at my home directory,
/home/ryan, all I see is the two buttons in the path that make up those directories. That’s great because I can jump between the levels easily, but it doesn’t allow me to jump anywhere else outside that hierarchy.
Luckily, you can hand type a path in place of those jumping navigation buttons easily. Simply use
CTRL + L. This will transition the buttons to an input box where you can easily type out any path you want. It’ll even attempt to auto-complete for you just as if you were running in the terminal. When you’re ready to jump, hit enter and off you go. I demonstrated above how I navigated with the by hand editor to jump to my
/home/ryan/.config folder which is normally hidden from display.
That’s all there is to typing paths by hand in Nautilus on Ubuntu!
SSH and SFTP are easy to setup.
For SSH, it’s as easy as.
While SSH can send commands to the remote computer, files need secure copy, or SCP..
scp -r /home/ryan/www/files/ firstname.lastname@example.org:/home/ryan/www/files
The -r switch is for copying directories recursively. If it were just a single file being copied, then it wouldn’t be needed.
Covering commands and files, seeing the web as the remote computer does is quite useful as well. To do that, sockets are required.
SSH -D 8899 email@example.com
This will make a tunnel to the remote computer at localhost:8899. To finish, set your browser’s proxy settings to run off of localhost:8899 and that should do it.
I recently reinstalled a Ubuntu machine on my network. I often log in to that server machine via SSH on my laptop. I received a scary message when trying to do so.
ryan@ryan-laptop:~$ ssh firstname.lastname@example.org
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /home/ryan/.ssh/known_hosts to get rid of this message.
Offending key in /home/ryan/.ssh/known_hosts:1
RSA host key for 192.168.2.67 has changed and you have requested strict checking.
Host key verification failed.
This took me by surprise. My network is secure as far as I know, and the only difference now is the that I reinstalled my server with a fresh copy of Ubuntu 10.04. When SSH is installed I guess it makes a new RSA key and it’s not based on hardware or anything silly. That makes sense, I guess.
Fixing the error at least on the laptop was effortless. First, I opened the terminal. Then, I ran
cd /home/ryan/.ssh/ and then opened the file via
vim known_hosts. And I saw a mess of characters appear on my screen. The error message said I could update key 1 but it looked like there already multiple key 1s.
My solution was to simply delete the known_hosts file with
rm known_hosts and remake it with
touch known_hosts. That was easy enough. Then, I tried to run my ssh command again,
ssh email@example.com. It prompted me that this computer has not been accessed before and it isn’t an already trusted key. That’s great, because I did trust it and I accepted it. That means deleting the old file and remaking it worked. Excellent.
I knew the cause of this error pretty fast because I reinstalled my server. However, getting this error while out at a Starbucks would have tipped me off that something more sinister was going on. Keep in mind that with this error, it can mean the finger print is different or that someone is in fact spoofing the remote’s host name or IP address.
On my new Ubuntu laptop, I installed git one day and was making a commit not long after. I was surprised with an editor that I never use: nano. I wanted VIM.
First, make sure you have the text editor you want is installed. In my case, I wanted VIM, so I ran:
sudo apt-get install vim. It turns out that ubuntu doesn’t come with VIM installed by default. So it installed without any trouble.
I was reading this Stack Overflow thread about doing setting the core.editor property, but it didn’t work. It turns out that the simple command,
git config core.editor "vim" doesn’t set the property for all git repositories, just the local folder. If you try to do it in a non-repo folder, it’ll scream at you:
error: could not lock config file .git/config: No such file or directory
The solution is of course to add a global option. Run the same command but with global enabled, and it’ll set all repos to use the same text editor:
git config --global core.editor "vim". Note the two dashes, that’s very important.
That’s all there is to changing the default editor for git in Ubuntu.
I needed to find out the size of a directory while connected to my Ubuntu server. When I used the properties menu in Windows explorer however, that data was not populated so I needed an alternative – the terminal. It turns out that using the terminal to find the directory size is incredibly easy.
The basic syntax for finding the directory size in Linux is goes like this:
du [options] /path/to/directory. Running the command without any options will show you the size of each sub-directory and as well as the total as the last line in the output. But there are a bunch of helpful option configurations. You can always see
du --help if you want more.
du -h – formats sizes according to kilo, mega, and gigabytes.
du -hc – produces a line with the word total at the end
du -hcs – skips displaying size for sub-directories.
That’s all there is to finding the size of a directory in Linux.
I tried to install Ubuntu 10.04 on my HP dv6-2150us laptop but I was greeted with no wireless networking so I promptly erased the Ubuntu partition. After restarting, I got an error from grub stating that was no operating system. I knew I had to restore the Windows Boot Loader.
I thought the Windows 7 automatic repair system would kick in eventually, but it didn’t. Moving along, fixing the problem is incredibly easy. You’re going to need a Windows 7 installation disk. I had a Windows 7 Home Primium disk lying around, so I used that. I don’t know if a recovery disc you made will actually work, but you can try it.
Put your Windows 7 disk (W7D) in the optical drive and start up the computer. Then, boot from CD. Since I was using an HP laptop, I needed to hit escape and then hit F9 to boot from disc. You’re computer may be different. Once you boot into the disc, it’ll ask you to pick a language and keyboard setup. Just pick whatever you like and hit next. Now, you’ll see a huge Install Now button. Don’t click it. Look below it for Repair.
Once that comes up, you’ll see a few options but look for open command line. You’ll be entering a frightening command line. Once the command line opens up, enter
Bootrec.exe /FixMbr. If the command works, it will say it was successful. That should be it, close the command line window and hit the restart button.