blog.up-link.ro
2Oct/100

FreeBSD: How To fetch the ports from fast servers

Ports randomly gets it's source server list from bsd.sites.mk file located in /usr/ports/Mk/, as defined by the port maintainer. Most of the time downloading the source takes a long time if the remote server is not physically near to us.

In this case, we can tune the ports so that it fetches the sources from the nearest server. A nearer server normally means less latency and a faster connection.

The port fastest_sites will test the latency of the servers listed in /usr/ports/Mk/bsd.sites.mk. The file is suitable to be included in /etc/make.conf which tell ports where to fetch the sources from.

Print This Post Print This Post
19Sep/100

FreeBSD Tools: thefish – /etc/rc.conf GUI/TUI editor

The Fish provides a graphical tool (GTK+, QT, ncurses frontends) used to manage system variables stored in /etc/defaults/rc.conf and /etc/rc.conf.

In this example we'll use the ncurses version of The Fish.

To configure thefish, enter the following command:

make config -C /usr/ports/sysutils/thefish
Print This Post Print This Post
4Aug/100

Tip of the day: How to remove duplicate entries in a file without sorting

GNU awk is a programming language that is designed for processing text-based data, either in files or data streams, and was created in the 1970s at Bell Labs.

To remove duplicate entries without sorting them, enter:

gawk '!x[$0]++' filename
Print This Post Print This Post
2Aug/100

How To Install mp3 playback and multimedia support in Ubuntu 10.04 (Lucid Lynx )

Ubuntu is a computer operating system based on the Debian GNU/Linux and is distributed as free and open source software with additional proprietary software available.

Ubuntu is composed of many software packages, of which the vast majority are distributed under a free software license. The main license used is the GNU General Public License which, along with the GNU Lesser General Public License, explicitly declares that users are free to run, copy, distribute, study, change, develop and improve the software.

Multimedia support like MP3, avi, 3gp , DVD Video Playback are not available in Ubuntu 10.04 LTS (Lucid Lynx) due to patent, copyright, or license restrictions.

To get mp3 and other multimedia support on your Ubuntu 10.04 LTS (Lucid Lynx) , use the following commands:

sudo wget -O /etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list
sudo gpg --keyserver wwwkeys.eu.pgp.net --recv-keys 2EBC26B60C5A2783
sudo gpg --armor --export 2EBC26B60C5A2783 | sudo apt-key add -
sudo apt-get update
sudo apt-get --allow-unauthenticated install medibuntu-keyring
sudo apt-get update

To install non-free codecs, enter:

Print This Post Print This Post
10Jul/100

FreeBSD: How to Install Adobe Flash in FreeBSD 8

Adobe Flash is a multimedia platform used to add animation, video, and interactivity to Web pages. Flash is frequently used for advertisements and games. More recently, it has been positioned as a tool for "Rich Internet Applications" ("RIAs").

Adobe Flash plugin is not available for FreeBSD. However, a software wrapper for running the Linux version of the plugin exists. This wrapper also supports more plugins such as Adobe Acrobat plugin and RealPlayer.

In FreeBSD 8.X, install the www/nspluginwrapper port. This port requires emulators/linux_base-f10 which is a large port.

cd /usr/ports/www/nspluginwrapper
make install clean

The next step is to install the www/linux-f10-flashplugin10 port.

Print This Post Print This Post
18Jun/100

UNIX Tools: vmstat – report virtual memory statistics

vmstat is a computer system monitor tool that collects and displays summary information about operating system memory, processes, interrupts, paging and block I/O information.

vmstat

vmstat sample output

vmstat usage:

vmstat [-V] [-n] [delay [count]]

-V prints version.
-n causes the headers not to be reprinted regularly.
-a print inactive/active page stats.
-d prints disk statistics
-D prints disk table
-p prints disk partition statistics
-s prints vm table
-m prints slabinfo
-S unit size
delay is the delay between updates in seconds.
unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)
count is the number of updates.

Print This Post Print This Post
16Jun/100

Text Editors: vi commands and tips

vi is a family of screen-oriented text editors which share certain characteristics, such as methods of invocation from the operating system command interpreter, and characteristic user interface features. The portable subset of the behavior of vi programs, and the ex editor language supported within these programs, is described by the Single Unix Specification and POSIX.

vi operates in either insert mode (where typed text becomes part of the document) or normal mode (where keystrokes are interpreted as commands). Typing "i" while in normal mode switches the editor to insert mode. Typing "i" again at this point places an "i" in the document. From insert mode, pressing the escape key switches the editor back to normal mode.

Print This Post Print This Post
3Jun/100

UNIX Tools: txt2regex – regular expression (regex) generator

^txt2regex$ is a regular expression wizard that leads the user through the construction of a regular expression. txt2regex can create RegExes for use with different programs, including awk, ed, egrep, Emacs, expect, find, grep, lex, Lisp, MySQL, OpenOffice.org, Perl, PHP, PostgreSQL, Procmail, Python, Sed, Tcl, VBscript and vi. It is a useful tool for users with little or no knowledge of regular expressions and is included in several Linux distributions ( including Debian, Gentoo, Ubuntu ), in FreeBSD, and in Fink for Mac OS X.

Print This Post Print This Post
31May/100

How to speed up the boot time in Ubuntu by profiling the boot process

There is way to improve the speed of boot process in Ubuntu Linux by profiling your boot. Profiling lets Ubuntu make a list of all the files that are accessed during bootup, it then sorts the files according to how they are stored on your hard-disk. So the next time the system is booted, the files would be read faster.

To profile boot you need to follow these steps:

  • At the grub menu highlight the kernel
  • Press e for edit
  • Choose the line starting with kernel and press e again. Now add the word profile to the end of this line. Hit Enter and then press b to boot

NOTE: The system will boot slower this one time, the next time however you should see an improvement. Also keep in mind that all this is machine-dependent and also depends on the arrangement of files on your hard-disk, so the difference you see might not be huge, or even nil in some cases.

Print This Post Print This Post
31May/100

Linux Tips: Keyboard shortcuts and command line tricks

In this article I will show you some keyboard shortcuts and other command line tricks to make entering commands easier and faster. Learning them can make your life a lot easier!

Here are some keyboard shortcuts you can use within terminal:

Alt-r              Undo all changes to the line.
Alt-Ctrl-e        Expand command line.
Alt-p              Non-incremental reverse search of history.
Alt-] x            Moves the cursor forward to the next occurrence of x.
Alt-Ctrl-] x      Moves the cursor backwards to the previous occurrence of x.
Ctrl-a             Move to the start of the line.
Ctrl-e             Move to the end of the line.
Ctrl-u             Delete from the cursor to the beginning of the line.
Ctrl-k             Delete from the cursor to the end of the line.
Ctrl-w            Delete from the cursor to the start of the word.
Ctrl-y             Pastes text from the clipboard.
Ctrl-l              Clear the screen leaving the current line at the top of the screen.
Ctrl-x Ctrl-u    Undo the last changes. Ctrl-_
Ctrl-r              Incremental reverse search of history.
!!                   Execute last command in history
!abc               Execute last command in history beginning with abc
!n                  Execute nth command in history
^abc^xyz       Replace first occurrence of abc with xyz in last command and execute it

Print This Post Print This Post