Thursday, 2 August 2012


How to start and stop Apache server in Linux


In the terminal window you need to type the following command to start the apache server

$>service httpd start

or

$>/etc/init.d/httpd start

To stop the server

$>service httpd stop

or

$>/etc/init.d/httpd stop

 RHCE Linux System Administrations commands descriptions and examples

halt
This command shuts down the operating system, but can only be run by the root user.
#halt
reboot
This command shuts down and restarts the operating system. It also can only be run by root.
#reboot           [will perform simple reboot]
#reboot -f        [will perform fast reboot ]
init 0 
This command also shuts down the operating system, and can only be run by your root user.
#init 0
init 6 This command also shuts down and restarts the operating system. It also can only be run by root
#init 6
man
This command opens the manual page for the command or utility specified. The man utility is a very useful tool. If you are unsure how to use any command, use man to access its manual page. For example, you could enterman ls at the shell prompt to learn how to use the ls utility.
#man ls
info 
The info utility also displays a help page for the indicated command or utility. The information displayed with info command will be in-depth than that displayed in the man page for the same command.
info ls
su 
This command switches the current user to a new user account. For example, if you’re logged in as vickey and need to change to user account to vinita,you can enter su vinita at the shell prompt. This command is most frequently used to switch to the superuser root account.
In fact, if you don’t supply a username, this utility assumes that you want to change to the root account. If you enter su -, then you will switch to the root user account and have all of root’s environment variables applied.
This command require password of the user you want switch.

LOOKING FOR FILES

There are two basic commands used for file searches: find and locate

find

The find command searches through directories and subdirectories for a desired file. For example, if you wanted to find the directory with the grub.conflinux boot loader file, you could use the following command, which would start the search in the top-level root (/) directory:
# find / -name grub.conf
But this search took several minutes to get it task done. Alternatively, if you know that this file is located in the /etc subdirectory tree, or /boot/grub/grub.conf you could start in that directory with the following command:
# find /etc -name grub.conf

locate

If this is all too time-consuming, RHEL 5 includes a default database of all files and directories. Searches with the locate command are almost instantaneous. And locate searches don't require the full file name. The drawback is that the locate command database is normally updated only once each day, as documented in the /etc/cron.daily/mlocate.cron script.

Getting into the Files

Now that you see how to find and get around different files, it's time to start reading, copying, and moving the files around. Most Linux configuration files are text files. Linux editors are text editors. Linux commands are designed to read text files. If in doubt, you can check the file types in the current directory with the
file * command.

cat

The most basic command for reading files is cat. The cat filename commandscrolls the text within the filename file. It also works with multiple file names; it concatenates the file names that you might list as one continuous output to your screen. You can redirect the output to the file name of your choice.

more and less

Larger files demand a command that can help you scroll through the file text at your leisure. Linux has two of these commands:
more and less.
With the more filename command, you can scroll through the text of a file, from start to finish, one screen at a time. With the less filename command, you can scroll in both directions through the same text with the PAGE UP and PAGE DOWN keys. Both commands support vi-style searches.

head and tail

The head and tail commands are separate commands that work in essentially the same way. By default, the head filename command looks at the first 10 lines of a file; the tail filename command looks at the last 10 lines of a file. You can specify the number of lines shown with the -nx switch. Just remember to avoid the space when specifying the number of lines; for example, the
# tail -n15 /etc/passwd
command lists the last 15 lines of the /etc/passwd file.

cp

The cp (copy) command allows you to take the contents of one file and place a copy with the same or different name in the directory of your choice. For example, the cp file1 file2 command takes the contents of file1 and saves the contents in file2. One of the dangers of cp is that it can easily overwrite files in different directories, without prompting you to make sure that's what you really wanted to do.

mv

While you can't rename a file in Linux, you can move it. The mv command essentially puts a different label on a file. For example, the mv file1 file2 command changes the name of file1 to file2. Unless you're moving the file to a different partition, everything about the file, including the inode number, remains the same.

ln

