• 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

service Command Examples in Linux

by admin

The service command is another way to control SysVinit services through SysVinit scripts. It supports the following subcommands.

Subcommand Used To
{service} status Print current state of service.
{service} start Activate service immediately.
{service} stop Deactivate service immediately.
{service} restart Restart service immediately.
{service} reload Re-read config files while service runs.

Syntax

The syntax of the service command is:

# service [options] [service] [subcommand]

service Command Examples

1. To status of a program:

# service vsftpd status 

2. To start a service:

# service vsftpd start 

3. To stop a service:

# service vsftpd stop 

4. To restart a service:

# service vsftpd restart 

5. To see the status fo all the programs:

# service --status-all 

6. To see the help:

# service -h
# service --help 

7. To see the version:

# service --version 

8. Do a full restart (runs script twice with start and stop):

# service service_name --full-restart

Filed Under: Linux

Some more articles you might also be interested in …

  1. a2dismod: command not found
  2. at Command Examples in Linux
  3. How to enable/disable SELinux Modes in RHEL/CentOS
  4. CentOS / RHEL 6,7 : How to recover an interrupted yum package installation
  5. chsh: command not found
  6. virt-install: Command Not Found
  7. ln: command not found
  8. qtchooser Command Examples in Linux
  9. mkinitcpio: command not found
  10. archlinux-java Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright