Last active
March 27, 2019 10:37
-
-
Save gauravchl/d3dec32366bc9be0327ccc4c2f56f050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ufw status # list firwall status | |
ufw allow 81/tcp # open 81 port | |
ufw deny 81/tcp # deny 81 port | |
ufw delete allow 81/tcp # Delete 81 port rule | |
ufw delete deny 81/tcp # Delete 81 port rule | |
netstat -tulpn # list processes assigned to port | |
netstat -tnpa | grep 'ESTABLISHED.*sshd' # Active ssh sssions | |
watch -n 5 free -m # RAM used | |
ls -halt # list files with dates in human readable | |
ls -sh # lists files with size in human readable | |
gzip -k forever.log # compress file without deleting original | |
mongodump --out /data/db/backup # dump mongodb | |
tar -zcvf db-backup.tar.gz /data/db/backup # gzip backup | |
# Restore db | |
tar -xvzf db-backup.tar.gz | |
mongorestore --db newdbname backup/backupdbname | |
# drop existing db and than restore | |
mongorestore --drop --db workawesome dump2019/workawesome | |
# scp commands supports config file | |
scp waco:/root/db-backup-2019.tar.gz /Users/om/desktop | |
scp /Users/om/desktop/db-backup.tar.gz waco2019:/root/db-backup-2019.tar.gz | |
cron start # start cronjobs | |
crontab /resources/cronfile # Add conrfile to process, by default you can create file inside /etc/cron.d/ | |
npm get prefix // command to get global node instalation path | |
# Create symbolic links in osx, always provide absolute path | |
ln -s /Users/om/bash/some-script.sh /usr/local/bin/some-script | |
#start nginx | |
systemctl start nginx | |
nginx -s reload | |
nginx -s stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment