# GNU/Linux, MacOS

- Page: https://shared.btbytes.com/p/nix
- Date: 2019-03-08

See also:

- [Unix Toolbox @ http://cb.vu](http://cb.vu/unixtoolbox.xhtml) -- "a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users."; [Bro pages](http://bropages.org/browse).
- [Introduction :: cli.fan — Improving your workflow since 2019](https://cli.fan/posts/introduction/)
    - [Inconsolation | Adventures with lightweight and minimalist software for Linux](https://inconsolation.wordpress.com/)
    - [Arabesque | Systems, Tools, and Terminal Science](https://sanctum.geek.nz/arabesque/)




Keep in mind to explore:

- [runit -  a Unix init scheme with service supervision](http://smarden.org/runit/); [HN](https://news.ycombinator.com/item?id=10059896; [Svsh](http://ido50.github.io/Svsh/) - a shell for runit.
- [runwhen -  a set of utilities for running commands at particular times](http://code.dogmap.org/runwhen/). [alternate for cron]
-  ^^ Both runit and runwhen are part of daemontools [slashpackage](http://cr.yp.to/slashpackage/list.html)


## Notes

- To convert the `.pub` file into `pem` format -- `ssh-keygen -f rsa.pub -e -m pem`
-   `pidof <appname>` returns the pid of the application. useful for  killing the app etc..
-   The sock file for mysql5 installed using macports lives at `/opt/local/var/run/mysql5/mysqld.sock` . You will need this when using thirdy party SQL clients such as [Seqel Pro](http://web.archive.org/web/20050122161514/http://sequelpro.com/)
-   Use `python_select` to select the default python that is used on your mac.
-   If a download is corrupted while installing from macports, try `sudo port clean --all <the offending package>`
-   Upgrade ports and all other software: `sudo port selfupdate` and `sudo port upgrade outdated`.
-   [X environment](http://web.archive.org/web/20060524114032/http://people.arsc.edu/~bahls/examples/macosx.php) tricks for Mac OS X.

## Pick up \*NIX skills


-   [Miguel Icaza's recommendations](http://tirania.org/blog/archive/2011/Sep-06.html). circa 2011. [HN](http://news.ycombinator.com/item?id=2967893)
-   [Bash/Shell productivity tips](http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/).

## Installing OpenJDK on Mac OSX


-   Download [Soylatte](http://web.archive.org/web/20071130081655/http://landonf.bikemonkey.org/static/soylatte/)
-   Unzip to \~
-   Edit `~/.bashrc` and add these lines:

    <pre syntax="bash">
     JAVA_HOME=~/java
     export JAVA_HOME
     export PATH=~/java/bin:$PATH
     </pre>

-   activate changes with `$source ~/.bashrc`

## Burning ISO images to CD/DVD from shell

DVD:

    $ growisofs -dvd-compat -Z /dev/hdc=dvd.iso

CD: Find out the cd recording device using `cdrecord -scanbus`

    $ $ cdrecord -scanbus
    scsibus2:
            2,0,0   200) 'HL-DT-ST' 'DVDRAM GH22NS50 ' 'TN01' Removable CD-ROM

Use `cdrecord` to burn.

    $ cdrecord -v -dao dev=2,0,0 speed=8 file.iso

don't want namservers handed out by local DHCP server?
------------------------------------------------------

Comment out `domain-name-servers,` in `/etc/dhcp/dhclient.conf`.

Tell apt to add new pgp key to its list
---------------------------------------

    $ curl -s http://someurl/key.pgp | sudo apt-key add -
    $ sudo apt-key list

Label Drives using e2label command
----------------------------------

    $ sudo e2label /dev/sdg1 emdebian

Compiling stuff in 32 bit mode on Mac OSX 10.6
----------------------------------------------

Add these flags to `./configure`.

    CFLAGS="-O -arch i386" CXXFLAGS="-O -arch i386" LDFLAGS="-arch i386"

Produce print ready copies of `man` docs
----------------------------------------

    $ man -t `man -w tmux` | ps2pdf - tmux.pdf

Change keyboard layout in the shell
-----------------------------------

    $ setxkbmap us

2014/11/25: swapped caps and left-ctrl. Put line below in `/etc/default/keyboard`

    XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"

and run `sudo dpkg-reconfigure keyboard-configuration` and confirm
changes to keep the changes you have made.

find memory usage by a process(?)
---------------------------------

    $ ps -Ao pid,rsz,args | grep <name>

[src](http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/)

Enabling anti-aliased fonts on Ubuntu
-------------------------------------

Edit `$IDEA/bin/idea.vmoptions` file and add these options:

    -Dswing.aatext=true
    -Dawt.useSystemAAFontSettings=lcd

The above options managed to get smooth font rendering on Ubuntu 12.10
using OpenJDK7.

### Resources

- [Setting up email server etc.,](http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:nectux)
- [Linux inside](https://0xax.gitbooks.io/linux-insides/content/index.html)
  a git book exploring how booting, initialization, interrupts, system
  calls, memory management etc., works.
- [How to make an operating system](http://web.archive.org/web/20141016010345/http://samypesse.gitbooks.io/how-to-create-an-operating-system/content/index.html)


## OpenBSD

- [Learn to tame openbsd quickly](http://www.openbsdjumpstart.org/#/)

## Minix

- [Lessons Learned from 30 Years of MINIX | March 2016 | Communications of the ACM](http://cacm.acm.org/magazines/2016/3/198874-lessons-learned-from-30-years-of-minix/fulltext) by Andrew S. Tanenbaum


## Debian

- [Apt transport for S3 - Lucidchart](https://www.lucidchart.com/techblog/2016/06/13/apt-transport-for-s3/)


## Measuring stuff

- [osquery](https://osquery.io/) -- allows you to easily ask questions about your Linux and OSX infrastructure. Whether your goal is intrusion detection, infrastructure reliability, or compliance.



## Running log of things

- [Nixers newsletter](https://newsletter.nixers.net/entries.php) -- weekly newsletter about *NIX things. This is a slow and steady way to read stuff :)
- [division by zero](http://2f30.org/links.html) links to *nix afficionados.
