Here are some tips and tricks¬†for CentOS I have been using for a while . I am currently using CentOS 5.9. So I am not sure whether these will work on CentOS 6, but I don’t see why not.

1. make an alias for “vi” to use “vim”.

I think it’s much more useful to use vim because of the syntax highlighting and colors. It makes reading code and config files much easier and pleasing.

$ vi ~/.bashrc

add the following to the end.

alias vi=vim

log out and log in again.

(If this doesn’t work, do the same thing to ~/.bash_profile)

2. forward root’s emails to an external email

$ vi /etc/aliases

find this line

#root:   marc

uncomment it and change “marc” to your email address

then run this command to refresh the aliases.

$ newaliases

Another way to do it is that you can add your email address to ~/.forward

3. change the hostname

$ vi /etc/sysconfig/newwork

change HOSTNAME to the new host name

HOSTNAME=newhost

$ vi /etc/hosts

add the new host name to the line starting with 127.0.0.1

$ hostname newhost

4. Change ls directory color

$ cp /etc/DIR_COLORS ~/.dir_colors
$ vi .dir_colors

change DIR 01;34 (dark blue) to DIR 01:31 (red)

5. sendmail – configure the “From Address” as your domain name

$ vi /etc/mail/sendmail.mc

find these lines or add them if not exists
MASQUERADE_AS(`domain_name.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl

change EXPOSED_USER(`root')dnl to dnl EXPOSED_USER(`root')dnl
save the file. Then commit the change

$ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Note: you might encounter this error when running the above command

$ /etc/mail/sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

You need to install sendmail-cf

$ yum install sendmail-cf
$ service sendmail restart

Post Navigation