You can create a linked file.
linked files are common with device files such as /dev/dvdwriter and /dev/par0. They're also useful for making sure that multiple users have a copy of the same file in their directories. Hard links include a copy of the file. As long as the hard link is made within the same partition, the inode numbers are identical. You could delete a hard-linked file in one directory, and it would still exist in the other directory. For example, the following command creates a hard link from the actual Samba configuration file to smb.conf in the local directory:
# ln smb.conf /etc/samba/smb.conf
On the other hand, a soft link serves as a redirect; when you open up a file created with a soft link, you're directed to the original file. If you delete the original file, the file is lost. While the soft link is still there, it has nowhere to go. The following command is an example of how you can create a soft link:
# ln -s smb.conf /etc/samba/smb.conf

sort

You can sort the contents of a file in a number of ways. By default, the sort command sorts the contents in alphabetical order depending on the first letter in each line. For example, the sort /etc/passwd command would sort all users (including those associated with specific services and such) by username.

grep and egrep

The grep command uses a search term to look through a file. It returns the full line that contains the search term. For example, grep 'vickey' /etc/passwd looks for my name in the /etc/passwd file.
The egrep command is more forgiving; it allows you to use some unusual characters in your search, including +, ?, |, (, and). While it's possible to set up grep to search for these characters with the help of the backslash, the command can be awkward to use.

wc

The wc command, short for word count, can return the number of lines, words, and characters in a file. The wc options are straightforward: for example, wc -w filename returns the number of words in that file.

sed

The sed command, short for stream editor, allows you to search for and change specified words or even text streams in a file. For example, the following command changes the first instance of the word Windows to the word Linux in each line of the file data, and writes the result to the file newdata:
# sed 's/Windows/Linux/' data > newdata
However, this may not be enough. If a line contains more than one instance of Windows, the above sed command does not change the second instance of that word. But you can make it change every appearance of Windows byadding a "global" suffix:
# sed 's/Windows/Linux/g' data > newdata

awk

The awk command, named for its developers (Aho, Weinberger, and Kernighan), is more of a database manipulation utility. It can identify lines with a keyword and read out the text from a specified column in that line. Again, using the /etc/passwd file, for example, the following command will read out the username of every user with a vickey in the comment column:
# awk '/vickey/ {print $1}' /etc/passwd

ps

It's important to know what's running on your Linux computer. The ps command has a number of critical switches. When trying to diagnose a problem, it's common to get the fullest possible list of running processes, and then look for a specific program. For example, if the Firefox Web browser were to suddenly crash, you'd want to kill any associated processes. The ps aux | grep firefox command could then help you identify the process(es) that you need to kill.

who and w

If you want to know what users are currently logged into your system, use the who command or the w command. This can help you identify the usernames of those who are logged in, their terminal connections, their times of login, and the processes that they are running.

Wildcards

Sometimes you may not know the exact name of the file or the exact search term. This is when a wildcard is handy. The basic wildcards are shown
WildcardDescription
*Any number of alphanumeric characters (or no characters at all). For example, the ls ab* command would return the following file names, assuming they exist in the current directory: ab, abc, abcd.
?One single alphanumeric character. For example, the ls ab? command would return the following file names, assuming they exist in the current directory: abc, abd, abe
[ ]A range of options. For example, the ls ab[123] command would return the following file names, assuming they exist in the current directory: ab1, ab2, ab3. Alternatively, the ls ab[X-Z] command would return the following file names, assuming they exist in the current directory: abX, abY, abZ.

env

This command displays the environment variables for the currently logged-in user.

echo

This command is used to echo a line of text on the screen. It’s frequently used to display environment variables. For example, if you wanted to see the current value of the PATH variable, you could enter
echo $PATH

top

This command is a very useful command that displays a list of all applications and processes currently running on the system. You can sort them by CPU usage, memory usage, process ID number, and which user owns them

which

This command is used to display the full path to a shell command or utility. For example, if you wanted to know the full path to the ls command, you would enter
which ls

whoami

This command displays the username of the currently logged-in user.

netstat

This command displays the status of the network, including current connections, routing tables, etc

route

This command is used to view or manipulate the system’s routing table.

ifconfig

This command is used to manage network boards installed in the system. It can be used to display or modify your network board configuration parameters. This command can only be run by the root user.
Once you become familiar with these basic command which you need to perform RCHE skill you are ready to move our next series of article focused on RHCE exam.

HOW to Enable Root Login on RHEL6

If You want to login as a root from GUI in RHEL6  then you have
to edit something like some files which are located to /etc/pam.d/
Open your Terminal from Applications -> System Tools -> Terminal

