Skip to main content

Posts

Showing posts from March, 2009

How to Make a Local (Offline) Repository in Ubuntu / Debian

If you are in a place where you dont have internet (or have a bad one) You want to download .deb packages and install them offline. Each deb file is packaged as a seperate unit but may contain dependencies (recursively). apt-get automagically solves all the dependencies and installs all that are necessary. Manually install deb files one by one resolving each dependency would be tedious. A better approach is to make your own local repository. Before you actually make a repo, You need *all* deb files. You dont practically have to mirror all of the packages from the internet, but enough to resolve all dependencies. Also, You have to make sure, you are getting debs of the correct architecture of your system (i386 etc) # 1. make a dir accessible (atleast by root) sudo mkdir /var/my-local-repo # 2. copy all the deb files to this directory. # 3. make the directory as a sudo dpkg-scanpackages /var/my-local-repo /dev/null > \ /var/my-local-repo/Packages # 4. add the local repo to sour

Quickly: Command history in Linux / Shell

If you are like me, doing a lot of command line in linux (Bash) shell, there are a few commands you do very often. The following commands will make your life a lot easier to quickly go back in command history. [ !! ] or better yet [ sudo !! ] - [ !! ] is an alias for last run command. One of the best use of this is - Sometimes, you type a command and the shell hits you back with a root privileges required message. You dont have to copy the command and run again. just run [sudo !!] [ history ] - just spits out ~/.bash_history with line numbers. A good use of this is piping it to grep to find something. The line numbers can be used to execute the command following it. Say for example, [ history | grep find ] lists the previous searches (okay, it also shows all commands with "find" anywhere in the line - but a filtered, smaller list). $history | grep find 457 find *.wav 462 find *.wav -exec lame --preset fast extreme '{}' '/tmp/mp3/{}' \; 487 find *.wa