Basic administration commands

This document provides command line tools for basic administration.

This is by no means a full list of commands or switches.
Users requiring a list of switches or further explanation of command should consult the man pages.
There is a wealth of knowledge on how to use and what commands do can be obtained from www.google.com/linux or IBM Red Books.
Some commands will need to be performed by root. ( type su - which will give you root status )

Video tools


Configure mouse, soundcard, keyboard, X-windows, system services. setup (in X-terminal). Adjust the settings of the graphical display for all resolutions so as to eliminate black bands, shift the display right/left/up/down, etc. (First use the knobs on your monitor to fit your text mode correctly on the screen.) To make the changes permanent, display the frequencies on the screen and transfer them to the setup file /etc/X11/xorg.conf.

User Account Management

useradd [options] LOGINID

Create a new account (you must be root). (E.g., useradd jimmit) Don't forget to set up the password for the new user in the next step. The user home directory is /home/jimmit.


# useradd jimmit

(creates jimmit with defaults such as home under /home/jimmit, group jimmit,etc.)

[root@duvel ~]# useradd -G wheel -c "Smart Guy" -d /home/jimmit -s /bin/bash -u 999 jimmit

(creates user and also adds them to "wheel" group, assigns the name, sets up home, specifies a shell, and sets the unique ID to 9999)

(Before an account is active the password command must be used (i.e. passwd jimmit) )

userdel [options] LOGINID

userdel user_name Removes an account (you must be a root). The user's home directory and the undelivered mail must be dealt with separately (manually because you have to decide what to do with the files).


[root@duvel ~]# userdel -r -f jimmit

usermod [options] LOGINID

usermod allows admins to make changes to accounts such as changing the user's comments (their name) or the groups they belong in.

[root@duvel ~]# usermod -G wheel -c "ibm user" ibmuser

(user has been added to 'wheel' group)

User Account Password Management

Change the password on your current account. If you are root, you can change the password for any user using: passwd user_name

passwd LOGINID

  • Example:
    [root@wifitest ~]# passwd jimmit
    Changing password for user jimmit.
    You can now choose the new password.
    Enter new password: *******
    Re-type new password: *******
    passwd: all authentication tokens updated successfully.


to set the password expire to 90 days:

  • example:
    chage -M 90 jimmit
  • example (list attributes):
    $ chage -l itsupport
    Last password change : Jul 28, 2010
    Password expires : Oct 26, 2010
    Password inactive : never
    Account expires : never
    Minimum number of days between password change : 0
    Maximum number of days between password change : 90
    Number of days of warning before password expires : 7

File and Folder Permissions


(=change mode) Change the file access permission for the files you own (unless you are root in which case you can change any file). You can make a file accessible in three modes: read (r), write (w), execute to three classes of users: owner (u), members of the same group as the owner (g), others on the system (o). Check the current access permissions using: ls -l filename

-rw-r--r--  1 root root    24 Nov 10 18:26 jimmit

The first triplet shows the file permission for the owner of the file, the second for his/her group, the third for others. A "no" permission is shown as "-".

This shows owner having "read,write" Group with "read" Others With "read" permission.

Issue command :

[root@wifitest ~]# chmod 755 jimmit

Now if you issue ls -l filename :

[root@wifitest ~]# ls -l jimmit
-rwxr-xr-x 1 root root 24 Nov 10 18:26 jimmit

The return shows owner having "read,write & execute " Group with "read & execute " Others With "read & execute" permission.

There are other methods of changing permission's this is only one method

E.g., this command will add the permission to read the file "jimmit" to all (=user+group+others):

chmod a+r junk

This command will remove the permission to execute the file junk from others: chmod o-x junk

Therefore user should take some time to read up on the subject before using this command

chown new_ownername filename (changing ownership)

This will allow users to change ownership on folders and files.

  • Example:
    [root@wifitest ~]# ls -l jimmit
    -rwxr-xr-x 1 root root 24 Nov 10 18:26 jimmit
    [root@wifitest ~]# chown jimmit jimmit
    [root@wifitest ~]# ls -l jimmit
    -rwxr-xr-x 1 jimmit root 24 Nov 10 18:26 jimmit

You will see the owner has changed from root to jimmit

  • Example: re-assert rights for a user in their home
    chown -R jimmit:jimmit /home/jimmit

back to top

Switching Users with SU Command


(=substitute user id) Assume the superuser (=root) identity (you will be prompted for the password). Type "exit" to return you to your previous login. Don't habitually work on your machine as root. The root account is for administration and the su command is to ease your access to the administration account when you require it. You can also use "su" to assume any other user identity, e.g. su - jimmit will make me "jimmit" (password required unless I am a superuser).


su -
sudo su -
su jimmit -

Module Management Commands: lsmod,insmod,modprobe, etc.

Be careful when using "mod" commands as adding/removing modules can damage the system. You should take advice or have expert knowledge before attempting this.


List currently loaded kernel modules. A module is like a device driver--it provides operating system kernel support for a particular piece of hardware or feature.

modprobe -l |more

List all the modules available for your kernel. The available modules are determined by how your Linux kernel was compliled. Every possible module/feature can be compiled on linux as either "hard wired" (fast, non-removable), "module" (maybe slower, but loaded/removable on demand), or "no" (no support for this feature at all).


(as root) Insert modules into the kernel (a module is roughly an equivalent of a DOS device driver).

rmmod module_name

(as root, not essential). Remove the module module_name from the kernel.

Basic Disk Administration (fdisk command)

fdisk (as root) Linux hard drive partitioning utility (DOS has a utility with the same name).

  • Example:
    [root@wifitest ~]# fdisk -l

    Disk /dev/hda: 40.0 GB, 40007761920 bytes
    255 heads, 63 sectors/track, 4864 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hda1 * 1 4733 38017791 83 Linux
    /dev/hda2 4734 4864 1052257+ 82 Linux swap / Solaris

    This is a far more powerful command than the DOS equivalent refer to man page for full use.


'mount' will illustrate what is mounted on your system.

  • Example:
    [root@duvel ~]# mount
    /dev/hda1 on / type ext3 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
  • Other Examples:
    mount /dev/dvd /media/dvd    (mount a DVD)
    mount -a                     (mount everything in fstab)


Post a Comment