Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 








Linux Administrator Commands

Linux Tips by Burleson Consulting

Even if you are not the system administrator for the Linux box you use it will often be necessary to perform some basic administrative commands throughout the workday. Some of the commands require being logged into the system as the root user.

In Linux, the root user is the administrator user with complete authority on that system.  The root user is created when the operating system is installed and is the most powerful user on any Linux system; thus, the root user has the authority to do whatever, whenever.

Because of its power most administrators will not hand out the root user on a production machine and rightly so!  If you are given the root password, be very careful.  You could easily delete other user's files, kill their running programs or completely destroy the entire server.

Since the root user has so much power many administrators give limited administrative privileges to users using a command called sudo (typically pronounced like "pseudo".)  Through the use of sudo the administrator can allow you to run only certain commands as root and can track what you have executed.

If you have been given sudo access to run a command as root all you have to do is prepend the command you want to run with sudo like this:

$ sudo shutdown ?r +3

Shutting Down and Changing Runlevels

On occasion, it may be necessary to shut down the Linux server or reboot it after a configuration change. The execution of the shutdown command requires root privileges. After all, it would not be good to have just anyone shutting down a server, particularly a production server running critical business applications.

When the shutdown command is issued, all users that are directly logged in are notified that the system is going down and further logins are disabled.  The administrator has the option of shutting down the system immediately or after a delayed warning period. If there are other users on the system, the courteous thing to do would be to warn them that the system is being shut down so that they can save their work and log off the system gracefully.

Always keep in mind that people may be using a system through a web page or other indirect means.  These people will not receive any warning when the system is shut down.

To shutdown a server immediately we specify now as the time.  The ?h option causes the system to be halted after the shutdown.

$ shutdown ?h now

The ?r option here is used to cause the system to reboot after it has shutdown.  As mentioned above, if other users are currently on the system it would be nice to give them a little warning so here we have specified +3 to cause the system to warn users and wait three minutes before restarting.

$ shutdown ?r +3

Yet another form of the shutdown command will allow you to specify the time which you want the command to happen.

$ shutdown ?r 17:00

The command above will cause the system to reboot at 5:00 p.m.

The state or mode of a Linux system is described as a runlevel.  The shutdown command is one way to control what runlevel a Linux system is running in.  For instance, shutdown ?h now seen above will change the runlevel to 0 and shutdown ?r +3 will change the runlevel to 6.  The runlevels control what can be run on a system and who can log into it.

If the system is running and you would like to change the runlevel, for instance if you need to do some maintenance in single user mode, you can use the telinit command to change the current runlevel.

# telinit 1

While you can use telinit to switch to a higher or lower runlevel changing to a lower runlevel may sometimes have unexpected results and will definitely kick others off the system.  Use it with care.

When the system boots it will come up to the specified runlevel (runlevel 5 by default.)  Certain things are enabled at each runlevel and specific scripts will be run as the system enters a runlevel.  Typically a running Linux system will be in runlevel 5.

Let's take a quick look at each of the runlevels.

* 0: Used to halt the system

* 1: Single-user mode for performing administrative tasks

* 2: Multi-user mode, without networking

* 3: Multi-user mode, with networking

* 4: Currently unused

* 5: Multi-user mode with graphical user interface (GUI), usually the default runlevel

* 6: Used to reboot the system

To find out what runlevel you are currently running in you can use the ?r option of the who command.

$ who ?r

         run-level 5  Oct  4 20:08                   last=S

Later on we'll use the who command to look at who is on the system.

While it is possible in some versions of Linux to go from a higher to a lower runlevel without rebooting it can occasionally cause problems.  Often it is easier to get to a lower runlevel via restart.

Adding and Removing Users

While some Linux systems only have a couple active users others can have dozens or even hundreds.  Most Linux systems offer a graphical interface for managing users but you should also know how to add and remove users from the command line.  You will need root privileges to add users.

A user can be added to Linux with the useradd command.  This will create an entry for the user in the /etc/passwd and /etc/shadow files and create that users home directory in the default home location.

# useradd chuck

Now that the user has been created we should assign a password to them so they can log in.  The passwd command can be used to change a user's password.  If you're logged in as root you can call the passwd command with a user's name as an argument to change the password of another user.

# passwd chuck

Changing password for user chuck.
New UNIX password: pencil1983
Retype new UNIX password: pencil1983
passwd: all authentication tokens updated successfully.

Now we can let this user know that his account is ready and give him his password.  There are several other options for the useradd command which we have not covered here, but this is enough to add a basic user.

Of course on the other end of things you will occasionally need to remove a user from the system.  We can do that with the userdel command.  The userdel command can be used with the ?r option to automatically delete the user's home directory.  Just make sure if you are using the ?r option that there is nothing in the user's home directory that you need!

# ls ~chuck
# userdel -r chuck

Here we have listed the user's home directory and it is empty.  Actually there are some hidden files which were created with the home directory but we are not concerned about them.  Next we use the userdel ?r command to remove the user and their home directory.

This is an excerpt from "Easy Linux Commands" by Linux guru Jon Emmons.  You can purchase it for only $19.95 (30%-off) at this link.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational