Linux Archives

The Best Linux Articles

Chances are if you’re a new reader, you haven’t read a lot of the stuff here that seems to get buried in the archives. Here are some of our most popular articles for your enjoyment:

Popularity: 1% [?]

How to record your Linux shell session

A lot of people are probably not aware of the command script. Script is a quick and easy way to record everything you do in a terminal session.  I use script to record sessions of me fixing a server, or troubleshooting Linux issues, and save it for future needs, or to pass on to others as training material.  Here is what the Linux man page says:

Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).

Using script to record your terminal session

It’s really quite simple to record your bash session.  All you need to do is type script -a filename to start recording your session:

laptop:~ foogazi# script -a session1_jun162010
Script started, output file is session1_jun162010
laptop:~ foogazi#

Now that the recording has started, everything you type, as well as everything that returns as output, will be saved into the filename you chose to output to.

Popularity: 16% [?]

Linux rename user command

I’ve gotten this question a whole bunch of times in the past.  You’ve got a Linux username that you want to rename, rather than recreate, so you don’t lose any significate data or permission settings.  How do you rename a Linux user?

Linux rename user command

To rename a Linux user (rename user name), you want to use the Linux command usermod.  From the man page:

The usermod command modifies the system account files to reflect the changes that are specified on the command line.

In short, here is the command to rename the Linux user:

usermod -d "/home/current_user-name" -m -l current_user_name new_user-name

And now an explanation of what each option means:

  • -d specifies the current users home directory.
  • -m specifies that you want to move the files from the current users home directory, to the new directory. You want to make sure you specify this, otherwise the users data will not transfer over to the new user account.
  • -l specifies the current user name, and the new user name you wish to change it to.

That’s it. Now you’ve renamed a Linux user.

Popularity: 4% [?]

10 People Who Should Use Linux

I’ve been thinking lately that there are actually certain types of people out there that should be using Linux instead of Windows.

Types of people who should be using Linux

Geeks and people who enjoy tinkering with computers

If you enjoy psychically building computers, chances are you’ll like tinkering with the operating system once your machine is running.  There is no better operating system to tinker with than Linux.

People who want easy security

Linux is much more secure than windows ‘out of the box’.  If you don’t want to bother with security, you should be using Linux.

People who want a unique look and feel

With Linux desktop environments, you can customize anything and everything you see on your screen with the right amount of knowledge.  You really can’t do that in Windows.

People who like the idea of open source software

If you support the principles of open source technology and wish to practice them to the fullest, you’ll definitely want to be running Linux.

Programmers who enjoy contributing to free open source software

This title should really be for all programmers.  If you’re a code nut, you should be running Linux.

People who only use the computer for basic needs and don’t want to be bothered by viruses and spyware.

I recently moved some of my family to a basic Ubuntu desktop.  The majority of their computer use consists of browsing, email, pictures, and instant messaging.  No reason for them to be running Windows if that is all they do.  Linux can not only do it faster, but better, and much more safely.

People who don’t want to have to reboot because there computer starts “running slow” due to adware, spyware, bloatware, etc.

This goes right along the lines with the last one.  Most non-techie computer users think that their computer is always “running so slow” because it’s ‘old’.  Chances are the computer is running slow from having so many adware applications running in the background.  I’ve yet to see a Linux install on any of my family machines, receive, much less slow down from adware, spyware, etc.

Do you use Linux? What type of person are you?

Popularity: 3% [?]

The Best Resources To Help You Learn MySQL

Chances are that if you’re a Linux and open source geek like most of the visitors to Foogazi are, you probably know a little bit about MySQL.  But if you’re a true geek, you want to learn all there is to know.  Databases power just about everything on the Internet these days, and MySQL is one of the most popular web databases languages there is.  Not only is it a great tool, but it’s a great language to know.

Here are some great tips to help you learn MySQL.

Visit MySQL Forums

As with anything you’re trying to learn, it’s always best to become an active member of the community.  Not only will you gather valuable information from people all around you, but you’re in a place with other likeminded people.  Being active in forums is key to learning the most you can.  MySQL forums contain a ton of great tips and useful information.

Here are a few MySQL forums for you to check out:

MySQL Mailing Lists

Just as important becoming an active member in MySQL forums is, it is also important to participate in mailing list discussions.  Some of my biggest “oh I get it” moments have been from emails posted to mailing lists.  Along with forums, mailing lists are a great place to throw out a question and get a quick answer.

Check out the only resource for MySQL Mailing Lists you need:

Planet MySQL

Planet MySQL is an aggregation of blogs and news from MySQL developers and users.  This is site is a must resource. RSS, web browser, whatever way you like to read, this should be one of your most frequented websites when trying to learn MySQL.

Check out planet mysql here:

Official MySQL Documentation

The MySQL website offers a ton of useful documentation and resources, so obviously this is going to be one place you’ll want to frequent. The MySQL reference manuals are a must have when learning MySQL.

Check out the MySQL documentation here:

MySQL Books

MySQL books are obviously one of the best resources to learn from.  I personally prefer a tangible book I can bring with me anywhere to learn from.

Here are some of my favorite MySQL books:

Of all the things I’ve listed as being the best resources to learn MySQL, I must say for me, the most important one is active participation with the community.  The more you ask questions, the more you learn.  The more you teach, the more you learn.  You can’t lose either way.

How do you prefer to learn? Have some more resources? Let us know in the comments!

Popularity: 5% [?]

How to configure static IP on Ubuntu

