LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

I leave notes here that I find particularly worth remembering myself.
Old

Shortest command to calculate the sum of a column of output

Posted 06-02-2010 at 06:27 AM by bittner (Notes on Linux)

I had to calculate the Installed-Size for a .deb control file recently. Here is the solution I came up with:

Code:
dpkg-deb -c mypackage.deb | sed -e 's/.*root\s*//' -e 's/\s*2010-.*$//' | xargs | tr ' ' + | bc
What it does? The code tries to construct a calculation string and feeds it to the command line calculator bc as follows:
  1. use dpkg-deb to get the file size information out of the Debian package
  2. sed away all characters before and after the
...
LQ Newbie
Posted in Uncategorized
Views 4273 Comments 2 bittner is offline
Old

Unix runlevel scripts: Finally the first character makes sense!

Posted 05-29-2010 at 04:12 PM by bittner (Notes on Linux)

You probably know Unix runlevel scripts. They start with an S or a K, and they are typically located at /etc/rcX.d/ with X being the runlevel (0-6) the script is supposed to run at. For example:
Code:
~$ ls -l /etc/rc5.d/*cups
lrwxrwxrwx 1 root root 14 2009-12-31 16:35 /etc/rc5.d/S50cups -> ../init.d/cups
To be precise those S- and K- files are typically symbolic links to scripts that reside in /etc/init.d/, and from my experience I felt they work as follows:
  • Any symlink
...
LQ Newbie
Posted in Uncategorized
Views 2662 Comments 0 bittner is offline

  



All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration