bash function for rpm whatprovides
Sometimes some simple one-liner function can save you a lot of time, like-
wps () { rpm -q --whatprovides $(which $1 ) } # ---------- end of function wps ----------
Sometimes some simple one-liner function can save you a lot of time, like-
wps () { rpm -q --whatprovides $(which $1 ) } # ---------- end of function wps ----------
xev – print contents of X events
So other day I was checking why my play key was not working and wanted to check if it maps to one of the X default mappings for the keyboard and was stuck on how to check this. And finally found that I can try this:
xev -event keyboard
Pretty neat 🙂
ranger is a terminal file manager, just install and run and have some fun.
Tip: You might want to try it on uxrvt terminal and in Photos folder once.
- Name : ranger
- Version : 1.7.2
- Release : 8.fc28
- Arch : noarch
- Size : 1.2 M
- Source : ranger-1.7.2-8.fc28.src.rpm
- Repo : @System
- From repo : fedora
- Summary : A flexible console file manager
- URL : http://savannah.nongnu.org/projects/ranger/
- License : GPLv3+
- Description : Ranger is a free console file manager that gives you greater flexibility and a
- good overview of your files without having to leave your *nix console. It
- visualizes the directory tree in two dimensions: the directory hierarchy on
- one, lists of files on the other, with a preview to the right so you know where
- you’ll be going.
Here is one liner that will add the current IP address in the console login screen (if you are not running X as is case for servers):
(ip -o -4 a| awk '$2 !="lo" {print "\nIP Address ::"$4}' |tr '\n' ',';echo)>>/etc/issue
Just execute the above command as root. It will add the required code in “/etc/issue” to display the IP address. BTW, you can also use “\4” or “\6” instead of that command to get the IP but that will not work with some old versions of Linux.
Continue readingRecently I got a script or series of scripts that were written for PHP 5.6x and hence used mysql_connect which as you know by now does not work with PHP 7.0. Since there were number of scripts, I thought it would be waste of time to change them manually and wrote a script to fix them. If you have similar situation then probably this few lines could help you.
Since my scripts did not use all the functions so I did not put the sed commands for all of them but you get the idea 🙂
Continue readingMonitor progress of coreutils commad like mv, cp etc
You can use command called “progress”. Other option is “pv” but that is little complicated so here is simpler option.
Progress – A Tiny Tool to Monitor Progress for (cp, mv, dd, tar, etc.) Commands in Linux
To install, you can do the following:
dnf install progress
Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –
history| ssh <user>@<host> 'cat - > /tmp/history'
And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.
Continue reading