Do you use Ubuntu and wish to set a static IP for your machine?  It’s simple. Follow the steps below to find out how.

  • Right click the network manager icon at the top right of your desktop
  • Select Edit Connections
  • Select Wired
  • Click the EDIT button
  • Click the IPv4 settings tab
  • Select Manual from the method drop down list
  • Click the ADD button to add your static IP address
  • Add your DNS addresses in the DNS servers field. You can separate each DNS entry with a comma
  • Click OK.
  • Restart networking using this command: /etc/init.d/networking restart

Popularity: 1% [?]

How to reset your Linux Password

If you’ve ever forgotten your Linux password, chances are you’ve needed to either restore your Linux installation.  Hopefully this solution will save you from having to reinstall Linux in the event that you forget your password.

Reset your Linux password using Grub:

When your machine boots into Grub, you’ll want to press “e” to edit the grub boot linux.

After pressing “e”, navigate to the kernel line and add the word “single” to the end of the long string.

Press “b” to boot into single user mode.

You should then be taken directly to a root user shell, where you can then type passwd, and change your root password.

After you’ve reset your root password, type reboot at the shell to leave single user mode.

Popularity: 1% [?]

There was an interesting post on Ask Slashdot discussing the ethics of releasing non-malicious Linux malware to simply prove a point to all of the people who rant and rave about Linux being so secure.  A developer by the name of buchner.johannes

buchner.johannes writes:

“I was fed up with the general consensus that Linux is oh-so-secure and has no malware. After a week of work, I finished a package of malware for Unix/Linux. Its whole purpose is to help white-hat hackers point out that a Linux system can be turned into a botnet client by simply downloading BOINC and attaching it to a user account to help scientific projects. The malware does not exploit any security holes, only loose security configurations and mindless execution of unverified downloads. I tested it to be injected by a PHP script (even circumventing safe mode), so that the Web server runs it; I even got a proxy server that injects it into shell scripts and makefiles in tarballs on the fly, and adds onto Windows executables for execution in Wine. If executed by the user, the malware can persist itself in cron, bashrc and other files. The aim of the exercise was to provide a payload so security people can ‘pwn’ systems to show security holes, without doing harm (such as deleting files or disrupting normal operation). But now I am unsure of whether it is ethically OK to release this toolkit, which, by ripping out the BOINC payload and putting in something really evil, could be turned into proper Linux malware. On the one hand, the way it persists itself in autostart is really nasty, and that is not really a security hole that can be fixed. On the other hand, such a script can be written by anyone else too, and it would be useful to show people why you need SELinux on a server, and why verifying the source of downloads (checksums through trusted channels) is necessary. Technically, it is a nice piece, but should I release it? I don’t want to turn the Linux desktop into Windows, hence I’m slightly leaning towards not releasing it. What does your ethics say about releasing such grayware?”

This is a great thing for the community at large to see that Linux can be exploited with malware just like it’s rival operating systems.  However, I share the same concerns the developer does.  This indeed could result in a black-hat user injecting something malicious into the code and actually turning the example into real evil malware. I’m on the fence though, maybe this is what Linux users need to prove that we aren’t like typical Windows users who click any random link and download any random software from any random untrusted third-party site.  A user who goes by the name of silentcoder wrote: “Linux users (hardly ever) download and install software from the internet. We download and install packages from repositories. The average user simply cannot tell the difference between a useful piece of freeware and a bugridden-malware-spreading piece of add-ware.”

Paranoia aside, this definitely proves that Linux is just as susceptible to malware and viruses as any other operating system.  But, as I’ve always said, viruses and malware are usually a result of user error, no matter the operating system.

What do you all think, should this type of code be released as proof of concept even if it’s risking malicious manipulation?  Should we all just start using SELinux and be done with it?

Popularity: 5% [?]

Must have Linux books for Christmas

The gift giving season is right around the corner and if you have any geeky relatives or friends, then this list of Linux books to buy for Christmas is a good reference.  Click each image to find out more.

Linux Bible 2010 Edition: Boot Up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 13 Other Distributions

Linux Administration: A Beginner’s Guide, Fifth Edition

Practical Guide to Linux Commands, Editors, and Shell Programming

How Linux Works: What Every Superuser Should Know

Linux Command Line and Shell Scripting Bible

Linux System Administration

Beginning the Linux Command Line

Pro Linux System Administration

Linux Security Cookbook

Hardening Linux

Popularity: 5% [?]

7 Must Have Linux iPhone Applications

If you’re anything like me and love tech gadgets that allow you to do almost anything..then you undoubtedly own an iPhone.  For the past year of being an iPhone owner, I’ve discovered a ton of iPhone apps that help me in my every day life.  Many of them are Linux apps.  Below you will find a list I’ve put together of must have Linux iPhone apps for you to check out.

Linux Command Reference (FREE) – This iPhone app is a handy command reference for the Linux Terminal.  Perfect for situations when you need to reference a command but you’re in the server room without your computer.

LinuxTube – This app allows you to view Linux related videos as well as chat with other Linux enthusiasts.

Server Remote – Easily monitor your Linux server from your iPhone.  This iPhone application uses the standard SSH protocol to communicate with your servers, and requires no special software to be installed on the server end.

SSH – The best SSH client I’ve found in the iPhone app store. It works over Wi-Fi, Edge, and 3G networks.

Chmod (FREE) – Very simple and straight forward reference app for determining file and directory permissions on Mac OS X, Linux and Unix.

Vi Reference – A great reference for those of us who use Vi/Vim.

UNIX Fortune – For those old school nix users, this is the entertaining fortune cookie application converted to an iPhone app.

Hopefully these Linux iPhone apps save you a little bit of time, or just provide some good old fashion entertainment, like they have me.

Do you know of any other iPhone apps available that should be added to this list? Let us know in the comments!

Popularity: 7% [?]