T Posts

Shell basics: Pipes and redirection

[linkstandalone]

Every (UNIX) process has (at least) 3 communication channels available to it: Standard input (STDIN), Standard output (STDOUT) and standard error (STDERR). These are initially inherited from the parent process, so the child process does not necessarily know where they lead. These can connect to a terminal, a file, a network connection or a channel belonging to another process.

Symlinks

Stdin, stdout, stderr are presented as files and are actually symlinks to /proc/self/fd/{0,1,2}, directory listing from /dev:


$ ls -la /dev/{stdin,stdout,stderr}
lrwxrwxrwx 1 root root 15 Jul 27 13:36 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jul 27 13:36 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jul 27 13:36 /dev/stdout -> /proc/self/fd/1

STDIN, STDOUT and STDERR are in fact guaranteed to correspond to file descriptors 0, 1 and 2. Normally in interactive terminal sessions, STDIN reads from the keyboard and STDOUT and STDERR write their output to the terminal window.

Symbols

An example of use of redirection to avoid spammy "Permission denied" output:

find / -type f -name test 2>/dev/null

Tue, 27 Jul 2021 16:54:05 +0200

Let go of mistakes

[linkstandalone]

“No man ever steps in the same river twice, for it's not the same river and he's not the same man.” - Heraclitus

Consider all the mistakes you have made in your private and working life. You have probably learnt, re-learnt and changed many times. You are not the same person as you were a year or even a day ago. There is no need to ponder past mistakes. Events and outcomes are external and can only reflect a moment in time, will serve you better if seen as learning opportunities. They have passed and are unchangeable, while you have the opportunity to learn, improve and adapt. Take responsibility and focus on the present moment.

Tue, 27 Jul 2021 14:03:14 +0200

Binding capslock to escape on modern linux systems and setting layout

[linkstandalone]

/usr/bin/setxkbmap -layout no -option "caps:escape"

will do the job on most systems, and can be used to quickly set layout options from the terminal. You can also set it to run on startup (eg. under Session and startup on xfce)

Tue, 27 Jul 2021 14:01:16 +0200

First post - purpose/content

[linkstandalone]

Hi and welcome to my site. I will probably use it mostly for notes, guides and various information recorded for personal use, but that maybe one day can be of help to others as well.

Tue, 27 Jul 2021 13:53:04 +0200