Skip to content

Instantly share code, notes, and snippets.

@ryansutc
Last active August 25, 2019 02:38
Show Gist options
  • Save ryansutc/bc62bed712058a5b43988b58fb3f43bd to your computer and use it in GitHub Desktop.
Save ryansutc/bc62bed712058a5b43988b58fb3f43bd to your computer and use it in GitHub Desktop.
Unix Shell Commands Quick Reference

Quick Guide to Common Commands for Digital Ocean Ubuntu Management

SSH Connections and File Transfer:

(requires PuTTy on Windows)

pscp -i [your ppk key exported from Putty] [path/to/local/file] [user@ipaddress:/path/to/server/file]

upload files to server via ssh in terminal

sudo dos2unix [yourfile]

converts your file to unix return characters. Common pain point when transferring files from Windows w/o proper text editor configs.

Linux Server Management:

Supervisor:

sudo supervisorctl [reread|update|status]

configure supervisor server

cat /var/log/supervisor/supervisord.log

read supervisor logs

truncate -s 0 /var/log/supervisor/supervisord.log

clear supervisor logs

NGinx:

sudo systemctl [start|stop|restart] nginx

start/stop/restart nginx

sudo systemctl status nginx

get status of nginx

cat /home/boards/logs/nginx-error.log

read error logs

cat /home/boards/logs/nginx-access.log

read access logs

Gunicorn:

cat /home/boards/logs/gunicorn_boards.log

Other Misc Linux Stuff:

netstat -a -p --unix 

get list of open sockets on machine

find -iname "filename"

find a file in directory (not case sensitive)

useradd [username]
userdel [username]
passwd [username]

create a new user w. password

Readings:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment