Tag: linux

More DOS-like commands

More DOS-like commands

Many people are moving to Linux because they miss the stability of good old DOS. In that light, many users are typing DOS commands (which originated from UNIX in the first place) that look fine but cause errors. The command “cd..” in DOS is perfectly valid, but Linux balks. This is because “cd” is a command, and any parameter for that command must be separated from the command by a space. The same goes for “cd/” and “cd~”. A quick fix is here.

Use your favorite text editor in your home directory to edit the file “.bashrc”. The period is there on purpose, this hides the file from normal ls display.

Add the lines:

alias cd/=”cd /”
alias cd~=”cd ~”
alias cd..=”cd ..”

And I usually add these…

alias md=”mkdir”
alias rd=”rmdir -i”
alias rm=”rm -i”

and my first and still favorite alias…

alias ls=”ls –color”

alias is a powerful tool, and can be used in the .bashrc script as well as from the command line. You can, if you want to spend the time, create your own group of shell commands to suit how you work. As long as you put them in your .bashrc file, they’ll be there everytime you log in. Note that if you frequently log in as root, you might want to copy /home/username/.bashrc to /root/.bashrc to keep yourself sane.

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


/etc/ppp (all files into the /etc/ppp directory)




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”.

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