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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

swapon and swapoff Command Examples in Linux

by admin

The swapon command is used to activate a swap partition in a specified device. The swapoff command is used to deactivate the swap space on a device.

Some of the frequently used swapon and swapoff command options are given in the following table.

Option Used To
swapon -e Skip non-existent devices.
swapon -a Activate all of swap space.
swapoff -a Deactivate all of swap space.

swapon Command Examples

1. Consult /etc/fstab for devices marked sw. Use those in place of the devices argument.

# swapon -a

2. Used with -a. Don’t complain about missing devices.

# swapon -ae

3. Print help message, then exit.

# swapon -h

4. Specify a priority for the swap area. Higher priority areas will be used up before lower priority areas are used.

# swapon -p 5 /var/tmp/swapfile

5. Print swap usage summaries, then exit.

# swapon -s
Filename				Type		Size	Used	Priority
/dev/dm-1               partition	268435452	0	-1
/swapfile               file	      102396	0	-2

6. Print version information, then exit.

# swapon -V

swapoff Command Examples

1. Consult /etc/fstab for devices marked sw. Use those in place of the device argument.

# swapoff -a

2. Print help message and then exit.

# swapoff -h

3. Display version number and then exit.

# swapoff -V

Filed Under: Linux

Some more articles you might also be interested in …

  1. smbpasswd Command Examples in Linux
  2. vgchange: command not found
  3. larasail Command Examples in Linux
  4. Xine Multimedia Software – Play audio and video files in Ubuntu Linux
  5. mkfs.exfat Command Examples in Linux
  6. renice: command not found
  7. filefrag Command Examples in Linux
  8. Error “530: permission denied” when user logs in to vsftpd server via ftp
  9. RPM : package installation Error : cpio: read failed
  10. sic: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright