The Archives

  • 10.Aug.17
    Interlacing file lines shell | fernape | (0)
    Recently I needed to mix several files into one single file. The point was that I needed to interlace the files so I had all the first lines of every file followed by all the second lines and so on. Put it simply, this is what I had: fapesteguia@fapesteguia:~/test$ cat file1 file 1 row 1 file 1 row 2 file 1 row 3 file 1 row 4 file 1 row 5 file 1 row 6 file 1 row 7 file 1 row 8 file 1 row 9 file 1 row 10 fapesteguia@fapesteguia:~/test$ cat file2 file 2 row 1 file 2 row 2 file 2 row 3 file 2 row 4 file 2 row 5 file 2 row 6 file ...
  • 09.Jan.14
    Handling rc.conf(5) with sysrc shell | fernape | (0)
    FreeBSD uses the traditional BSD boot system as opposed to the system used in Linux, i.e SysV. This means that in FreeBSD, we have a directory called /etc/rc.d with a bunch of scripts that bring our system up and running. Alongside these scripts, there is a file used to control some configuration variables used at boot time:/etc/rc.conf Since it is a very sensitive file, an unfortunate mistake while editing it can break havok if our system does not boot the next time. To avoid these kind of situations, there is a tool called sysrc. sysrc provides a way to edit rc.conf(5) safely ...
  • 15.Oct.11
    Creating shell archives shell | fernape | (0)
    shar(1) is a FreeBSD base system utility for creating shell archives that is, a kind of self-extracting archive of a hierarchy of files and directories. The archive will recreate the file hierarchy specified at creation time. It is fast and the result is easy to handle as the shell archive is a text file (good to email a file hierarchy). To create a shell archive: $ shar `find my_directory` > my_hierarchy.shar To recreate the hierarchy: $ sh my_hierarchy.shar That is, shar is a simpler version of ar and tar. Enjoy!
  • 13.Sep.11
    Audio settings on FreeBSD shell | fernape | (0)
    mixer(8) is a FreeBSD base system utility for setting and displaying sound card mixer levels. It resembles the Linux's command line utility alsamixer. Invoked with no parameters it shows the current values of the mixer devices: $ mixer Mixer vol is currently set to 85:85 Mixer pcm is currently set to 75:75 Mixer speaker is currently set to 75:75 Mixer mic is currently set to 0:0 Mixer mix is currently set to 0:0 Mixer rec ...
  • 08.Apr.11
    Screenshots from the command line (FreeBSD) shell | fernape | (0)
    vidcontrol is a nice utility that among other things allows one to capture the state of a video buffer and dump it to a file. The format of this file is specified in the man page as it is not a regular image file. For this reason one needs a specific tool to convert it to something one can play with. These commands are scr2txt (/usr/ports/textproc/scr2txt) and scr2png (/usr/ports/graphics/scr2png). They can then be combined using one single line: $ vidcontrol -p < /dev/ttyv0 | scr2txt > /tmp/screenshot.txt The -p flag instructs vidcontrol to get the current content of the corresponding video buffer. ...
  • 21.Dec.10
    Limiting resources with limits (1) shell | fernape | (0)
    limits is a FreeBSD's base system utility for displaying and setting system resources limits. To some extent it is equivalent to the limit and ulimit commands. It can set limits for filesize, coredumpsize, maxproc, memoryuse and other parameters. Convenience modifiers like k, m or g for kilobytes, megabytes and gigabytes or s, m, h for seconds, minutes and hours can be used in all cases. limits can be used to achieve three different goals: Set resource limits. For example: $ limits -t 1s ls -R / launches the ls -R command with a cputime limit of 1 second. In general, this is the ...
  • 03.Jul.10
    Which package does this file belong to? cmd | fernape | (0)
    On FreeBSD, we use the pkg_info command this way: $pkg_info -W /usr/local/bin/mysql /usr/local/bin/mysql was installed by package mysql-client-5.5.2 Enjoy!
  • 31.Dec.09
    Make Love cmd | fernape | (0)
    In FreeBSD: $ cd /usr/src $ make love Enjoy the output. Merry Christmas! Source: psybermonkey
  • 22.Oct.09
    Pstat shell | fernape | (0)
    pstat is a command line utility for obtaining system statistics. When invoked with -s it shows swap space information. When used with -f it shows statistics on open files. Below is an example showing information about both open files and swap use: $ pstat -T 6052/12328 files 0M/128M swap space pstat is part of the FreeBSD's base system Enjoy!
  • 09.Sep.09
    IM from the command line network, shell | fernape | (0)
    % cd /usr/ports/net-im/finch; make install clean The above installs finch. It is an ncurses based instant messaging client, part of the pidgin suite. Though it can be a little tough at the beginning, it is a good alternative if you do not have a graphical interface. Below I show two screenshots. Use Alt-w to move between windows. Enjoy!