• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Kill VNC Window Sessions in Linux

by admin

VNC (Virtual Network Computer) is a low-bandwidth cross-platform display system. VNC is a system for controlling a computer remotely and sharing desktops over a network using a graphical interface. Access to a remote desktop requires a VNC server installed on the remote system, a VNC viewer on the system from which access is being established and, optionally, a secure SSH connection.

Sometimes you may have to kill a particular VNC session from a Linux box. This post outlines the steps to kill a VNC session from the command line using the vncserver command.

1. Stop entire VNC service:

[root@server ~]# service vncserver stop

2. Kill individual VNC Sessions. To stop individual VNC session, you need to first login as the user account that associated with the VNC session. For example if you assigned VNC session 1 (:1) for the user “nix”, login as “nix” and run the below command

[nix@server ~]# vncserver -kill :1

3. To start VNC session again:

[nix@server ~]# vncserver :1

4. Command to Start new VNC Session:

[nix@server ~]# vncserver :2

5. Find Running VNC server sessions (login as associated user first):

[nix@server ~]# vncserver -list
Note: Also open firewall to allow all incoming connections (new sessions) to VNC Server.

Killing All VNC sessions

You can also use the following command to kill all currently running VNC server sessions:

$ vncserver -kill :*
Killing Xtigervnc process ID 1607... success!
Killing Xtigervnc process ID 5287... success!

Summary

You start the VNC server on your remote Linux database server by running vncserver and a port number. Like the other Linux daemons–such as httpd, which usually listens on port number 80, and sshd, which usually listens on 22–the VNC server listens on port number 5901 by default. If you include a port number when running vncserver, the actual port number is plus 5900. For example, if you run vncserver :9, then the VNC server listens on port number 5909.

To manually stop the VNC server on your Linux database server, run the Linux command vncserver -kill, and provide the same port number you used when starting the VNC server. For example:

# /usr/bin/vncserver -kill :9
Killing Xvnc process ID 13836

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to configure interface in “Promiscuous Mode” in CentOS/RHEL
  2. How To Use distro-sync Option With dnf To Upgrade OS (CentOS/RHEL 8)
  3. CentOS / RHEL 7 : How to create custom script to run automatically during boot
  4. Command ‘df -i’ Shows ‘Inode=0’ on BTRFS File System
  5. Understanding /etc/xinetd.d directory under Linux
  6. xeyes: command not found
  7. How to Enable IPv6 in CentOS/RHEL 8
  8. 5 Useful Command Examples to Monitor User Activity under Linux
  9. free Command Examples in Linux
  10. chcon command examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright