Archive of ‘Tutorials’ category

Customizing your directory colors.

Customizing your directory colors.

I know a lot of you know the command ls –color. Which displays your directory with colors. But, a lot of people may not know that those colors are customizable. All you need to do is add the following line to your /etc/bashrc file.

eval `dircolors /etc/DIR_COLORS`

And then all of the color configuration can be found in the file /etc/DIR_COLORS

How to do backup with tar?

How to do backup with tar?

You can mantain a list of files that you with to backup into a file and tar
it when you wish.

tar czvf tarfile.tar.gz -T list_file

where list_file is a simple list of what you want to include into the tar

i.e:

/etc/smb.conf
/root/myfile
/etc/ppp (all files into the /etc/ppp directory)
/opt/gnome/html/gnome-dev-info.html

Zombies

Zombies

zombies1

What are these zombie processes that show up in ps? I kill them but they don’t go away!

Zombies are dead processes. You cannot kill the dead. All processes eventually die, and when they do they become zombies. They consume almost no resources, which is to be expected because they are dead! The reason for zombies is so the zombie’s parent (process) can retrieve the zombie’s exit status and resource usage statistics. The parent signals the operating system that it no longer needs the zombie by using one of the wait() system calls.

When a process dies, its child processes all become children of process number 1, which is the init process. Init is “always” waiting for children to die, so that they don’t remain as zombies.

If you have zombie processes it means those zombies have not been waited for by their parent (look at PPID displayed by ps -l). You have three choices: Fix the parent process (make it wait); kill the parent; or live with it. Remember that living with it is not so hard because zombies take up little more than one extra line in the output of ps.

Setting your Timezone

Setting your timezone

The timezone under Linux is set by a symbolic link from /etc/localtime[1] to a file in the /usr/share/zoneinfo[2] directory that corresponds with what timezone you are in. For example, since I’m in South Australia, /etc/localtime is a symlink to /usr/share/zoneinfo/Australia/South. To set this link, type:

ln -sf ../usr/share/zoneinfo/your/zone /etc/localtime

Replace your/zone with something like Australia/NSW or Australia/Perth. Have a look in the directories under /usr/share/zoneinfo to see what timezones are available.

[1] This assumes that /usr/share/zoneinfo is linked to /etc/localtime as it is under Red Hat Linux.

[2] On older systems, you’ll find that /usr/lib/zoneinfo is used instead of /usr/share/zoneinfo. See also the later section “The time in some applications is wrong”.

Setting the Hardware Clock

Setting the hardware clock

To set the hardware clock, my favourite way is to set the system clock first, and then set the hardware clock to the current system clock by typing “/sbin/hwclock –systohc” (or “/sbin/hwclock –systohc –utc” if you are keeping the hardware clock in UTC). To see what the hardware clock is currently set to, run hwclock with no arguments. If the hardware clock is in UTC and you want to see the local equivalent, type “/sbin/hwclock –utc”

Setting the System Clock

Setting the system clock

To set the system clock under Linux, use the date command. As an example, to set the current time and date to July 31, 11:16pm, type “date 07312316” (note that the time is given in 24 hour notation). If you wanted to change the year as well, you could type “date 073123161998”. To set the seconds as well, type “date 07312316.30” or “date 073123161998.30”. To see what Linux thinks the current local time is, run date with no arguments.

1 10 11 12 13

Content Protected Using Blog Protector By: PcDrome. & GeekyCube.