inotify -watch for file to change

2014-01-28 1 min read Learning Linux

Here is a simple command for you. It uses inotify tools. So first you need to install :

sudo yum install inotify-tools

and then you can try something like this:

while true; 
do 
inotifywait -r -e modify --exclude=".swp" . && make; 
done

Here, once the file changes, we are running make, but you can do anything you want.

 

 

Continue reading

vim – yank/xopy in different register to paste

2014-01-16 1 min read Vim Tips

Very quick update, to use registers, you can select and then yank in a register to paste using the same register. This could be a convinient way to copy multiple selections and then paste which ever selection you want. Here is the simple way to do it:

visuallly select with v/V

then “qy to yank (here we are yanking into register q, so in the command you can use any of a-z to use as register)

Continue reading

cgroups – use to control your cpu and memory

2014-01-06 2 min read Fedora Firefox Learning

cgroups is a kernel feature and with userspace utilities, we can use the feature to control the cpu and memory for per process. So, lets first install the required tools.

sudo yum install libcgroup-tools

Now, we need to enable the service.

sudo systemctl enable cgconfig.service
sudo systemctl enable cgred.service

cgconfig.service is to enable configuration for cgroups and
cgred.service is to enable configuration for cgroups for processes depending on the name.

Continue reading

more clients for mpd.

2013-12-26 1 min read Fedora Linux

Here are some more clients that you can use with mpd.

sudo yum install mpd mpc qmpdclient.x86_64 gmpc.x86_64 sonata.x86_64

mpd is ::

Music Player Daemon (MPD) is a flexible, powerful, server-side application for
playing music. Through plugins and libraries it can play a variety of sound
files (e.g., OGG, MP3, FLAC, AAC, WAV) and can be controlled remotely via its
network protocol. It can be used as a desktop music player, but is also great
for streaming music to a stereo system over a local network. There are many
GUI and command-line applications to choose from that act as a front-end for
browsing and playing your MPD music collection.

Continue reading

Fix typescript files generated with script command

2013-12-18 1 min read Learning Linux

Generally quite a lot of us would have used the script command. This generates the logs for the session. But the problem with the logs is that it contains a lot of un-readable characters. These characters are mostly from the color codes, and as such can be removed very easily with a single command:

cat typescript | 
 perl -pe 's/e([^[]]|[.*.*?[a-zA-Z]|].*?a)//g' | col -b > typescript-processed

This assumes the input log file is named as typescript and the output is kept as typescript-processed. You can change the names as required.

Continue reading
Older posts Newer posts