Now Login as a root  from your terminal

Step 1 :- [sham@rhel6]$ su – root
Password:-

Step 2:- Now go to your /etc/pam.d/ directory.

[root@rhel6]# cd /etc/pam.d/
Then first take a backup of gdm file
cp gdm gdm.bkp ( always take backup if anything goes wrong you can correct it by original file)

Step 3 :- Now Open gdm file in your favourite editor. I am using vi as my editor.
[root@rhel6]#  vi gdm
Find and Comment or remove this line into your gdm file
auth required pam_succeed_if.so user != root quiet


Step 4 :- Save & Exit From that File.

Step 5 :- Here is the additional file that you need to edit and that
file name is gdm-password. Open gdm-password file in your favourite
editor. I am using vi as my editor.
Then first take a backup of gdm-password file
cp gdm-password gdm-password.bkp ( always take backup if anything goes wrong you can correct it by original file)
[root@rhel6]# vi gdm-password
Find and Comment or remove this line into your gdm file
auth required pam_succeed_if.so user != root quiet


Step 6 :- Save & Exit from File. Now Logout and Try to Login as a
root user. Now you are able to Login as a root user from GUI in RHEL6.

Wednesday, 1 August 2012


Configuring connection to NTP servers



The first thing you define in your /etc/ntp.conf is the servers your machine will synchronize to. Note that some defaults are present there already, so simple syncing with ntpd -q works out-of-the-box. 
NTP servers are classified in a hierarchical system with many levels called strata: the devices which are considered independent time sources are classified as stratum 0sources; the servers directly connected to stratum 0 devices are classified asstratum 1 sources; servers connected to stratum 1 sources are then classified asstratum 2 sources and so on. 
It has to be understood that a server's stratum cannot be taken as an indication of its accuracy or reliability. Typically, stratum 2 servers are used for general synchronization purposes: if you do not already know the servers you are going to connect to, you should use the pool.ntp.org servers (alternate link) and choose the server pool that is closest to your location. 
The following lines are just an example: 
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst
The iburst option is recommended, and sends a burst of packets if it cannot obtain a connection with the first attempt. The burst option always sends a burst of packets, even on the first attempt. The burst option should never be used without explicit permission and may result in blacklisting. 

Configuring your own NTP server

