Archive for ‘CLI’ Category

Just came across tms , what a great tool. It a command line tool for OSX 10.5+ that allows basic CVS style operations on your Time Machine volumes and It does its thing in read-only mode, so nothing gets changed/deleted…..woohooo. Here is the stuff you can do with it:

  • help      – instructions on usage
  • version   – print the current version of this tool
  • disk      – print the current disk
  • disks     – print list of all Time Machine disks
  • volumes   – print list of all volumes
  • machine   – print the current machine
  • machines  – print the list of all machines backed up on the current disk
  • status    – print the current configuration
  • snapshots – print the list of snapshots for the current machine on the current disk
  • snaplog {} – print the log for the given (or latest) snapshot
  • log +     – print revision information for the given files
  • diff [-u] {} {} – print file diff with the given (or latest) snapshot, or between two snapshots
  • delta [-size] {

Go grab your copy NOW.

Duplicate your Ubuntu Installation….

datePosted on 13:55, February 18th, 2009 by Many Ayromlou

As good as Ubuntu (and linux) are in general, once in a while you just get to a point where you need a reinstall. That’s when the realization kicks in that you’ve got far too many packages installed since the initial Ubuntu install. It’s okay, there is a way out. Make sure you have a USB key.

On Ubuntu Workstation (with graphical interface):

Run Synaptic package manager. Once inside Synaptic, go to File/Save Markings As menu option and choose a filename and location (USB stick). MAKE SURE YOU ALSO CHECK THE BOX “SAVE FULL STATE, NOT ONLY CHANGES”. This will save a text file that contains every single package installed on your system (through apt system and all it’s variants….manual compile/installs are something else). Now you can go ahead and reinstall the machine and configure your repositories. Once the machine is up and running again, load up Synaptic and go to File/Read Markings and point it at the file you saved on the USB stick and press Apply.

This will start a download process that will set the machine up (as far as installed packages are concerned) just like it used to be. Configurations need to be done manually, but atleast you get all your packages back.

This is also super handy if you’re duping identical systems. Remember that you can not do this to upgrade from one version to another. This is strictly for “Restoring” installed software packages from the same version of Ubuntu.

On Ubuntu Server (command line):

First we need to create a list of all the installed APT packages and configurations and save them:
sudo dpkg --get-selections > /tmp/dpkglist.txt
sudo debconf-get-selections > /tmp/debconfsel.txt

Copy the files from /tmp to your USB stick or save them somewhere else.

Now reinstall the OS, copy your backed up debconfsel.txt and dpkglist.txt file to your fresh system’s /tmp directory and execute the following:
sudo dselect update
sudo debconf-set-selections < /tmp/debconfsel.txt
sudo dpkg --set-selections < /tmp/dpkglist.txt
sudo apt-get -y update
sudo apt-get dselect-upgrade

Don’t worry! This method only adds and upgrades packages, it will not remove packages that do not exist in the list.

We also covered aptoncd program which basically does the same thing (it’s a extra install). Last but not least to make a costum Ubuntu install CD/DVD you want to check out our entry on Reconstructor.

FFmpeg commands for ipod video encoding…

datePosted on 12:04, September 25th, 2008 by Many Ayromlou

So I found out the hard way that the new ipod’s (with video out) can actually play 640×480 video and also figured out how to get iTunes to accept the encoded files (so that I could sync them with the device)…….here is the run down:

  • “TV-Out” mode – 1.5Mbit/s 640×480 H.264 videos
    • BIT_RATE <= 1500 kbps
    • 640×480
    • Up to 30 fps
    • “Low-Complexity” H.264 Baseline Profile
    • 1 reference frame
    • Up to H.264 level 3
    • 640 pixels maximum frame width
    • Sample Aspect Ratio (SAR) must be 1:1
    • UUID atom must exist containing the following hex data: 6B 68 40 F2 5F 24 4F C5 BA 39 A5 1B CF 03 23 F3….This allows you to add the video into iTunes. You need AtomicParsley for this which can be checked out from their subversion repository . See below for usage.
  1. For 1-pass encoding use:
  2. ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite

  3. For 2-pass encoding use:
  4. ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4 ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 10M -bufsize 10M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect WIDTH:HEIGHT OUTPUT.mp4AtomicParsley OUTPUT.mp4 --DeepScan --iPod-uuid 1200 --overWrite

  • “Standard” mode – 768kbit/s 320×240 H.264 videos
    • BIT_RATE <= 768 kbps
    • 320×240
    • Up to 30 fps
    • H.264 Baseline Profile up to level 1.3
  1. For 1-pass encoding use:
  2. ffmpeg -i INPUT -acodec libfaac -ab 128k -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me umh -subq 5 -trellis 1 -refs 5 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4

  3. For 2-pass encoding use:
  4. ffmpeg -i INPUT -an -pass 1 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions 0 -me epzs -subq 1 -trellis 0 -refs 1 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4 ffmpeg -i INPUT -acodec libfaac -ab 128k -pass 2 -s WIDTHxHEIGHT -vcodec libx264 -b BIT_RATE -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +mixed_refs -me umh -subq 5 -trellis 1 -refs 5 -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt BIT_RATE -maxrate 768k -bufsize 2M -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 13 -title SOME_TITLE OUTPUT.mp4

      ffmpeg command line quickies…..

      datePosted on 11:05, September 25th, 2008 by Many Ayromlou

      Here are a bunch of ffmpeg command lines that will do just about everything you need.

      1. Getting info from a video file
      2. ffmpeg -i video.avi

      3. Turn a sequence of images into video
      4. ffmpeg -f image2 -i image%d.jpg video.mpg

      5. Turn a video into a sequence of images
      6. ffmpeg -i video.mpg image%d.jpg

      7. Encode video for Ipod/IPhone
      8. ffmpeg -i source_video_file.avi -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv -trell 1 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X output_file.mp4

      9. Encode video for PSP
      10. ffmpeg -i source_video_file.avi -b 300 -s 320x240 -vcodec xvid -ab 32 -ar 24000 -acodec aac output_file.mp4ORffmpeg -i "OriginalFile.avi" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320x240 "OutputFile.mp4"

      11. Extract audio from a video file and save it as mp3 format
      12. ffmpeg -i source_video_file.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output_file.mp3

      13. Convert a wave file to mp3
      14. ffmpeg -i original_audio_file.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 output_file.mp3

      15. Convert a avi video to mpeg
      16. ffmpeg -i original_movie.avi output_file.mpg

      17. Convert a mpeg video to avi
      18. ffmpeg -i original_movie.mpg output_file.avi

      19. Convert a avi video to uncompressed animated gif
      20. ffmpeg -i original_movie.avi output_file.gif

      21. Add audio to an existing video-only file (mix audio and video)
      22. ffmpeg -i son.wav -i original_movie.avi output_file.mpg

      23. Convert a avi video to flv (flash video)
      24. ffmpeg -i original_movie.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv output_file.flv

      25. Convert a flv video to mpeg
      26. ffmpeg -i myFile.flv -ab 56 -ar 22050 -b 500 -s 320x240 myFile.mpg

      27. Convert a avi video to dv
      28. ffmpeg -i original_movie.avi -s ntsc -r ntsc -aspect 4:3 -ar 48000 -ac 2 output_file.dvORffmpeg -i original_movie.avi -target ntsc-dv output_file.dv

      29. Convert a avi video to mpeg specifically for DVD creation
      30. ffmpeg -i source_video.avi -target ntsc-dvd -ps 2000000000 -aspect 16:9 finale_video.mpeg

      31. Compress a avi video to Divx
      32. ffmpeg -i original_movie.avi -s 320x240 -vcodec msmpeg4v2 output_file.avi

      33. Convert a Ogg Theora video to mpeg specifically for DVD creation
      34. ffmpeg -i original_movie.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 output_file.mpg

      35. Convert a avi video to mpeg2 for SVCD creation
      36. ffmpeg -i original_movie.avi -target ntsc-svcd output_file.mpg

      37. Convert a avi video to mpeg2 for VCD creation
      38. ffmpeg -i original_movie.avi -target ntsc-vcd output_file.mpg

      Speed up Mac OS X Mail application…..

      datePosted on 17:07, September 22nd, 2008 by Many Ayromlou

      Does your OSX Mail app crawl when you start it. Well here is a quick tip to speed things up again. Just issue this command from a terminal window (make sure you’re not running Mail app first).

      sqlite3 ~/Library/Mail/Envelope\ Index vacuum;
      You should notice a bit of a performance improvement the next time you start the Mail application. This only works for the OSX mail.app, not other mail applications.

      How to make a ISO out of a DMG file under OSX

      datePosted on 17:01, September 22nd, 2008 by Many Ayromlou

      Here is a quick command line for all you OSX ppl. If you’re ever in need of turning/converting a .dmg file into a .iso use the following command line:

      hdiutil makehybrid -iso -o newfile.iso yourfilename.dmg

      Where newfile is the name of the iso you want, and yourfilename.dmg is the dmg. Have Fun……

      How to mount CD/DVD images from command line under Linux

      datePosted on 16:45, September 22nd, 2008 by Many Ayromlou

      Here are some quick CLI commands to get those CD/DVD images mounted under Linux (without having to burn them first).

      # ISO
      mount -t iso9660 -o loop,user file.iso /path/mount_directory

      # MDF
      mount imagen.mdf /path/mount_directory -o loop=/dev/loop0

      # NRG
      mount -o loop,offset=307200 imagen.nrg /path/mount_directory

      Basic APT commands

      datePosted on 16:37, September 22nd, 2008 by Many Ayromlou

      Okay, now for a bit of CLI goodness. Here is a quick list of basic apt commands.  Debian and most derivatives (Ubuntu) use these for package maintenance.
      #search
      apt-cache search packagename

      #package info
      apt-cache show packagename

      #clean
      sudo apt-get clean
      sudo apt-get autoclean #old packages

      #check
      apt-get check

      #get source code
      apt-get source packagename

      #get dep
      apt-get build-dep packagename

      #update/install/remove/upgrade
      sudo apt-get update
      sudo apt-get install packagename
      sudo apt-get remove packagename
      sudo apt-get upgrade
      sudo apt-get dist-upgrade

      Activate expanded Save and Print menu’s in OSX

      datePosted on 15:42, August 25th, 2008 by Many Ayromlou

      Here are two commands to activate the expanded Print and Save menu’s under OSX by default. You need to type these in a terminal window.

      1) For expanded Print menu
      defaults write -g PMPrintingExpandedStateForPrint -bool TRUE
      Logoff and back in again to activate. Reissue the command replacing TRUE with FALSE to turn expanded functionality off.

      2) For expanded Save menu
      defaults write -g NSNavPanelExpandedStateForSaveMode -bool TRUE
      Logoff and back in again to activate. Reissue the command replacing TRUE with FALSE to turn expanded functionality off.

      Enjoy and Have fun

      Quick command line trick to make your Leopard stacks look nice….

      datePosted on 15:30, August 25th, 2008 by Many Ayromlou

      Here is a quick command to make Leopard’s stacks behave nicer when you move your mouse across the icons. You can type these two commands in terminal to activate the feature:
      defaults write com.apple.dock mouse-over-hilte-stack -boolean YES
      killall Dock

      or alternatively if you don’t like the look, type the following in terminal to reset it back:
      defaults write com.apple.dock mouse-over-hilte-stack -boolean NO
      killall Dock

      123456PreviousNext