Linux Bash: Language Basics

stdin, stdout and stderr

Bash creates stdin, stdout and stderr streams for each command in the terminal. These streams carry text as data.

In Linux, almost all the streams are treated as if they were files. Just like you can read/write a file, you can read/write a data from these streams.

stdin: Stands for standard input. It takes text as input.
stdout: Stands for standard output. The text output of a command is stored in the stdout stream.
stderr: Stands for standard error. Whenever a command faces an error, the error message is stored in this stream.

Each stream has file descriptor ID as below

  • stdin – /dev/stdin or /dev/fd/0
  • stdout – /dev/stdout or /dev/fd/1
  • stderr – /dev/stderr or /dev/fd/2
Continue reading

GitHub clone all repositories

After you join an organization, you will need to clone all git repositories in your machine probably. 🙂

So first follow this post https://kenanhancer.com/2018/11/08/github-connect-with-your-ssh-public-key/ to create a ssh key in your machine and put in github then you can clone all repositories for any user.

if you have any authentication issue, then create an access token from github, copy and paste instead of {acceess-token} in the following code.

curl -u {access-token}:x-oauth-basic -s https://api.github.com/users/kenanhancer/repos?per_page=2 | grep ssh_url | awk -F '"' '{print $4}' | xargs -n 1 -P 4 git clone

In order to learn github API endpoint urls, use the following code.

curl https://api.github.com/

To learn more details about official GitHub REST API v3, use the following link.

https://developer.github.com/v3/