Show Menu

Linux and Containers Cheat Sheet by

linux

Containers

lxc-ls
List all containers
lxc-attach -n <na­me>
Enter the named container
lxc-start
Start and attach
lxc-start -d
Start in background
lxc-clone <so­urc­e> <ta­rge­t>
Clone container
lxc-de­stroy
Remove container & contents
lxc-ne­tstat
Run netstat for a container
lxc-ps
List processes
# Note: all commands take -n as parameter to specify the container

Systemctl

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
 

Elastic

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­ing.al­loc­ati­on.n­od­e_c­onc­urr­ent­_re­cov­eri­es" : 6 } }';echo
 

Postgres

sudo -u postgres psql postgres
Run postgres as postgres user
\l
List Databases
\du
List roles
\c <da­tab­asename
Connect to database name
\dt
List tables in current database
\dt ..
List tables globally
\dn
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

Download the Linux and Containers Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/iain-alexander_linux-and-containers.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

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