Showing posts with label command line. Show all posts
Showing posts with label command line. Show all posts

07 September, 2013

Youtube Downloader from the Linux Command Line

God Bless YouTube!

Where else can you find entertainment, education and countless kitty/puppy videos?

But what if you wish to preserve the video, downloading for archive purposes or access it from Internet-incapable devices?

Start by installing youtube-dl:

# apt-get install youtube-dl


Next, navigate to your desired video and copy the URL; e.g.

http://www.youtube.com/watch?v=Wtfo43yV8rA

Lastly, execute youtube-dl with specified URL:


$ youtube-dl http://www.youtube.com/watch?v=Wtfo43yV8rA


The result will be a Macromedia Flash Video file.  Convert to your preferred file format using Ffmeg and Bob's Your Uncle.

12 September, 2010

Journey of Android Development -- Running Apps vi Adb Command Line

Ok, so you're developing the next killer app for Android. If you're anything like me, and pray you aren't, you may find you want to start your app from your development machine via the emulator.

I posted how you can install, reinstall, and uninstall your app in previous posts. This post builds on that.

Issuing an 'adb shell' command essentially executes a shell command on the emulator. If you issue a command you'll execute the command rather than enter an interactive shell.

The Activity/Intent Manager/Messenger tool allows you to start your activity through the adb command line.

The trick is to define the command arguments properly, which is done by pulling relevant information from your AndroidManifest.xml file. You need to specify the proper action and component in your command line, extracted from your Android Manifest.

Given the following AndroidManifest.xml file:

user@debian:~/Buttons$ cat -n AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 package="com.example.buttons"
4 android:versionCode="1"
5 android:versionName="1.0">
6 <application android:label="@string/app_name">
7 <activity android:name=".Buttons"
8 android:label="@string/app_name">
9 <intent-filter>
10 <action android:name="android.intent.action.MAIN" />
11 <category android:name="android.intent.category.LAUNCHER" />
12 </intent-filter>
13 </activity>
14 </application>
15 </manifest>


The action is defined in line 10, the component defined as lines 3+7 respectively.

You can start the 'Buttons' activity by specifying the following command:

adb shell am start -a android.intent.action.MAIN -n com.example.buttons/com.example.buttons.Buttons

24 May, 2010

WindowsXp Search Command Line

I've recently needed to search a suite of Windows Xp machines in search of files with particular extensions. Since I intended on piping the results to a text file for review Windows Explorer wouldn't suit my needs. The 'find' command wasn't the proper tool for the job either as it is used for finding text strings in files.

I found good-ole 'dir' was the man for the job.


c:\ dir c:\ *.exe /s


This command will recursively search from C: for files matching '*.exe'.

That'll do donkey, that'll do.

14 April, 2009

VirtualBox Command Line Commands

Assuming you have created a virtual machine called WinXp can start the machine in a headless mode (non-gui) by invoking the command:


VBoxHeadless --startvm WinXp


To shutdown the virtual machine, you can invoke the command

VBoxManage controlvm WinXp poweroff

Creating CD-ROM ISO Image - the cowboy way

I've been investigating installation of Xen for work, in the process I thought it would be useful to rather than run around with the WinXp installation disk to create an ISO image of it for installation purposes.

The utility 'dd' suits the bill, you have to first interface directly with the device driver so the cd cannot be mounted. If the cd is mounted, I'd first recommend finding the device driver reference by issuing the mount command:



$ mount
. . .
/dev/scd0 on /media/cdrom0 . . . ..
$ umount /media/cdrom0


As you can see, this was an external cdrom on /dev/scd0.

Next, issue the appropriate dd command:



$ dd if=/dev/scd0 of=WinXpProInstall.iso

The arguments if=/dev/scd0 tells dd to read from the device in raw format, of=WinXpInstall.iso specifies the output file.

You'll be left with an exact image of what resides on the cd, use at your leisure.

06 April, 2009

VmRun Command

I've been recently tailoring a WinXp virtual machine to accelerate the OS initialization. To measure the impacts I've created a script that repeatedly times the starting of the VM. In particular, I'm measuring how long it takes between initiated startup and the time it takes before I can ping the virtual machine.

The first challenge was to decode the vmware-cmd (now vmrun) syntax. The following is an example of how you can start a virtual machine.


vmrun -T 127.0.0.1 -h 'https://127.0.0.1:8333/sdk' -u vmadmin -p 'vmadminpassword' start "[standard] JltvWinXp/JltvWinXp.vmx"