Skip to content
Jasper Zanjani edited this page Aug 26, 2020 · 6 revisions
Tasks
Commands

Applications git imagemagick mongod GNOME gsettings gconf-editor KDE kquitapp krunner kstart SMB smbclient smbpasswd smbstatus

Hardware settings bluetoothctl [insmod][insmod] [lsmod][lsmod] lspci lsusb [modprobe][modprobe] [rmmod][rmmod]

[Printing] [CUPS][CUPS] cupsaccept cupsenable cupsdisable cupsreject lp cancel LPD lpc lpq lpr lprm

Init [Systemd][SystemD] hostnamectl [journalctl][journalctl] localectl systemctl systemd-delta [timedatectl][timedatectl] Sysvinit chkconfig init service telinit Upstart initctl

Mail biff makemap newaliases pine mail mailmerge mailq mailx msmtp newaliases postalias postqueue

SMTP servers exim postfix qmail sendmail

Kubernetes kubeadm kubectl

Linux distributions and desktop environments

Fully-featured desktop environments are distinct from window managers, which are more focused in scope

Alpine Linux

Security-oriented, lightweight Linux distribution used in containers and hardware.

Arch Linux

BSD

Berkeley Software Distribution (BSD) began in the 70s and was based on AT&T original code. First source distributions required user to purchase a source license from AT&T, since much of the BSD source was derivative of UNIX.

Berkeley finally released a "wholly-BSD" product as Network Release 1 in 1989, which satisfied vendor demand for the TCP/IP networking code for PC.

Work immediately began to reconstruct the remaining functionality of UNIX, which was completed in Network Release 2, released in 1991, which was based entirely on Berkeley code. Eventually this resulted in the 386BSD distribution, which then spawned five interrelated BSD distros: BSDI (now Wind River), NetBSD, FreeBSD, OpenBSD, and Darwin/Mac OS X

Unix System Laboratories (USL) sued BSDI after BSDI attempted to market its product as a real UNIX, and other BSD distributions were affected by disputed code. Ultimately 3 out of the 18,000 files that made up the Network Release 2 distribution were removed, which became known as 4.4BSD-lite, released in 1994. This legal dispute was partly to blame for Linux's rapid ascent in popularity.
Source: Article

Clear Linux

Rolling release distro from Intel with a custom package management system based on bundles, collections of packages that contain everything an application requires, including dependencies. Clear's update process also has the ability to do delta downloads, preserving bandwidth. It does not provide access with unusual licenses, like ZFS, Chrome, or FFmpeg. ^

Fedora

Fedora CoreOS

CoreOS is a Fedora edition built specifically for running containerized workloads securely and at scale. Because containers can be deployed across many nodes for redundancy, the system can be updated and rebooted automatically without affecting uptime. ^

CoreOS systems are meant to be immutable infrastructure, meaning they are only configured through the provisioning process and not modified in-place. All systems start with a generic OS image, but on first boot it uses a system called Ignition to read an Ignition config (which is converted from a Fedora CoreOS Config file) from the cloud or a remote URL, by which it provisions itself, creating disk partitions, file systems, users, etc.
CoreOS automatically installs upgrades automatically without user intervention, although they can be stopped if a problem is found.

Kali Linux

Windows Subsystem for Linux

Mac OS X

KDE

Appearance

  • Colors affects the appearance of text
  • Workspace Theme > Look and Feel allows selection of Look and Feel Themes that affect window appearance
  • Workspace Theme > Plasma theme appears to affect the appearance of widgets only

Comparison with other OSes

File dialogs have highly configurable views, with icon sizes scalable from 16 to 128 px and filenames available to the side or below the icon.

  • A view similar to the Icons view in Mac OS X or the List view in Windows can be reproduced by setting View to the icon size to the minimum 16px and placing the filename to the side (Icon Position > Next to file name)

Wallpapers

Wallpaper types "Haenau" and "Hunyango" are QML (Qt Modeling Language) animated wallpapers that were introduced in Plasma 5.1 (2014)

Widgets

"Plasmoids" are dragged and dropped onto the Desktop, where they function as buttons. A long click will allow them to be moved, rotated, or resized. Each plasmoid can be configured with a keyboard shortcut. They occupy all virtual desktops.

One plasmoid in particular is the "Grouping Plasmoid", which allows other plasmoids to be placed within it, where they occupy separate tabs.

Login manager

Workspace > Startup and Shutdown > Login Screen (SDDM)

  • The advanced tab allows you to select Mouse cursor theme and auto login of user and session type. These appear to affect specifically settings in /etc/sddm.conf (Session=gnome-xorg under [Autologin])

Default shortcuts are found in Workspace > Shortcuts > Global Shortcuts

  • "Run Command" refers to krunner, a single-line application launcher similar to the Run command on Windows.
  • Alt-t : open a terminal window

System logging

Traditionally, syslogd was the daemon in charge of this, but recently alternatives such as rsyslog and syslog-ng have emerged.

# Severity Description
0 Emergencies Most severe error conditions that render the system unusable
1 Alerts Conditions requiring immediate attention
2 Critical Condition that should be addressed to prevent an interruption of service
3 Error Error conditions that do not render the system unusable
4 Warning Specific operations failed to complete successfully
5 Notifications Non-error notifications that alert an administrator about state changes within a system
6 Informational Detailed dinformation about the normal operation of a system
7 Debugging Highly detailed information used for troubleshooting

Filesystems

