Below you will find pages that utilize the taxonomy term “linux”
Posts
A case of slow loading zsh
I have been using zsh (Z-shell) for a long time. Recently it came to my attention that opening a new terminal was taking about 2-3 seconds which is quite a long time.
Just to rule out some other reasons, I switched my default shell to bash and saw if it was still slower and turned out that was not the case.
Changing default shell chsh -s /bin/bash Normally all shells load up some configuration, aliases, etc while opening a session, .
read morePosts
ENTRYPOINT Vs CMD in Docker
CMD Vs Entrypoint is a bit confusing at the beginning. When should you use CMD and when should you use ENTRYPOINT while building your docker images?
CMD
This is the command that runs when you start a container.
Eg:
cmd-docker
FROM ubuntu CMD [ "echo" , "this is running from CMD which runs when the container starts" ] Building an image:
docker build -t cmd-docker -f cmdvsentrypoint.yaml .
Default docker run:
read morePosts
Using gcsfuse to mount GCS bucket
Migration to Cloud
As your applications scale it becoomes tedious, expensive and error prone to have it all on your data centers. Modern microservices are built with the philosophy of isolation. Scaling up and down of those services should happen with a snap of a finger (enter containerization technologies like dockers replacing traditional VMs), you scale up to serve bigger traffic and also to make it fault tolerant. But even if you have 20 docker pods, a failure in data center as simple as switch failure can bring your whole infrastructure to its knees.
read morePosts
Reminder for task-warrior CLI
TaskWarrior CLI
TaskWarrior is a CLI based task manager which I find pretty handy to use. When you are working on something (where your linux terminal is always with you), you can just create an interactive todo from your command line.
~/sudip/sudipbhandari126.github.io(master*) » task add write a blog about task warrior reminder sudipbhandari@sudipbhandari-Latitude-5480 Created task 1. ---------------------------------------------------------------------------------------------------------------------------------------------- ~/sudip/sudipbhandari126.github.io(master*) » task list sudipbhandari@sudipbhandari-Latitude-5480 ID Age Description Urg 1 3s write a blog about task warrior reminder 0 1 task ---------------------------------------------------------------------------------------------------------------------------------------------- ~/sudip/sudipbhandari126.
read morePosts
How git stores changes
Git stores snapshots of the directory content at the moment. (Contrast older VCS systems which just capture the changelog) If files haven’t changed it just points to the previous version.
We can check the content of the commit blob. It’s stored in .git/objects. It’s stored as a compressed zlib file.
~/projects/my-project/.git/objects/1a(my-branch) » pigz -d < 58989906551da9cd7f2395c640e0b90667aa27 commit 677tree f1c83252e98f54138359308ef247193bf4e0bef4 parent 1747b1d081167971b9612ad75862943e8a9f344c author Mister Author <mister-author@host.com> 1567673031 +0000 committer Mister Author <mister-author@host.
read morePosts
Curious Case of super huge syslog
The Problem:
Insufficient memory left on /root partition.
On inspection I found that it was happening because /var/log was growing till 35 GB (I have a root partition of 50 GB).
On further inspection I found that /var/log/syslog was huge
Following was the repeating line (error log that would quickly fill up my disk space)
Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.gnome.Shell.desktop[1399]: Error: /bin/java not found Jun 18 12:09:23 sudipbhandari-Latitude-5480 org.
read morePosts
Slack WebHook, A use case
Linux Terminal Controlled Slack WebHook This is a simple use case of slack webhooks. Slack webhooks can be configured to send messages when some events occur, i.e. we trigger the hook and the hook sends the message to slack channel configured.
I have set up a workspace (for my own personal experimentations) and created a webhook which is a fairly simple process. Web Hook can be called via HTTP POST call with required message.
read morePosts
Linux aliases
Read Sudip Bhandari's answer to How can I create aliases in Linux command? on Quora
read morePosts
Quick & Simple screencasts using Peek
Read Sudip Bhandari's answer to Can you surprise me with a Linux software so good I didn't know I need it until now? on Quora
read morePosts
Some Useful SSH tips
Executing commands remotely and returning results One of the common usage is to log into remote machine and check some process stat to see if some program is running or not. Instead of logging in, executing command and then returning back, we can do it in a single shot by providing the command to be executed as an argument.
ssh loguser@$x.x.x "ps -ef | grep kafka" loguser 12214 12213 0 23:47 ?
read morePosts
Shebang (what does "#!/bin/bash" do at the start of bash scripts?)
Demonstration by Example This was originally answered by me at Quora
#!/bin/sh sleep 50 let’s save it as a.sh and make it executable
sudo chmod +x a.sh Let’s run it in the background and stat the process.
./a.sh& [1] 11660 On looking at the process details:
ps -fp 11660 UID PID PPID C STIME TTY TIME CMD sudipbh+ 11660 11330 0 15:30 pts/7 00:00:00 /bin/sh ./a.sh We can see that the content of the file is passed as an argument to the program /bin/sh.
read morePosts
I completed Unix Workbench Course by John Hopkins University in Coursera
I recently completed UNIX workbench course by John Hopkins University in coursera. So, I thought I would write something about UNIX, GNU/Linux.
Love for UNIX There is a documentary by AT&T on Unix on youtube which I regularly rewatch now and again which shows the early story of UNIX and has Brian Kernighan talk about the power, simplicity and elegance of UNIX design.
We know the story of how linux came to be.
read morePosts
Vimium, Browser for hackers!
How I came to know about it So, I am a regular reddit user and it’s one of my favorites online communities. While browsing through subreddit posts, there is a feature in the reddit web-app where you have keyboard shortcuts for browsing: N for next post, P for previous post and so on. I found it very convinient and easy to use especially because you don’t have to take your hands off the keyboard.
read morePosts
Leveraging Cron job to monitor network connection
Scenario: There are a handful of ways to run some script periodically on a linux machine. Cron jobs, watch command. Cron jobs are heavily used in server infrastructure for task like regular disk clean up, network monitoring, hard disk storage monitoring, setting up alerts, etc.
I have been running Ubuntu 18.04 and one common issue that I have observed is, in certain wireless connections, after a certain time network-manager stops working.
read morePosts
Leveraging git hooks
Adding tag support to Jekyll Now This blog is a forked version of a popular github blog project called Jekyll Now. It’s based on ruby and is a really elegant and easy to use tool that I have found. Being bare minimum version it doesn’t have tagging support for blog posts.
I have added tags to all the blog posts. This particular plugin isn’t supported by github so running it just like that doesn’t create ’tags’.
read more