Linux

Memory location of environment variable (Linux)

Check that each envirnment variables are assigned to processes you can see /pro/{{ process_id }}/environ holds all environment variable which is used for the process. https://man7.org/linux/man-pages/man5/proc.5.html /proc/[pid]/environ This file contains the initial environment that was set when the currently executing program was started via execve(2). The entries are separated by null bytes ('\0'), and there may be a null byte at the end. Thus, to print out the environment of process 1, you would do: $ cat /proc/1/environ | tr '\000' '\n' If, after an execve(2), the process modifies its environment (e.

ELF - My note for quick review

101 TL;DR 101 in a single image from Wikipedia: ELF file layout from Wikipedia ELF Executable and Linkable Fotmat. Major usage (in file header, offset 0x10) Executable Shared library Core file (core dump) The word segments is used at runtime (text segment, data segment, stack, heap). Sections means the functions in elf file. link time. Header info The ELF file header consists of two header, ELF header and program header table.

Trusted Certificates List - ca-certificate

I always googled the exact way to install certificates on Ubuntu local machine, so I left a note for my reference. Ubuntu cert store http://manpages.ubuntu.com/manpages/jammy/man8/update-ca-certificates.8.html Add the self-sign certificate to the trusted CA list under /usr/share/ca-certificates. The extension should be .crt. Add a line about the certificate in the configuration file /etc/ca-certificates.conf. Run sudo update-ca-certificates.

LVM and File System

How to think Linux volume system Here is the coprehensive image from Wikipedia. From Wikipedia There are several physical volumes (PVs) in a server. Linux group the physical volumes in a volume group (a VG). Each of PVs contains physical partitions (PPs). We can aggregate the PVs in a logical volume (a LV). On a LV, we can decide a file system (FS). From Linux side, we can mount a Linux directory to the FS.

System Call

I wathed the following videos. Unix system calls (1/2) - Brian Will Unix system calls (2/2) - Brian Will Here is my note about system call. POSIX From Wikipedia: The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines the application programming interface (API), along with command line shells and utility interfaces, for software compatibility with variants of Unix and other operating systems.

Windows Terminal

Terminal for WSL I want a cool terminal for WSL, and “Windows Terminal” is easy to install and seems good. How to install From Microsoft Store. Change default terminal from PowerShell to WSL https://medium.com/@callback.insanity/windows-terminal-changing-the-default-shell-c4f5987c31 Open settings. It is a json file. Find defaultProfile. In my case, it is "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}" In list, find your Linux config line. Here is my sample. "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl" Change the default Profile value as your Linux guid.

Install Go (Golang) from source

Environment I wrote this article while installing go on WSL. Install Go lang $ curl https://dl.google.com/go/go1.15.5.linux-amd64.tar.gz -o golang.tar.gz $ sudo tar -C /usr/local -xzf golang.tar.gz $ vim ~/.bashrc ## Add /usr/local/go/bin/ to path ## export PATH=/usr/local/go/bin:$PATH $ source ~/.bashrc ## Check $ go version go version go1.15.5 linux/amd64 Upgrade the version Just delete the current version like rm -rf /usr/local/go, and replace it with new version. Tips: Installing Hugo on this setup (on WSL) GCC and G++ are required (sudo apt install gcc g++).

My simple Vim environment

Environment I wrote the article while installing on WSL. But this instruction works in any Linux environment basically. Color scheme - jellybeans If you don’t install git, please install it first. sudo apt install -y git git config --global user.email {{ my_email_address }} git config --global user.name {{ my_handle_name }} Download a color scheme jellybeans and put it to correct path. mkdir ~/.vim cd ~/.vim mkdir colors git clone https://github.com/nanotech/jellybeans.vim mv jellybeans.

7-Zip

Why(When) I use 7-zip 7-zip can unarchive large files (more than 4 GB.) Compatibility with many formants (zip, tar, rar, gz, etc.). Install sudo apt install p7zip-full sudo apt install p7zip-rar # For extracting RAR file Unarchive 7-zip can extract from a lot of archived or zipped format in the same command. 7z x {{ archived_file }}

ssh troubleshootings

Create a key pair for ssh RSA 4096 bits ssh-keygen -b 4096 ECDSA ssh-keygen -t ecdsa -b 521 ssh-keygen -t ed25519 Key format Note that the commands above issue OpenSSH Format (starts with -----BEGIN OPENSSH PRIVATE KEY-----). Some SSH client can’t read this format, and in that case, append -m PEM option. ssh-keygen -t rsa -b 4096 -m PEM Create only a RSA private key and out the public key openssl genpkey -algorithm RSA -out .