Skip to content

Instantly share code, notes, and snippets.

@siman
Last active January 27, 2020 11:29
Show Gist options
  • Save siman/cded540467023a352c7cba1aba5a0103 to your computer and use it in GitHub Desktop.
Save siman/cded540467023a352c7cba1aba5a0103 to your computer and use it in GitHub Desktop.
Useful Linux commands for server admins (Ubuntu)

Useful Linux Commands for Admins

Restart Subsocial docker container

docker container restart subsocial_node_alice_1

Process manager + shows CPU and RAM usage

htop

Disk usage - nice UI

ncdu

Calculate space of dirs and sort:

du -sh ./* | sort -h

Show process running on particular port:

fuser 80/tcp

Background process

After you execute a command (or shell script) in the background using &, if you logout from the session, the command will get killed. To avoid that, you should use nohup as shown below.

$ nohup ./my-shell-script.sh &

Firewall rules

ufw status

Allow HTTP connections (port 80)

ufw allow http

Read more here.

Get content of localhost:

curl -X GET http://127.0.0.1:3000

Show tree of current directory w/ node_modules folder:

$ tree -L 3 -I *_modules

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