Archive for the 'Command Line' Category

Archive all files with a given extension

Find all files with ‘.log’ extention and make an bzip archive


find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2

Configure IP Address

Configure IP Address using the ifconfig command


ifconfig eth0 192.168.1.1 netmask 255.255.255.0

Decompress Bzip2 File

Decompress a compressed tar archive in bzip2


tar -xvfj archive.tar.bz2tar -xvfj archive.tar.bz2

Create a Bzip2 File

create a tarball compressed into bzip2


tar -cvfj archive.tar.bz2 dir

Encrypt/Decrypt using PGP

Usie this command to encrypt and decrypt a file using PGP in linux.


gpg -c file
gpg -o file -d file.gpg (output to file)

Encrypt/Decrypt File using OpenSSL in Linux

Works on OS X, Linux, anywhere with OpenSSL installed:

To encrypt a file:


openssl des3 -salt -in infile.txt -out encryptedfile.txt

To decrypt the file:


openssl des3 -d -salt -in encryptedfile.txt -out normalfile.txt

Delete all \n chars in a file…

Delete all \n chars in a file…


tr -d "\n" 

Extract to Given Folder

extract a tarball into / tmp


tar -xvf archive.tar -C /tmp

Add Audio to a Video File Using ffmpeg

FFMPEG command to mix an audio file with a video file to create a final video.


ffmpeg -vcodec flv -qscale 9.5 -r 25 -ar 22050 -ab 32k -s 320x240 -i 1.mp3 -i Meta.ogv final.flv

Linux Command to Convert a Video to PSP’s MP4 Format

Linux command to convert a video file to PSP format using ffmpeg. After converting, copy the OutputFile to the video folder in your PSP.


ffmpeg -i "OriginalFile.avi" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320x240 "OutputFile.mp4"