Showing posts with label history. Show all posts
Showing posts with label history. Show all posts

May 13, 2022

History in ZSH

I switched to zsh from bash many years ago. 

Today, I like to share a few tips on using zsh, and those are included in my dotfiles.


How to SKIP a cmdline from .zsh_history

$ echo "This cmdline saved in history."

$  echo "This cmdline will not be saved in history (bcos of leading space. Try it."


Show datetime and elapsed times in history

I would like to show the datetime and the elapsed time of my cmdline in my history. Thus I modified the alias in my .zshrc:

alias history='history -i -D 0'

Where -i is for datetime in iso-format, -D is for showing elapsed times spent, and 0 is for showing all the history.


To show history from all the login terminals

I do open multiple terminals for work, and I would like to see the history of cmdline from all the terminals. Thus I enable the setopt in my .zshrc:

setopt share_history

 

Mar 12, 2009

Compiler or Programming Language: Which Came First

Have you ever think about this? Which came first, the compiler or the programming language?

This is like the classic causality dilemma on "chicken and egg" question. Here is what I think the sequence of how it comes:
  1. Machine code: The 1st program was written directly in the hardware's machine code
  2. Assembler (Interpreter): A program written in machine code to interpret ASM into machine code.
  3. Compiler: This is a set of programs (lexical analyser, parser linker etc) which could convert source code to assembler/machine code.
Links: