diff --git a/make/Makefile b/examples/make/Makefile similarity index 100% rename from make/Makefile rename to examples/make/Makefile diff --git a/make/sources.mk b/examples/make/sources.mk similarity index 100% rename from make/sources.mk rename to examples/make/sources.mk diff --git a/linux/terminal.md b/linux.md similarity index 64% rename from linux/terminal.md rename to linux.md index 3fbbccd..530e7b3 100644 --- a/linux/terminal.md +++ b/linux.md @@ -1,3 +1,100 @@ +# Linux + +This document collects knowledge, tips and tricks on all things Linux, that don't get their own document. + + +- [Linux](#linux) + - [Setup and Configuration](#setup-and-configuration) + - [Locales and Keyboard Layouts](#locales-and-keyboard-layouts) + - [configure layout 'US intl. with deadkeys'](#configure-layout-us-intl-with-deadkeys) + - [Linux commands](#linux-commands) + - [combine commands with *xargs*](#combine-commands-with-xargs) + - [pipe output into clipboard](#pipe-output-into-clipboard) + - [permissions](#permissions) + - [octal permissions](#octal-permissions) + - [Terminal](#terminal) + - [ANSI escape sequences](#ansi-escape-sequences) + - [Text Style](#text-style) + - [Color codes](#color-codes) + - [8-16 Colors](#8-16-colors) + - [256 Colors](#256-colors) + - [RGB Colors](#rgb-colors) + + + +## Setup and Configuration + + +### Locales and Keyboard Layouts + +Use `localectl` to display and configure locales and keyboard layout: + +```sh +# show current locales +localectl status +``` + + +#### configure layout 'US intl. with deadkeys' + +To configure `US intl. with deadkeys`, set the following values: +```sh + X11 Layout: us + X11 Model: default +X11 Variant: intl +``` + + +## Linux commands + +- [Linux commands](#linux-commands) + - [combine commands with *xargs*](#combine-commands-with-xargs) + + +### combine commands with *xargs* + +Some commands (e.g. `chmod`) can't handle input via pipe and require the input as arguments. +`xargs` takes the standard input as list of arguments seperated by spaces or newlines and executes the given command with the input parsed to a list of arguments. + +Usage: +```bash +find . -type f | xargs chmod 644 +``` + + +### pipe output into clipboard + +> requires `xclip` + +One can save command output to the clipboard by piping it to `xclip`: + +```sh +# usage +command | xclip -selection clipboard + +# working example with 'echo' +echo "hello world" | xclip -selection clipboard +``` + +> NOTE: the argument `-selection clipboard` is required + + +## permissions + +Linux permissions are ordered as follows: +- owner +- group +- others + + +### octal permissions + +In octal representation the actions (read, write, execute) have the values: +- read = 4 +- write = 2 +- execute = 1 + + ## Terminal - [ANSI escape sequences](#ansi-escape-sequences) @@ -5,14 +102,17 @@ ### ANSI escape sequences -Ansi escape sequences are used to format output in a terminal. They **are prefixed with an escape character**, which can be written in a few ways: +Ansi escape sequences are used to format output in a terminal. +They **are prefixed with an escape character**, which can be written in a few ways: - Ctrl-Key `^[` - Octal `\033` (\0 for octal) - Hexadecimal `\x1B` (\\x for hexadecimal) - Unicode `\u001b` -The sequences is started with a `[` followed by the command and arguments. Arguments are separated with `;`. **Sequences are terminated with `m`.** +The sequences is started with a `[` followed by the command and arguments. +Arguments are separated with `;`. +**Sequences are terminated with `m`.** ``` bash # Example: @@ -20,6 +120,8 @@ The sequences is started with a `[` followed by the command and arguments. Argum ``` For the following tables we define `ESC = \x1B` + + #### Text Style | ESC Code Sequence | Reset Sequence | Description | @@ -37,11 +139,14 @@ For the following tables we define `ESC = \x1B` > **Note:** Some terminals may not support some of the graphic mode sequences listed above. -> **Note:** Both dim and bold modes are reset with the `ESC[22m` sequence. The `ESC[21m` sequence is a non-specified sequence for double underline mode and only works in some terminals and is reset with `ESC[24m`. +> **Note:** Both dim and bold modes are reset with the `ESC[22m` sequence. +> The `ESC[21m` sequence is a non-specified sequence for double underline mode and only works in some terminals and is reset with `ESC[24m`. + #### Color codes -Most terminals support 8 and 16 colors, as well as 256 (8-bit) colors. These colors are set by the user, but have commonly defined meanings. +Most terminals support 8 and 16 colors, as well as 256 (8-bit) colors. +These colors are set by the user, but have commonly defined meanings. ##### 8-16 Colors @@ -61,7 +166,8 @@ Most terminals support 8 and 16 colors, as well as 256 (8-bit) colors. These col > **Note:** the _Reset_ color is the reset code that resets _all_ colors and text effects, Use _Default_ color to reset colors only. -Most terminals, apart from the basic set of 8 colors, also support the "bright" or "bold" colors. These have their own set of codes, mirroring the normal colors, but with an additional `;1` in their codes: +Most terminals, apart from the basic set of 8 colors, also support the "bright" or "bold" colors. +These have their own set of codes, mirroring the normal colors, but with an additional `;1` in their codes: ```sh # Set style to bold, red foreground. @@ -83,6 +189,7 @@ Terminals that support the [aixterm specification](https://sites.ualberta.ca/dep | Bright Cyan | `96` | `106` | | Bright White | `97` | `107` | + ##### 256 Colors The following escape codes tells the terminal to use the given color ID: @@ -97,17 +204,14 @@ Where `{ID}` should be replaced with the color index from 0 to 255 of the follow ![256 Color table](https://user-images.githubusercontent.com/995050/47952855-ecb12480-df75-11e8-89d4-ac26c50e80b9.png) The table starts with the original 16 colors (0-15). - The proceeding 216 colors (16-231) or formed by a 3bpc RGB value offset by 16, packed into a single value. - The final 24 colors (232-255) are grayscale starting from a shade slighly lighter than black, ranging up to shade slightly darker than white. - Some emulators interpret these steps as linear increments (`256 / 24`) on all three channels, although some emulators may explicitly define these values. + ##### RGB Colors More modern terminals supports [Truecolor](https://en.wikipedia.org/wiki/Color_depth#True_color_.2824-bit.29) (24-bit RGB), which allows you to set foreground and background colors using RGB. - These escape sequences are usually not well documented. | ESC Code Sequence | Description | @@ -115,5 +219,6 @@ These escape sequences are usually not well documented. | `ESC[38;2;{r};{g};{b}m` | Set foreground color as RGB. | | `ESC[48;2;{r};{g};{b}m` | Set background color as RGB. | -> Note that `38` and `48` corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. Where as `;2` and `;5` sets the color format. +> Note that `38` and `48` corresponds to the 16 color sequence and is interpreted by the terminal to set the foreground and background color respectively. +> Where as `;2` and `;5` sets the color format. diff --git a/linux.txt b/linux.txt deleted file mode 100644 index 8f62054..0000000 --- a/linux.txt +++ /dev/null @@ -1,5 +0,0 @@ -./linux/linux.md -./linux/setup.md -./linux/commands.md -./linux/permissions.md -./linux/terminal.md diff --git a/linux/commands.md b/linux/commands.md deleted file mode 100644 index 8235d92..0000000 --- a/linux/commands.md +++ /dev/null @@ -1,29 +0,0 @@ -## Linux commands - -- [Linux commands](#linux-commands) - - [combine commands with *xargs*](#combine-commands-with-xargs) - -### combine commands with *xargs* - -Some commands (e.g. `chmod`) can't handle input via pipe and require the input as arguments. `xargs` takes the standard input as list of arguments seperated by spaces or newlines and executes the given command with the input parsed to a list of arguments. - -Usage: -```bash -find . -type f | xargs chmod 644 -``` - -### pipe output into clipboard - -> requires `xclip` - -One can save command output to the clipboard by piping it to `xclip`: - -```sh -# usage -command | xclip -selection clipboard - -# working example with 'echo' -echo "hello world" | xclip -selection clipboard -``` - -> NOTE: the argument `-selection clipboard` is required diff --git a/linux/linux.md b/linux/linux.md deleted file mode 100644 index e581118..0000000 --- a/linux/linux.md +++ /dev/null @@ -1,9 +0,0 @@ -# Linux - -This document collects knowledge, tips and tricks on all things Linux, that don't get their own document. - -- [Setup and Configuration](linux/setup.md) -- [Linux commands](linux/commands.md) -- [Permissions](linux/permissions.md) -- [Terminal](linux/terminal.md) - diff --git a/linux/permissions.md b/linux/permissions.md deleted file mode 100644 index 986e77c..0000000 --- a/linux/permissions.md +++ /dev/null @@ -1,14 +0,0 @@ -## permissions - -Linux permissions are ordered as follows: -- owner -- group -- others - -### octal permissions - -In octal representation the actions (read, write, execute) have the values: -- read = 4 -- write = 2 -- execute = 1 - diff --git a/linux/setup.md b/linux/setup.md deleted file mode 100644 index 5badcf5..0000000 --- a/linux/setup.md +++ /dev/null @@ -1,21 +0,0 @@ -## Setup and Configuration - - -### Locales and Keyboard Layouts - -Use `localectl` to display and configure locales and keyboard layout: - -```sh -# show current locales -localectl status -``` - - -#### configure layout 'US intl. with deadkeys' - -To configure `US intl. with deadkeys`, set the following values: -```sh - X11 Layout: us - X11 Model: default -X11 Variant: intl -``` diff --git a/make/make.md b/make.md similarity index 100% rename from make/make.md rename to make.md diff --git a/make.txt b/make.txt deleted file mode 100644 index 87422fc..0000000 --- a/make.txt +++ /dev/null @@ -1 +0,0 @@ -./make/make.md