Show Menu

Linux and Containers Cheat Sheet by


List all containers
lxc-attach -n <na­me>
Enter the named container
Start and attach
lxc-start -d
Start in background - no login
lxc-clone <so­urc­e> <ta­rge­t>
Clone container
Remove container & contents
Run netstat for a container
List processes
Stop Container
lxc-freeze - freeze all the contai­ner's processes
# Note: all commands take -n as parameter to specify the container


systemctl start
Start a service
systemctl stop
Stop a service
systemctl reload
Reload config­uration for running service
systemctl restart
Restart service
systemctl reload­-or­-re­start
Reload or Restart
systemctl status
Get service status
systemctl enable
Enables a service
systemctl disable
Disables a service
systemctl is-active
Check if service is active
systemctl is-enabled
Check is enabled at boot
systemctl takes the service name as an arguement


curl -XPOST 'local­hos­t:9­200­/_f­lus­h/s­ynced' 1 curl -XPOST 'local­hos­t:9­200­/_f­lus­h/s­ynced'
curl -XPOST 'http:­//l­oca­lho­st:­920­0/_­cac­he/­clear'
curl -XPUT localh­ost­:92­00/­_cl­ust­er/­set­tings -d '{ "­tra­nsi­ent­" :{ "­clu­ste­r.r­out­­loc­ati­on.n­od­e_c­onc­urr­ent­_re­cov­eri­es" : 6 } }';echo


sudo -u postgres psql postgres
Run postgres as postgres user
List Databases
List roles
\c <da­tab­asename
Connect to database name
List tables in current database
\dt ..
List tables globally
List schemas
\d <ta­ble­nam­e>
List columns of table

Host Commands

init 6
Gracefully reboot
shutdown -r now "­rea­son­"
Gracefully reboot & log
iostat <re­fresh interv­al>
Disk utiliz­ation
ss -l
Currently listening sockets
sar 1 <in­ter­val>
Cpu stats
sar -b <in­ter­val> <re­pea­t>
/O stats every x seconds x times

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          mod_rewrite Cheat Sheet
          Vim NERDTree Cheat Sheet