Skip to content

Instantly share code, notes, and snippets.

@tennisonchan
Created March 29, 2020 23:03
Show Gist options
  • Save tennisonchan/55fc5dfd705ec2f0e82d08834cab6de1 to your computer and use it in GitHub Desktop.
Save tennisonchan/55fc5dfd705ec2f0e82d08834cab6de1 to your computer and use it in GitHub Desktop.
#bin/bash
# show an interactive process viewer for Unix
htop
# to allocate 1G file space to /swapfile
sudo fallocate -l 1G /swapfile
# write input from /dev/zero to /swapfile for block size of 1024
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
# set access permission of /swapfiel
sudo chmod 600 /swapfile
# setting up swapspace
sudo mkswap /swapfile
# turn on the /swapfile
sudo swapon /swapfile
# add the following line in /etc/fstab
# /swapfile swap swap defaults 0 0
sudo vim /etc/fstab
# mount the space
sudo mount -a
# check the swap
htop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment