Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- BASH



  Differences between bashrc and profile in Linux

After login to a Linux system, the command console will show up with a prompt label such as # or ~, a shell command can be typed after this prompt and the system can execute the command thereafter. All these operations are handled by shell. Shell is a command language interpreter that executes commands read from the standard input device (keyboard) or from a file. There are different types of shells such as bash, ksh, csh etc. The most commonly used of them is bash and it's also the de...

   LINUX,PROFILE,BASH,BASHRC,.BASHRC,.PROFILE     2016-11-05 22:17:51

  A simple tutorial on Linux nohup command

In our daily work, there might be need to run some important program for hours or even days without being abruptly terminated. In such case, we may want to run the program with command nohup. nohup is the abbreviation of no hangup, i.e, don't hang up or terminate the process. This command will tell the process to ignore the system HUP signal. The HUP signal will be emitted when the terminal is exited or disconnected. Normally process will abort its execution when receiving this signal.  Bas...

   NOHUP,LINUX     2020-08-08 01:14:50

  Using vi key bindings in bash and zsh

Takeaway: If you prefer to use vi or vim for command-line editing, you can configure shells to use vi key bindings instead of emacs-style key bindings. Here’s how. By default, most shells use emacs-style key bindings for command-line editing and modification. For users of vi or vim, however, you can instead configure shells to use vi key bindings instead. This is done by editing ~/.bashrc in the case of bash, or ~/.zshrc in zsh a...

   vi,Linux,Zsh,bash,key binding     2012-02-07 06:22:36

  GoLang to build smaller executable file

Normally the executable file built with go is a bit large, it is always desired that a smaller executable file should be generated though. In this post, a couple of ways to reduce the size of the executable will be introduced. The end effect is that the executable file size would be much less than the normal generated one. The file which is built normally has below size. Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 12/14...

   GOLANG,EXECUTABLE     2019-12-13 20:10:45

  Simple tutorial on git cherry-pick

It is a common operation to move code from one branch to another branch in a multi-branch git repository. Normally there are two scenarios: Want to move all changes in one branch to another branch, now it's called git merge  Want to move only some change/changes from one branch to another branch, now it's called git cherry-pick Usage The purpose of git cherry-pick is to apply some change from one branch to another branch.  git cherry-pick [commitHash] The above command is to app...

   GIT,GIT CHERRY-PICK,TUTORIAL     2020-05-02 00:02:58

  Install multiple versions of Go

As a developer, there might be need in some cases to have multiple versions of Go installed. One may test out some new features of the latest version of Go but also wanna maintain a stable version of Go for daily development purpose. How to maintain multiple versions of Go? The GoLang official website has provided a way to maintain multiple versions of Go by using go get to install the different versions of Go. Below are steps: Download a normal version of Go and install it Go to the Go release...

   MULTIPLE VERSION,GO BINARY,GO VERSION     2021-05-16 02:01:46

  bash network interface

Some of us may have seen /dev/tcp/<host>/<port> before, is this a special file system implemented in some BSD kernel? Because there is no /dev/tcp in Linux. Actually, this one is implemented in bash. We no need to rely on wget,nc to do network connection. It's very easy to use this interface: bash-4.2$ cat </dev/tcp/time.nist.gov/13 56188 12-09-18 15:34:26 50 0 0 733.5 UTC(NIST) * bash-4.2$ exec 3<>/dev/tcp/www.w3.org/80 bash-4.2$ echo -e "GET / HTTP/1.0\n\n" >&3 b...

   Bash,Network interface,/dev/tcp     2013-07-20 00:57:52

  combining dwarf failed: unknown load command 0x80000034 solution in GoLang

In case there is below error encountered while running some go program: combining dwarf failed: unknown load command 0x80000034 This may be due to that you are running go 1.16 on a Mac M! machine. If you go to check go version, it may tell you that you are running an arm version of go. go version go1.16.10 darwin/arm64 In such cases, you can try below methods to workaround the issue. Try to upgrade the go version to 1.17 and run the code again. If this is not an option for you because you have t...

   GO 1.16,0X80000034     2021-11-25 07:11:28

  Create temp file in Bash using mktemp and trap

When working on Linux Bash, sometimes there is need to create temporary file. A common way of creating temp file on Linux is creating some file in /tmp directory. However there is security risk when creating temp file in /tmp directory. This post will show how to securely create temp file in Linux Bash. When creating file in /tmp directory, there are some security risks. This directory can be accessed by any user on the system, any user can write data into this directory as well. The files creat...

   LINUX,MKTEMP,TRAP,TEMP FILE     2019-12-30 23:28:23

  How to undo git changes?

When using git for version control, there is frequent need on undoing commits due to some unexpected changes. This post will introduce how to undo changes with git command in different cases. Undo commit A common undo case is that some commit needs to be reverted as the commit contains error. In this case, the code is already committed. The command to revert the commit is git revert HEAD This command will add new a commit to the existing head to undo the previous commit. It will not change the p...

   GIT,GIT RESET,GIT REVERT,GIT CHECKOUT     2019-12-28 02:21:47