Tag: linux

fzf – error when pressing Ctrl+R

I’ve become a big fan of fzf since I discovered it.

However, after a recent upgrade, when I pressed Ctrl+R, I got the following error –

unknown option: --scheme=history

After some searching, found the following solution.

Remove fzf from /usr/bin/ and relink it.

Run these two commands in order –

sudo rm /usr/bin/fzf
sudo ln -s ~/.fzf/bin/fzf /usr/bin/fzf

install fzf on Linux

fzf is a serious timesaver. To be able to quickly go through past commands and in a fuzzy manner, especially when you don’t recall the exact command is a Godsend!

To install fzf on Linux, we need to

a) clone the repository into the system

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf

b) run the command which will add the relevant shortcut keys

~/.fzf/install --all

There are a bunch of other stuff that can be done once fzf is installed. For example, to see instant file previews –

fzf --preview 'less {}'

And if there is bat also installed, then the previews can show syntax highlighting and line numbers also!

fzf --preview 'bat --color=always --style=numbers --line-range=:100 {}'

How to generate SSH Keys and avoid “Invalid privatekey” error

I’ve long been a user of DBeaver which works so well across different OSes, so recently I wanted to set up the cloud version called cloudbeaver.

In the course of doing that, I had to generate SSH keys to be able to access remote databases via SSH.

Generate an SSH keypair

The standard way of generating SSH keys is to run this command.

> ssh-keygen -t rsa

This by default creates id_rsa and id_rsa.pub under <home directory>/.ssh folder (both in Windows and Linux)

Continue reading

Hide commands from bash history temporarily

There’s been a number of times I’ve wanted to not include some commands that I type into bash from being added to bash_history

The most convenient is to start a subshell by typing in bash again. This ensures that the commands in the subshell don’t get added to the history.

There are additional ways of achieving this as well.

Continue reading

mesg: ttyname failed: Inappropriate ioctl for device

While running a cron job in Linux, I sometimes get this error and I had been struggling to solve this until I came across this post.

Although that particular post mentions the cause being Vagrant, mine was due to a cron job.

First the solution …

Modify .profile under home folder

Open ~/.profile

Replace the following line –

mesg n || true

with

tty -s && mesg n

The reason for this is given very well in the post linked above.

Continue reading

users and sudo in Linux

Every time I need to create, modify, grant sudo access to users in Linux, I have to search for it.

This is a list of the commands I’ve used in the past.

Will keep updating this so that I don’t have to load a search page every time!

All commands below are run as root user. If I’m not the root user, I need to prefix them with sudo!

Continue reading

incomplete list of linux mail commands

As mentioned in the previous post, if you need to run cron jobs in linux, knowing how to debug them via mail is really important.

By the way, mail is the older program, the link above is to the man page of mailx which is the newer program created relatively recently, in 1986!

Navigating through messages in the mailbox is quite a challenge as I found.

So I decided to create a list of the commands which I used most frequently and found useful.

Continue reading

Copyright © 2024 the möbius trip

Theme by Anders NorenUp ↑