Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Wednesday, 30 January 2013

Copy and rename multiple files

What do you do on Linux when you want to rename, copy or move many files together in the same way, e.g. replacing all files named "donkey01.jpg" as "horse01.jpg" ? There is plenty of GUI utilities, but sometimes a quick and cheap shell hack is needed. Here you go: the magics of sed and shell scripting in a one liner.

for i in `ls *`; do cp $i `echo $i | sed "s/search/replace/g"`; done

From here.

Monday, 14 May 2012

Search your installed Debian packages by repository

If (like me in this exact moment) you have a mess of a Debian (Ubuntu, Mint) system, and you want to know what packages you have installed from what branch / origin (stable, testing, unstable, experimental, backports) you can use Aptitude for that:


aptitude search '?narrow(~i, ~Abackports)'
 
Substitute to "backports" the repo you want to list, and you will obtain a fancy package list.

The ?narrow option tells aptitude to list only the installed packages. If you remove it, you'll get all packages you can install from that branch.

Another way is to install apt-show-versions and then use:


apt-show-versions -b | grep experimental


(again, substitute to "experimental" the branch you're interested in)

Tuesday, 8 February 2011

Install True Type fonts on Ubuntu in three steps

It's very easy:

1)Create a .fonts subdirectory in your home directory
cd ~
mkdir .fonts

2)Move the .ttf file in the .fonts directory
mv myfont.ttf ~/.fonts

3)Refresh the font cache
sudo fc-cache -f -v

And your font should be ready to be used.
Credits to Detector Pro -I streamlined the process a bit, being comfortable with the command line.