Linux Cheat Sheet

dnf:

  • Update existing packages: dnf update

yum:

  • Update our packages:   yum -y update
  • Install a package (mongo): yum -y install mongodb-org mongodb-org-server
  • Add a repository:
    • vim /etc/yum.repos.d/mongodb.repo
      [mongodb]
      name=MongoDB Repository
      baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
      gpgcheck=0
      enabled=1

References:  How to Install MongoDB on Fedora 21

Mounting a partition:

  • List of mounted filesystems:
  • Definitive list:   /proc/mounts
  • Mounted filesystems: /etc/mtab
    (also used to configure mounting at boot time)
  • Disk space usage: df -H
  • Mount a file system:
    mkdir /media/newhd
    mount /dev/sdb1 /media/newhd
  • Unmount a file system
    umount /media/newhd
    umount /dev/sdb1

File Operations

  • Bulk file copy, using rsync.  rsync provides check points, restarts, and is faster and more reliable than the recursive cp command.
    • v: increase verbosity
    • a: apply archive settings to mirror the source files exactly, including symbolic links and permissions
    • P: presrve permissions
      rsync -avP src/ dst/

Memory

  • Check the sizes of memory for physical and swap space.
    free
  • Check the configuration of swap space:
    cat /proc/swaps
  • Visual Viewer of Memory Usage
    gnome-system-monitor

     

System Stuff:

  • Current kernel version: uname -r