Index node (inode) is a data structure that stores all the information about a file except its name and data Most modern Linux distributions use the ext4 filesystem, which descends from ext3 and ext2, and ultimately ext. Other filesystems in use include btrfs, xfs, and zfs Source: ref

ext

Extended File System was first implemented in 1992 by Remy Card to address limitations in the MINIX filesystem, which was used to develop the first Linux kernel. It could address up to 2GB of storage and handle 255-character filenames and had only one timestap per file.

ext2 was developed by Remy Card only a year after ext's release as a commercial-grade filesystem, influenced by BSD's Berkeley Fast File System. It was prone to corruption if the system crashed or lost power while data was being written and performance losses due to fragmentation. Nevertheless, it was quickly and widely adopted, and still used as a format for USB drives.

ext3 was adopted by mainline Linux in 2001 and uses journaling, whereby disk writes are stored as transactions in a special allocation, which allows a rebooted system to roll back incomplete transactions. 3 journaling modes: journal, ordered, and writeback

ext4 was added to mainline Linux in 2008, developed by Theodore Ts'o, and improves upon ext3 but is still reliant on old technology.

ZFS

  • true next-generation filesystem with a problematic license
  • ZFS on Linux (ZOL) is considered the ugly stepchild of the ZFS community despite the fact that the Linux implementation has the most features and the most community support
  • ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
    • ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
  • ZFS is too tightly bound to the operation of the kernel to operate in true userspace, and that is why each implementation is different for operating systems
  • LU: 284

B-Tree Filesystem "butter fs" was adopted by SUSE Enterprise Linux, but support was dropped by Red Hat in 2017.

Security

Library injections

Similar to DLL files on Windows systems, .so ("shared object") library files on Linux allow code to be shared by various processes. They are vulnerable to injection attacks. One file in particular, linux-vdso.so.1, finds and locates other shared libraries and is mapped by the kernel into the address space of every process. This library-loading mechanism can be exploited through the use of the environment variable LD_PRELOAD, which is considered the most convenient way to load a shared library in a process at startup. If defined, this variable is read by the system and the library is loaded immediately after linux-vdso.so.1 into every process that is run. ^

This attack can be detected using the osquery tool. This tool represents the system as a relational database which can then be queried, in particular against the process_envs table.

Linux commands

Applications

git imagemagick mongod GNOME gsettings gconf-editor KDE kquitapp krunner kstart SMB smbclient smbpasswd smbstatus

git

gsettings

imagemagick

identify mogrify

imagemagick identify
Option Effect
-format {string} display formatted image characteristics; {string} is formatted string using %[key] escape sequences
%w current width in pixels
%h current height in pixels
imagemagick mogrify
Option Effect
-write $FILENAME save to filename
-resize $Xx$Y resize image to $X pixels by $Y pixels
-crop $SIZE$OFFSET
-gravity $TYPE set current gravity suggestion for various other options
possible values NorthWest, North, NorthEast, West, Center, East, SouthWest, South, or SouthEast

Argument patterns --- | --- {geometry} | {size}{offset} {size} | {scale}% height and weight are both scaled by a specified percentage
{width}x{height} maximum values of height and width
{width}x{height}^ minimum values of height and width
{offset} | also affected by -gravity setting
+0+0 top-left corner gravity |

Resize images

magick mogrify -resize 1920x1200 -write mars-bg.jpg pia22511.jpg
magick identify -format "%w x %h" pia22511.jpg

Save the output of a command as an image (convert is from the ImageMagick software suite) ref

cmd | convert label:@- image.png

View image metadata (identify is from the ImageMagick software suite) ostechnix.com

identify image.png # => dimensions, color depth, color profile
identify -verbose image.png

krunner

Single-line application launcher similar to the Run command on Windows.

kquitapp

Allows you to quit a dbus enabled application. Two options:

Specify service to be stopped

kquitapp --service

Specify path to dbus interface

kquitapp --path

kstart

Restarting KDE Plasma 4 ref

killall plasma-desktop
kstart plasma-desktop

Restarting KDE Plasma 5 ref

killall plasmashell
kstart plasmashell
kquitapp5 plasmashell
kstart plasmashell

lowriter

lowriter is a command-line utility installed with LibreOffice Writer. vitux.com

Convert a single file to PDF

lowriter --convert-to pdf filename.doc

Convert a batch of files using globbing

lowriter --convert-to pdf *.docx

mongod

Run MongoDB service in the background on port 80

mongod --dbpath $HOME/db --port 80 --fork --logpath /var/tmp/mongodb

Networking

[https://gist.github.com/zentralwerkstatt/9e6c83e757cdfe430d6710585b2275c7]: https://gist.github.com/zentralwerkstatt/9e6c83e757cdfe430d6710585b2275c7 "GitHub Gist - SSH into Linux Subsystem for Windows"] [Cannon]: https://github.com/jasper-zanjani/notes/master/sources/clkf.md "Cannon, Jason. Command Line Kung Fu."

Package managers

Process control

Remote administration

[curl][curl] [ftp][ftp] [rsync][rsync] [ssh][ssh] [ssh-add][ssh-add] [ssh-agent][ssh-agent] [ssh-keygen][ssh-keygen] [ssh-keyscan][ssh-keyscan] [stty][stty] [telnet][telnet] [vncpasswd][vncpasswd] [vncviewer][vncviewer] [sshfs][sshfs]

curl

#       d   f   h         m   o   q   s   u v   x    
      C               K L M   O       S T U V        
connect-timeout create-dirs disable-epsv ftp-pasv limit-rate max-filesize url

Clone this wiki locally