I am preparing some code for a another blog post I came across some very unexpected behavior on my terminal that really got me thinking 🤔. Time was behaving in 2 different ways depending on what it seems an entirely unrelated reason.Continue reading “Unix bash shell and the time command output”
I recently came across this one as part of a PostgreSQL upgrade I run on my Linux (Debian) box.
Going from version PostgreSQL 9.4 to 9.5 worked like a charm. Upgrading to version 9.6 did not go as well though … The error I was getting was:
FATAL: could not load server certificate fileContinue reading “The snakeoil ssl certificate”
"/etc/ssl/certs/ssl-cert-snakeoil.pem": ee key too small
If you are running Debian as a distribution and you have recently upgraded from lxc2 to lxc3 you might notice that your containers do not start.
For me the error I got right after upgrading was:
$ lxc-ls -f Failed to load config for "container_name"
It turns out this is an easy problem to solve 🙂Continue reading “Upgrade from lxc2 to lxc3”
Vim is a very powerful text editor and as such it has lots of options which allows you to configure it “just right” for you! In order to configure it you can set up values to its various options either in the current window you are working on or in configuration file so that every new instance launched will have common settings. This file is usually called vimrc and is located under your home catalog.
But what happens if you wish to reset the value of an option you have configured in this configuration file for just this window that you are currently working in? I found that to be more difficult than expected so, here is how you can:
- Start a clean instance of vim with all its default options that ignores all the settings in all the user defined configuration files
- Get the currently set options and their values
- Disable/reset options that I will call switches
- Reset any option to each default value (whatever that might be)
A symbolic link is a “connection” we create between a location and a physical file or directory. The file or directory exists in a known location A in our system and we wish to create a connection to that location from a different location in our system B. An easy way to think of a symbolic link is like a shortcut from one location to another.
A symbolic link is created with the following command
ln -s TARGET NAME_OF_LINK
where ln is the basic unix command, the parameter -s specifies that we wish to create a symbolic link, TARGET should be replaced with the destination of our link and NAME_OF_LINK should be replaced with what we want our link to be named after.Continue reading “How to create a symbolic link”
If you wish to see the value of an environment variable the easiest way to do so is to print the contents of the variable in your shell. To do so you have to use the following command:
If there is an environment variable defined named var_name then the above command will output its contents in standard output (your shell). If there is no variable with that name defined the above command will output an empty line. If you see var_name outputed in your shell you probably forgot to type in the $ sign before the name of your variable. Remember that echo simply echoes a string in standard output so if you do not specify that the string you typed is a variable ($ sign) then it will simply output your string.
Now if you do not exactly remember the name of your environment variable the easiest way to find out if it is defined or not would be to output all the environment variables defined and either move your way through the list like
or pipe the output to grep providing a part of the name of the variable like
printenv | grep name
I recently found an alternative to kde’s Desktop sticky notes which was most probably not made for that but none the less it does the trick and it allows you to have control of the location and storage of your notes.
You can use an editor and create a txt file that you will keep your notes in. The good thing is that since this is a file that you have created you can store it wherever you want on your local system and perhaps back it up as you would with every other file. Then you can add a kde desktop widget called File watcher. As soon as you place your widget on your desktop it will only have a single button on it and clicking it will allow you to select the file you wish to “Watch” (check for changes or modifications). Here select your notes file by browsing to your directory.
After completing the steps described above you will have your notes displayed in the File watcher and whenever you update and save the file the widget will be updated automatically. If you wish to edit your file you don’t even have to browse to its location and edit it, you can simply right click on the widget and choose“Run the associated application” which will open your notes for editing. That’s it! Save and you are done…
When browsing your directories command line on your linux box you might want to get a count of the files inside a particular directory. This turns out to be a very easy task and the only things you need to know are the | operator and two basic commands, called ls and wc.
Since you are browsing your directories command line I take it you already know ls (for listing directory contents) but you might not yet know wc!
So first you need to issue an ls -l command which will print on standard output (your terminal) a list of the files in your directory one file at each line. Then we need to pass that result as input to the wc command (which prints information about the lines in a file, or the words in a file etc.). So, we can do that in one line by writing:
ls -l | wc -l
In order to create a custom key shortcut in KDE (I am currently using 4.4.5) you should do the following:
- Visit System Settings
- Select Input Actions under Computer Administration
- Right-click on Preset Actions and follow the path
- Global Shortcut
- Command / Url
Continue reading “Custom Shortcut”
Having done so you should see something like