Ubuntu Cheat Sheet

General

  • system and kernel info:  uname -a
  • ubuntu version info:  lsb_release -a
  • ubuntu version info:  head -n1 /etc/issue

ubu14.04 services

ubu16.04 services

  • list all services:  systemctl list-units --type service --all
  • enable/disable service: sudo systemctl [enable/disable] nameofservice.service
  • show service status:  systemctl status foo.service
  • Check whether a service is enabled or not:  systemctl is-enabled foo.service; echo $?

Networking

  • sudo iwlist wlan0 s
  • sudo ifdown -a
  • sudo ifup -a
  • ifconfig
  • sudo lshw -C network
  • netstat -i
  • ip link show
  • lsusb

Files

  • deleting all zero length files in dir: find . -type f -empty -delete

apt

bash

  • do action on result of grep
    ls | grep pattern |while read -r line ; do echo “$line”; done
  • recursive grep lists only filenames and searches resulting files for Get command even if they’re binary
  • grep -lra X-Geo_contents|while read -r line ; do grep -a GET $line; done