How to change the hostname of a Linux system

Posted on June 3rd, 2008 in Basics, Linux+, Networking by admin

Normally we will set the hostname of a system during the installation process. Many peoples don’t care about this, and don’t change the hostname even if for example this was set to something really stupid by the datacenter that installed the system (most likely they will set this to “debian” on any debian installation, etc). For me, it is important to see on each one of the ssh screens I will have open at any time a different hostname that is relevant and will give me quickly the information on what system I am logged in.

The /etc/default/rcS file

Posted on May 16th, 2008 in Basics, Linux+ by admin

Source

There is some behavior of your Linux Operating System which is easy to change, but not too common to know how.

The things you can change are:

  • Frequency to erase /tmp/ directory
  • Use UTC or local time
  • How Verbose are the boot messages of your Linux
  • If a disk error should be always repaired while booting automatically

Getting started with awk

Posted on May 15th, 2008 in Basics, Linux+ by admin

Source

This qref is written for a semi-knowledgable UNIX user who has just come up against a problem and has been advised to use awk to solve it. Perhaps one of the examples can be quickly modified for immediate use.

Discover the possibilities of the /proc directory

Posted on April 15th, 2008 in Basics, Linux+ by admin

The /proc directory is a strange beast. It doesn’t really exist, yet you can explore it. Its zero-length files are neither binary nor text, yet you can examine and display them. This special directory holds all the details about your Linux system, including its kernel, processes, and configuration parameters. By studying the /proc directory, you can learn how Linux commands work, and you can even do some administrative tasks.

Under Linux, everything is managed as a file; even devices are accessed as files (in the /dev directory). Although you might think that “normal” files are either text or binary (or possibly device or pipe files), the /proc directory contains a stranger type: virtual files. These files are listed, but don’t actually exist on disk; the operating system creates them on the fly if you try to read them.

Most virtual files always have a current timestamp, which indicates that they are constantly being kept up to date. The /proc directory itself is created every time you boot your box. You need to work as root to be able to examine the whole directory; some of the files (such as the process-related ones) are owned by the user who launched it. Although almost all the files are read-only, a few writable ones (notably in /proc/sys) allow you to change kernel parameters. (Of course, you must be careful if you do this.)

Linux Boot Sequence

Posted on April 9th, 2008 in Basics, Linux+ by admin

The following tutorial covers the following points within the Linux boot sequence:

  1. BIOS
  2. Master Boot Record (MBR)
  3. LILO or GRUB
  4. Kernel
  5. init
  6. Run Levels

Basics of iptables

Posted on April 4th, 2008 in Basics, Commandline Tools, Linux+, Networking, Security by admin

Alot of people are freaked out by IPTables and find it hard to understand. However, once you get the grasp of it the basics are easy. This document will serve as a basic how-to on using iptables.

What are and how to change Runlevels

Posted on March 24th, 2008 in Basics, Linux+ by admin

Many people get confused when trying to boot in to a runlevel other than runlevel 5, for example runlevel 3, disabiling the GUI front end with which most users are familiar. Hopefully this howto will help answer the questions “How do I disable X” or “How do I boot without X” or even “How do I get to single user mode.”

One requirement of this is to have an understanding of what runlevels are, how changing runlevels will impact your system, and what services may or may not be started. In general this is beyond the scope of this document but I will give a quick run down of things as listed in /etc/inittab.

Just a warning, this does not apply to Ubuntu as Ubuntu focuses on Upstart.

Running Multiple Sessions in Linux

Posted on March 24th, 2008 in Basics, Linux+ by admin

You might have noticed there is an entry in your KDE and Gnome menu called “Start New Session” ( In some distros “Switch User” ). I will try to explain a few things about this feature.

You can, at any time, do Ctrl+Alt+F1 ( to F6 ) to get a text console you could log in as another user ( also as root ) to perform needed tasks and at the same time have your X running under Ctrl+Alt+F7. So switching up and down between the X session and the text session was easy as pressing a few keys on your keyboard.

File System Checking with fsck

Posted on March 24th, 2008 in Basics, Hardware, Linux+ by admin

The system utility fsck (for “file system check” or “file system consistency check”) is a tool for checking the consistency of a file system in the Unix system and clones thereof.

Generally, fsck is run automatically at boot time when the system detects that a file system is in an inconsistent state, indicating a non-graceful shutdown, such as a crash or power loss. Typically, fsck utilities provide options for either interactively repairing damaged file systems (the user must decide how to fix specific problems), automatically deciding how to fix specific problems (so the user doesn’t have to answer any questions), or reviewing the problems that need to be resolved on a file system without actually fixing them.

Fsck can also be run manually by the root account if there is believed to be a problem with the file system. However, running fsck on a mounted file system can potentially cause severe data corruption/loss.

Send a process to the background and the foreground

Posted on March 23rd, 2008 in Basics, Linux+ by admin

To run a process in the background, simply append a space and an ampersand (&) at the end of the commandline. At any time, you can then run the ‘jobs’ command. This shows you what processes have been run in the background. They are listed numerically. When you are ready to resume a process in the foreground, you type in ‘fg %[INSERT PROCESS NUMBER HERE]‘. You get the process number from the ‘jobs’ command we ran before.

As an example, let’s try this with top. First, we run it in the background:

[1100][tux@training:~]$ top &

[1] 11746

[1100][tux@training:~]$

Next, let’s take a look at the jobs we have running in the background:

[1100][tux@training:~]$ jobs

[1]+ Stopped top

[1102][tux@training:~]$

We can see that top has a [1] in front of it. We are going to use the ‘1′ to bring that job back to the foreground:

[1102][tux@training:~]$ fg %1

You will then see the output of top as you normally would expect.

Next Page »