If setting up an NTP server, you need to add local clock as a server, so that, in case it loses internet access, it will continue serving time to the network; add local clock as a stratum 10 server (using the fudge command) so that it will never be used unless internet access is lost: 
server 127.127.1.0
fudge  127.127.1.0 stratum 10
Next, define the rules that will allow clients to connect to your service (localhost is considered a client too) using the restrict command; you should already have a line like this in your file: 
restrict default nomodify nopeer noquery
This restricts everyone from modifying anything and prevents everyone from querying the status of your time server: nomodify prevents reconfiguring your ntpd (with ntpq or ntpdc), and noquery prevents dumping status data from your ntpd (also with ntpq or ntpdc). 
You can also add other options: 
restrict default kod nomodify notrap nopeer noquery
Note: This still allows other people to query your time server. You need to add noserve to stop serving time.
Full docs for the "restrict" option are in man ntp_acc. Seehttps://support.ntp.org/bin/view/Support/AccessRestrictions for detailed instructions. 
Following this line, you need to tell ntpd what to allow through into your server; the following line is enough if you are not configuring an NTP server: 
restrict 127.0.0.1
If you want to force DNS resolution to the IPv6 namespace, write -6 before the IP address or host name (-4 forces IPv4 instead), for example: 
restrict -6 default kod nomodify notrap nopeer noquery
restrict -6 ::1    # ::1 is the IPv6 equivalent for 127.0.0.1
Lastly, specify the drift file (which keeps track of your clock's time deviation) and optionally the log file location: 
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
A very basic configuration file will look like this (all comments have been stripped out for clarity): 
/etc/ntp.conf
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1
restrict -6 ::1  

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
Note: Defining the log file is not mandatory, but it is always a good idea to have feedback for ntpd operations.

Other resources about NTP configuration

In conclusion, never forget man pages: man ntp.conf is likely to answer any doubts you could still have (see also the related man pages: man {ntpd|ntp_auth|ntp_mon|ntp_acc|ntp_clock|ntp_misc}). 
See the Gentoo Linux Wiki article on this subject for more information: NTP

Using without daemon

If what you want is just synchronize your system clock at any time without runningntpd as a daemon, you can use this command: 
ntpd -qg
This behavior mimics that of the ntpdate program, which is now deprecated: see also the official notice, which also provides a table for the conversion of ntpdateflags to ntpd flags. 
The -g option allows shifting the clock further than the panic threshold (15 min by default) without a warning. Note that such offset is abnormal and might identify either wrong timezone setting, clock chip failure, or simply a very long period of neglect. If in these cases you would rather not set the clock and print an error to syslog, remove -g
ntpd -q
For example, you could add a ntpd -qg & line to your /etc/rc.local to run at every boot. See Autostarting for alternative methods. 
Check that the DAEMONS array in /etc/rc.conf includes hwclock, to ensure the hardware clock is periodically updated, see Time for more information. 
Warning:
  • Using this method is highly discouraged on servers and in general on machines that need to run continuously for more than 2 or 3 days, as the system clock will be updated only once at boot time.
  • Running ntpd -qg as a cron event is to be completely avoided, unless you are perfectly aware of how your running applications would react to instantaneous system time changes.
  • If something other already takes care of updating the hardware clock, for example another operating system in dual boot, you should avoid starting hwclock.
Note: In order for this method to work you have to make sure that, when rc.local is executed, the network connection has already been initialized (for example you should not background essential network-related daemons in /etc/rc.conf)

Running as a daemon

Starting ntpd

ntpd sets 11 minute mode, which syncs the system clock to hardware every 11 minutes. The hwclock daemon measures hardware clock drift and syncs it, which conflicts with ntpd. 
Stop the hwclock daemon (if it is running): 
# rc.d stop hwclock
Start the ntpd daemon: 
# rc.d start ntpd
Add ntpd to your DAEMONS array so it starts automatically on boot and make sure hwclock is disabled: 
/etc/rc.conf
DAEMONS=(... !hwclock ntpd ...)

NetworkManager

Note: ntpd should still be running when the network is down if the hwclock daemon is disabled, so you should not use this.
ntpd can be brought up/down along with a network connection through the use ofNetworkManager's dispatcher scripts. You can install the needed script from [community]: 
# pacman -S networkmanager-dispatcher-ntpd

Running as non-root user

When compiled with --enable-linux-caps, ntp can be run as a non-root user for increased security (the vanilla Arch Linux package has this enabled). 
Note: Before attempting this, make sure ntp has already created /var/lib/ntp/ntp.drift.
Create ntp group and ntp user: 
# groupadd ntp
# useradd -r -d /var/lib/ntp -g ntp -s /bin/false ntp
Change ownership of the ntp directory to the ntp user/group: 
# chown -R ntp:ntp /var/lib/ntp
Edit /etc/conf.d/ntpd.conf and change 
NTPD_ARGS="-g"
to 
NTPD_ARGS="-g -u ntp:ntp"
Finally, restart the daemon: 
# rc.d restart ntpd

Running in a chroot

Note: Before attempting this, complete the previous section on running as non-root, since chroots are relatively useless at securing processes running as root.
Edit /etc/conf.d/ntpd.conf and change 
NTPD_ARGS="-g -u ntp:ntp"
to 
NTPD_ARGS="-g -i /var/lib/ntp -u ntp:ntp"
Then, edit /etc/ntp.conf to change the driftfile path such that it is relative to the chroot directory, rather than to the real system root. Change: 
driftfile       /var/lib/ntp/ntp.drift
to 
driftfile       /ntp.drift
Create a suitable chroot environment so that getaddrinfo() will work by creating pertinent directories and files (as root): 
# mkdir /var/lib/ntp/etc /var/lib/ntp/lib /var/lib/ntp/proc
# touch /var/lib/ntp/etc/resolv.conf /var/lib/ntp/etc/services
and by bind-mounting the aformentioned files: 
/etc/fstab
...
#ntpd chroot mounts
/etc/resolv.conf  /var/lib/ntp/etc/resolv.conf none bind 0 0
/etc/services   /var/lib/ntp/etc/services none bind 0 0
/lib            /var/lib/ntp/lib none bind 0 0
/proc    /var/lib/ntp/proc none bind 0 0
# mount -a
Finally, restart the daemon again: 
# rc.d restart ntpd
It is relatively difficult to be sure that your driftfile configuration is actually working without waiting a while, as ntpd does not read or write it very often. If you get it wrong, it will log an error; if you get it right, it will update the timestamp. If you do not see any errors about it after a full day of running, and the timestamp is updated, you should be confident of success.

Apache Server Interview Questions and Answers for Linux Admin?



Q:- What is location of log files for Apache server ?
/var/log/httpd
Q: - What are the types of virtual hosts ?

name-based and IP-based.Name-based virtual host means that multiple names are running on each IP address.IP-based virtual host means that a different IP address exists for each website served. Most configurations are named-based because it only requires one IP address.
Q: - How to restart Apache web server ?

service httpd restart
Q: - How to check the version of Apache server ?

rpm -qa |grep httpd
Q: - What is meaning of "Listen" in httpd.conf file ? 

Port number on which to listen for nonsecure (http) transfers.
Q: - What is DocumentRoot ?

it is a location of files which are accessible by clients. By default, the Apache HTTP server in RedHat Enterprise Linux is configured to serve files from the /var/www/html/ directory.
Q: - On which port Apache server works ?

http - port 80https - port 443
Q: - Tell me name of main configuration file of Apache server ?

httpd.conf
Q: - On which version of apache you have worked ?

httpd-2.2.3
Q: - What do you mean by a valid ServerName directive?

The DNS system is used to associate IP addresses with domain names. The value of ServerName is returned when the server generates a URL. If you are using a certain domain name, you must make sure that it is included in your DNS system and will be available to clients visiting your site.
Q: - What is the main difference between <Location> and <Directory> sections?

Directory sections refer to file system objects; Location sections refer to elements in the address bar of the Web page
What is the difference between a restart and a graceful restart of a web server?

During a normal restart, the server is stopped and then started, causing some requests to be lost. A graceful restart allows Apache children to continue to serve their current requests until they can be replaced with children running the new configuration.
Q: - What is the use of mod_perl module?

mod_perl scripting module to allow better Perl script performance and easy integration with the Web server.
Q: - If you have added “loglevel Debug” in httpd.conf file, than what will happen?

 It will give you more information in the error log in order to debug a problem.
Q: - Can you record the MAC (hardware) address of clients that access your server.

No
Q: - Can you record all the cookies sent to your server by clients in Web Server logs?

Yes, add following lines in httpd.conf file.CustomLog logs/cookies_in.log "%{UNIQUE_ID}e %{Cookie}i" CustomLog logs/cookies2_in.log "%{UNIQUE_ID}e %{Cookie2}i"
Q: - Can we do automatically roll over the Apache logs at specific times without having to shut down and restart the server?

Yes
Use CustomLog and the rotatelogs programs

Add following line in httpd.conf file. CustomLog "| /path/to/rotatelogs/path/to/logs/access_log.%Y-%m-%d 86400" combined
Q: - What we can do to find out how people are reaching your site?

Add the following effector to your activity log format. %{Referer}
Q: - If you have only one IP address, but you want to host two web sites on your server. What will you do?
In this case I will use Name Based Virtual hosting.
ServerName 10.111.203.25
NameVirtualHost *:80
<VirtualHost *:80>
ServerName web1.test.comDocumentRoot /var/www/html/web1</VirtualHost><VirtualHost *:80>ServerName web2.test2.comDocumentRoot /var/www/html/web2</VirtualHost>
Q: - Can I serve content out of a directory other than the DocumentRootdirectory?

Yes, by using “Alias” we can do this.
Q: - If you have to more than one URL map to the same directory but you don't have multiple Alias directives. What you will do?

In this case I will use “AliasMatch” directives.The AliasMatch directive allows you to use regular expressions to match arbitrary patterns in URLs and map anything matching the pattern to the desired URL.
Q: - How you will put a limit on uploads on your web server?

This can be achieved by LimitRequestBody directive.
<Directory "/var/www/html/data_uploads">
LimitRequestBody 100000</Directory>
Here I have put limit of 100000 Bytes
Q: - I want to stop people using my site by Proxy server. Is it possible?

<Directory proxy:http://www.test.com/myfiles>Order Allow,DenyDeny from allSatisfy All</Directory>
Q: - What is mod_evasive module?

mod_evasive is a third-party module that performs one simple task, and performs it very well. It detects when your site is receiving a Denial of Service (DoS) attack, and it prevents that attack from doing as much damage. mod_evasive detects when a single client is making multiple requests in a short period of time, and denies further requests from that client. The period for which the ban is in place can be very short, because it just gets renewed the next time a request is detected from that same host.
Q: - How t to enable PHP scripts on your server?

If you have mod_php installed, use AddHandler to map .php and .phtml files to the PHP handler. AddHandler application/x-httpd-php .phtml .php
Q: - Which tool you have used for Apache benchmarking?

ab (Apache bench)
ab -n 1000 -c 10 http://www.test.com/test.html
Q: - Can we cache files which are viewed frequently?

Yes we can do it by using mod_file_cache module.CacheFile /www/htdocs/index.html
Q: - Can we have two apache servers having diff versions?
Yes, you can have two different apache servers on one server, but they can't listen to the same port at the same time.Normally apache listens to port 80 which is the default HTTP port. The second apache version should listen to another port with the Listen option in httpd.conf, for example to port 81.

For testing a new apache version before moving your sites from one version to another, this might be a good option.You just type www.example.com:81 in the browser window and you will be connected to the second apache instance.

How to Make Aliases Permanent


Each alias is written in this file exactly the same as it would be written on the command line using the alias command (see The alias Command for examples). Because this configuration file is read at login, any changes to it will not take effect until the user has logged in again or opened a new terminal window (i.e., an all-text window in a GUI).

.bashrc is a hidden file, that is, a file whose name begins with a period and thus is not normally visible in a GUI (graphical user interface). However, it is easy to locate and open from the command line.

Because .bashrc is a plain_text file, it can easily be edited using any text editor, such as vi or gedit. For example, assuming that the user is currently in its home directory, the following could be used to open .bashrc with vi:
vi .bashrc
Likewise, the following could be used to open the same file with gedit:
gedit .bashrc
The alias should be typed in below the line that says # User specific aliases and functions. The pound sign at the start of this line indicates that the line is a comment, i.e., documentation for the convenience of humans rather than something on which the system acts.

Aliases for the root user (i.e., administrative account) can be made permanent by entering them in the .bashrc file in the root user's home directory (which is /root), i.e., in/root/.bashrc. System-wide aliases can be put in the /etc/bashrc file. (Note that, at least on some systems, /etc/bashrc is not a hidden file.) The system needs to be restarted before system-wide aliases can take effect.

If the unalias command, which is used to remove or suppress aliases, is used on an alias which has been recorded in a .bashrc file, that alias is turned off for the duration of the current login session. However, the alias is not removed from the .bashrc file, and when the user logs in again, that alias is again in effect.

The alias Command & unalias command

_________________________________________________________________
The alias command can be useful if you want to create a 'shortcut' to a command.
The format is alias name='command'
> alias home='cd /home/dave/public_html'
This will create an alias called home which will put you in the /home/dave/public_html directory whenever you type home at the command prompt. You can alias any command you want, and include options for the command.
> alias list='ls -la'
This will create an alias called list, which will use the ls command to print a long-style listing of all files in the current directory (the -l gives a long-style list, and the -a shows all files - including hidden files).
(Find out more about the ls command)
To see a list of aliases set up on your linux box, just type alias at the prompt.
> alias
alias attrib='chmod'
alias chdir='cd'
alias copy='cp'
alias cp='cp -i'
alias d='dir'
alias del='rm'
alias deltree='rm -r'
alias dir='/bin/ls $LS_OPTIONS --format=vertical'
alias edit='pico'
alias ff='whereis'
alias ls='/bin/ls $LS_OPTIONS'
alias mem='top'
alias move='mv'
alias mv='mv -i'
alias pico='pico -w -z'
alias rm='rm -i'
alias search='grep'
alias v='vdir'
alias vdir='/bin/ls $LS_OPTIONS --format=long'
alias which='type -path'
alias wtf='watch -n 1 w -hs'
alias wth='ps -uxa | more'
>
You can see there are a few already set up on a default Redhat 9 installation.
To remove an alias, use the unalias command.


unalias command

The unalias command is used to remove an alias.
The format is unalias name
> unalias home
This will remove the alias called home.