Posts Tagged ‘command line’

stop frustration: navigate among directories in command line easily

October 18, 2015 2 comments

Doing file manipulations in plain command line is a pain. That’s why I use Midnight Commander for tasks like copying, deleting, etc. But I’m still in pain :) If there are more than two directories that I want to work with, then even in MC I need to browse a lot and pass time with changing directories. Help!

I started to use two utilities that are very helpful. I found both of them in this thread.

This script was originally published in a Linux Gazette article in 2004. It’s available here.

Simply download the script and add these lines to your ~/.bashrc:

source ~/bin/
alias l="cd --"

“This is a scripts which defines a CD replacement function in order to keep, display and access history of visited directories. Normally the script will be sourced at the end of .bashrc.

cd —

Shows the history list of visited directories. The list shows the most recently visited names on the top.

This command is also assigned to ctrl+w.

cd -NUM

Changes the current directory with the one at position NUM in the history list. The directory is also moved from this position to the top of the list.” (source)

Since we need to use the command “cd --” a lot, I put a shorter alias on it called “l“, which stands for “list”.

This script is great but it has a drawback. It’s local in your current terminal. So if you open a new terminal and call the “cd --” command, the list is empty. I also wanted a global solution, that maintains a list among several terminal windows too. And this is how I found:

(2) autojump
Here is a nice blog post about it that I don’t want to quote completely just its abstract:

“autojump is a self-learning directory changer for navigating your filesystem. It works by maintaining a database of the directories you use the most from the command line. As soon as it’s installed it’ll start saving you time. Making easy to switch to the directories that are most important to you.” (source)

Install the package “autojump” and add these lines to the end of your ~/.bashrc:

# autojump
source /usr/share/autojump/autojump.bash

The official wiki is here.

Good to know:

  • To see the content of its database, use the command “j -s” (or “j --stat“).
  • TAB-completion is supported.

bittorrent client from the command line

January 14, 2014 Leave a comment


sudo apt-get install transmission-cli


$ transmission-cli  -w <download_dir>  <file|url|magnet>
Categories: bash Tags: ,

Start a VirtualBox operating system from the command line

November 9, 2012 Leave a comment

Under Linux I have a Windows 7 system in VirtualBox that I mainly use for Powerpoint. I have some more virtual operating systems too but I almost always launch Windows 7 only. Starting the GUI and clicking on the “Show” button to launch it quickly became a pain in the ass. How to launch my Windows 7 from the command line?


jabba@montreal:~$ VBoxManage list vms
"Windows 7 (old Office XP)" {80ce13dd-8a59-4d0a-94b5-9d8fa1130c62}
"Ubuntu 12.04" {e76ac634-1b73-42fc-85c0-f4f700edbe14}
"Office 2007" {43553e05-55b1-4095-8b66-8dcda275d9e2}
"Ubuntu 12.10 beta" {a22a2b9b-7a64-4345-8fb2-26d766989773}

jabba@montreal:~$ VBoxManage startvm "Office 2007"

I put it in a shell script called “office2007”. Done.

More info

Mount a truecrypt volume from the command line

September 9, 2012 Leave a comment
sudo truecrypt <truecrypt-file> <mount-point>

This will open a GUI window where you can specify the password.

If you want a full CLI solution, check out this page.

Update (20130617)
To unmount a volume, do this:

sudo truecrypt -d <path-to-truecrypt-file>
Categories: bash Tags: ,

View images in slideshow

July 27, 2012 Leave a comment

You have a collection of images and you want to view them in randomized order. In addition, you want to see them in a slideshow and you want to set the delay between the images.


feh -zsZFD 5 .

It will start displaying the images in the current folder. Installation: “sudo apt-get install feh“. More info: “man feh“.

Check the number of arguments in a bash script

October 30, 2011 Leave a comment

My bash script requires a parameter. How to check its presence?



if [ "$#" -ne 1 ]
      echo "Usage: $0 <input_file>"
      exit 1
# else
# work with "$1" ...
Categories: bash Tags: ,

Get every new post delivered to your Inbox.

Join 85 other followers