zsh: add swapfile creation and deletion functions
This commit is contained in:
parent
cf7a24ab92
commit
c260d0999c
1 changed files with 17 additions and 0 deletions
17
.zshrc
17
.zshrc
|
@ -119,6 +119,9 @@
|
|||
dc='docker-compose' \
|
||||
occ='docker exec -it -u www-data nextcloud php occ' \
|
||||
|
||||
# file copying with a progress bar
|
||||
alias cpv="rsync -ah --info=progress2"
|
||||
|
||||
# lists all open ports, along with some other info
|
||||
alias ls-ports='netstat -tulpn'
|
||||
|
||||
|
@ -375,6 +378,20 @@
|
|||
echo $(($*))
|
||||
}
|
||||
|
||||
# Makes a swapfile at /swapfile of a given size (ex: mkswp 4G)
|
||||
mkswp() {
|
||||
sudo fallocate -l "$1" /swapfile &&
|
||||
sudo chmod 600 /swapfile
|
||||
sudo mkswap /swapfile &&
|
||||
sudo swapon /swapfile
|
||||
}
|
||||
|
||||
# Deletes the swapfile created by mkswp()
|
||||
rmswp() {
|
||||
sudo swapoff -v /swapfile &&
|
||||
sudo rm /swapfile
|
||||
}
|
||||
|
||||
# optionally source an external function file
|
||||
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/fnrc"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue