10+ Commonly using OpenVZ commands and its usages

OpenVZ is a container based virtualization technique for Linux. OpenVZ creates multiple secure, isolated Linux containers (otherwise known as VEs or VPSs) on a single physical server. Each container performs and executes exactly like a stand-alone server; a container can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files. Here I am listing some useful OpenVz commands with example.

Let’s start, here CTID representing the ID of a container(VPS – Virtual Private Server).

1, Command to list the running VPSs in a node

# vzlist


# vzlist
       106        104 running   xx.xx.xx.xx  server1.test.com	
       107         46 running   xx.xx.xx.xx  server2.test.com	
       108         83 running   xx.xx.xx.xx  server3.test.com
       109         86 running   xx.xx.xx.xx  server4.test.com

2, Command to list running and stopped VPSs in an node
This command lists all the VPSs in a node.

# vzlist -a


# vzlist -a
        CTID      NPROC STATUS    IP_ADDR         HOSTNAME
       106        104 running   xx.xx.xx.xx  server1.test1.com	
       107         46 running   xx.xx.xx.xx  server2.test2.com	
       108         83 running   xx.xx.xx.xx  server3.test3.com
       109         86 running   xx.xx.xx.xx  server4.test4.com
       110          - stopped   xx.xx.xx.xx  server5.test5.com

3, To start a VPS

# vzctl start CTID


# vzctl start 110

4, To stop or shutdown a VPS

# vzctl stop CTID


# vzctl stop 110

5, To view the status of a VPS

# vzctl status CTID


# vzctl status 110
CTID 116 exist unmounted down

6, To enter a VPS

# vzctl enter CTID


# vzctl enter 106
entered into CT 106

7, Set hostname for a Server

# vzctl set CTID --hostname New_hostname --save

8, Add new IP to VPS

# vzctl set CTID --ipadd xx.xx.xx.xx --save

9, Delete IP from VPS

# vzctl set CTID --ipdel xx.xx.xx.xx --save

10, Reset root password of a VPS

# vzctl set CTID --userpasswd root:new_password --save

11, To add NameServer IPs to VPS

# vzctl set CTID --nameserver xx.xx.xx.xx --save

12, Delete a container

# vzctl destroy CTID

13, Suspending a container

# vzctl suspend CTID

That’s it. 🙂

Also read;

1, Top website/server uptime/downtime online monitoring tools
2, Introduction to CloudLinux and installation guide
3, Introduction to CageFS and PHP Selector and installation – CloudLinux

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

11 Responses

  1. arun c says:

    Very useful … Thanks for sharing the info .. (Y)

  2. Natesh says:

    very much use full to me thanks bro||||||||||||||||||||||||||||||||||||||||||||||||||||||

  3. Murat Tahtaci says:

    Thank you so much 🙂 So useful

  4. ruou bac ninh says:

    master centos 6, create vps Centos 7 error
    “[[email protected] ~]# /etc/init.d/network start
    Failed to get D-Bus connection: No such file or directory
    Starting network (via systemctl): Failed to get D-Bus connection: No such file or directory”
    Fix error

  5. Amit Sethi says:

    Thanks, to share the basics…useful to all

  6. Amit Sethi says:

    Keep sharing basic commands for other like redhat, centos, ubuntu, vm platforms etc software and OS…..also email me and share important commands and basics…..

Leave a Reply

Your email address will not be published. Required fields are marked *