Skip to content

Instantly share code, notes, and snippets.

@Feniksovich
Last active May 30, 2023 11:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Feniksovich/6ee82d59c6af7a1d7a75cf719c202b62 to your computer and use it in GitHub Desktop.
Save Feniksovich/6ee82d59c6af7a1d7a75cf719c202b62 to your computer and use it in GitHub Desktop.
systemctl aliases
# Basic systemctl commands
alias ctlsp="systemctl stop"
alias ctlst="systemctl start"
alias ctlrt="systemctl restart"
alias ctls="systemctl status"
# Enable/Disable commands for units
alias ctle='systemctl enable'
alias ctld='systemctl disable'
# Start and then view status of service
ctlsts ()
{
systemctl start "$1"
systemctl status "$1"
}
# Restart and then view status of service
ctlrts ()
{
systemctl restart "$1"
systemctl status "$1"
}
# Masking Units to disabling them
alias ctlmask='systemctl mask'
alias ctlunmask='systemctl unmask'
# List failed units and reset systemd system status
alias ctlfailed='systemctl --failed --all'
alias ctlrf='systemctl reset-failed'
alias ctldrd="systemctl daemon-reload"
# Launch backup script with --manual argument
alias sqlbackup="sh /etc/mysql/sqlbackup.sh --manual"
# Lookup iptables chain
alias lookup="iptables --line-numbers -nvL"
# Parsing command
parse ()
{
source "$1"
}
# Archive without compressing
tarw ()
{
tar -cvf "$1.tar.gz" "$2"
}
# Archive with compressing (gzip)
targz ()
{
tar -zcvf "$1.tar.gz" "$2"
}
# Unarchive in folder with archive name
untar ()
{
tar -xvf "$1"
}
# Unarchive to specified path
untarto ()
{
tar -xvf "$1" -C "$2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment