Ubuntu Technical

Ubuntu technical problems and solutions reference, a modern cookbook.

Tag Archives: ubuntu

Adding custom MAN pages

Recently I was faced with a new issue/challenge: adding custom man pages for a custom/user defined command. This being said, I started to dig into the configuration and structure of the man command.

I will not go too deep into the man theory, there is always Google for it, or the official manual pages:

man man

As I now know, after reading documentation, there are 9 section of documentation for each command. So, it means separate documentation file for each section.

In the following example I will create custom documentation for section 1 (Executable user programs and shell commands) and section 4 (Information on device files). I call the command dummy.

#The following commands create the default structure for custom man pages
cd ~/
mkdir ownman; mkdir ownman/man1; mkdir ownman/man4
cd ownman/man1
vi dummy.1 # Add some documentation here. Example: 1) Documentation for section 1
cd ../man4
vi dummy.4 # Add some documentation here. Example: 1) Documentation for section 4

Now that the structure is in place, the man pages for the the dummy command can be called. The -M option has to be used in order to specify the location of the man pages for the specific command.

man -M ~/ownman dummy
1) Documentation for section 1

 Manual page dummy(1) line 1/66 (END) (press h for help or q to quit)

The default section is 1, so it’s not necessary to be specified here. With specification, the command looks like this:

man -M ~/ownman 4 dummy
1) Documentation for section 4

 Manual page dummy(4) line 1/66 (END) (press h for help or q to quit)

The structure and the call is in place now. But still, it could be tiresome sometimes to remember the path to the man pages, especially if one were to declare multiple locations.

To add the ~/ownman location to the locations man is looking at by default, the configuration file needs to be edited. On Ubuntu this file is: /etc/manpath.config (for Red Hat and Red Hat derivatives, like CentOS and Fedora, the configuration file for man is /etc/man.config)

# need sudo rights for this, as the owner of the file is root
sudo vi /etc/manpath.config

Edit the file by adding a new entry in the MANDATORY_MANPATH section.

MANDATORY_MANPATH			~/ownman

If there is a need to specify different man pages path for different command paths, another edit needs to be made, further down in the file. A new entry for MANPATH_MAP

MANPATH_MAP ~/custom_commands_location			~/ownman

Now the simple, straight forward command can be called:

man dummy
1) Documentation for section 1

 Manual page dummy(1) line 1/66 (END) (press h for help or q to quit)

Cheers



Flattr this

Advertisements

Unity Glass Tweak

I have just downloaded the nice looking Unity Glass nicely packed into a .deb package by the Spanish Ubuntu blog

For now it looks super cool and slick, and I am happy with this tweak. So, I am writing this post just to have a way of reminding myself how to uninstall in case it starts behaving badly 🙂

sudo apt-get --reinstall install unity

Cheers



Flattr this

Sound problems after Ubuntu 12.04 upgrade

I have managed to make my first successful migration since I am using Ubuntu. Of course successful is a relative term. I had a few issue, among them was my sound. I had no sound from my OS or Rhythmbox. I did have sound from movies (probably due to the fact that my VLC drivers/codecs were installed correctly, and I also had sound in Google Chrome on youtube

I found the solution to my sound problem on SoundTroubleshootingProcedure.

For me the first tip did the job:

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` libasound2; sudo apt-get -y --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` libasound2; killall pulseaudio; rm -r ~/.pulse*; sudo usermod -aG `cat /etc/group | grep -e '^pulse:' -e '^audio:' -e '^pulse-access:' -e '^pulse-rt:' -e '^video:' | awk -F: '{print $1}' | tr '\n' ',' | sed 's:,$::g'` `whoami`

Cheers



Flattr this

Stop or start BOINC daemon after boot

I have installed BOINC client, to subscribe to some projects meant to discovery alien life or at least some new pulsars.
However, I have noticed that the client, in contrast to it’s Windows counterpart, didn’t have an option in Preferences for auto-start on system boot. Of course it was starting up automatically and that’s not good in my book. So I started digging a little bit, and came across the documentation page

In a nutshell, the “init” script is:

/etc/init.d/boinc-client 

The following commands (with self-explanatory options) can be directly run on the script:

./etc/init.d/boinc-client start
./etc/init.d/boinc-client stop
./etc/init.d/boinc-client restart
./etc/init.d/boinc-client status

As I have now found out, in a Debian-based Linux distributions you use the update-rc.d command to turn a system service (daemon) on or off at boot time (I needed to use the -f force option to remove boinc-client, don’t know exactly why):

# tells the system to start the BOINC client as a daemon at boot time
sudo update-rc.d boinc-client defaults 98
# tells the system not to start the BOINC client at boot time
sudo update-rc.d -f boinc-client remove

Cheers



Flattr this

Sync directories excluding file types

I have recently needed to find a solution to moving the content of a directory from one folder into another, but excluding certain file types. After digging through the documentation I have found the rsync command.
Short extract from it’s man pages:

Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use.

So, here is the script to copy files from one place to another ignoring certain file types (in this example I exclude .avi files):

rsync /source/folder -av --exclude='*.avi' /destination/folder

The -v option is for verbose, so that we can see in the output what’s being synced.
Enjoy.



Flattr this

%d bloggers like this: