Feed on
Posts
Comments

Archive for the 'Unix' Category

match tab in sed

to replace a tab in sed: sed ‘s/<tab>//’ where <tab> is you typing CTRL-V followed by pressing TAB (thanks to atoztoa!). alternatively: sed ‘s/\\\t//’  

i’ve got a bunch of files with one line — a number — and i’d like to sort those filenames on the command line based on that number. to that in one line of shell code: for i in `ls *.*`; do echo “`head -n1 $i` $i” ; done | sort -n

upgraded from squeezebox center 7.1 to 7.4 today and my aac playback broke. to fix, i had to add the following lines to my convert.conf file: mov mp3 * * # FB:{BITRATE=-B %B} [faad] -w -f 2 $FILE$ | [lame] –resample 44100 –silent -q $QUALITY$ $BITRATE$ -x -r – – mov wav * * # […]

while trying to upgrade my packages, i got caught with the following error: Removing ghostscript … Purging font configuration of gs… No alternatives for ps2pdf. dpkg: error processing ghostscript (–remove): subprocess pre-removal script returned error exit status 1 Errors were encountered while processing: ghostscript E: Sub-process /usr/bin/dpkg returned an error code (1) to solve it, […]

so a couple of weeks ago, i decided to upgrade the hard drives in my server.  previously, i had two 160 GB drives mirrored in a RAID 1 array.  there were several partitions in the array. after an impulse newegg buy (curse you and your sales newegg!), i had two 750 GB drives i endeavored […]

i recently installed some massive hard drives in my server box.  given all that space, i thought it’d be perfect to have the mac’s in my house all backup via time machine to those drives.  here’s how i got things working. enable sharing on the macs by opening the terminal and entering the command: > […]

missing corresponding BIOS drive

while replacing a hard drive in my server this weekend, I tried to install GRUB on the replacement hard drive: > /usr/sbin/grub-install /dev/hda only to receive the following error message: /dev/hda does not have any corresponding BIOS drive. this was strange, as I was certain that /dev/hda existed.  after some googling, I found the solution: […]

remove a user in debian (unix)

to remove a user and their home directory, use:  sudo deluser -remove-home <user-name> to remove all of their files on the server: sudo deluser -remove-all-files <user-name>

to setup my server to use a static ip address i edited the file /etc/network/interfaces to include the lines: iface eth0 inet static name Ethernet LAN card address 192.168.2.100 netmask 255.255.255.0 broadcast 192.168.2.255 network 192.168.2.0 gateway 192.168.2.1 of course, whomever provides you with your static IP address should also be giving you the appropriate information […]

let’s say you’ve got a string and you’d like to count the number of times some substring appears in it. let’s also assume that you’re lazy and you don’t want to leave your shell terminal to do it.  fortunately, there’s an easy way to count string matches from the command-line using a perl one-liner.   let’s […]

Next »

More blogs about http://desk.stinkpot.org:8080/tricks.