Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've two partitions on my windows OS and I've installed Ubuntu within windows.

Partition 1 : Windows and Linux OS

Partition 2 : Common storage files (called under the name New Volume)

I am looking at running a shell script that is placed in partition 2. I am able to run the shell when it is placed in the /home/... hierarchy of Ubuntu but I am unable to do so when it is placed in partition 2 which is being treated as an external disk by the OS.

I just want to know how can I actually change my working directory to a directory that is placed on an external disk which is mounted. What is the cd command to make the terminal look into a directory of the mounted disk?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I'm not quite sure what exactly is your problem, since you're mentioning cd yourself, but just to confirm: to change a working directory in terminal, you use cd command:

cd /path/to/directory

External disks are usually mounted under /media, so to get to your disk, you can type

cd /media/

then press Tab, which will show you files and sub-directories in that directory. Type a few first letters of the sub-directory you need and press Tab again. When the full path is entered, press Enter. Easy.

To run a shell script from that disk, the easiest would be to use something like

cd /media/MyDriveName/somedir/somesubdir
bash scriptname.sh

Note that you're invoking bash and passing it the name of the script, instead of running the script directly, like this:

cd /media/MyDriveName/somedir/somesubdir
./scriptname.sh

the first version don't need the executable bit to be set on the script file.

share|improve this answer
1  
The reason that the execute bit is important is that if the partition is FAT or NTFS ( the only two disk based filesystems Windows understands ), it does not support permissions, so you can't set the execute bit. –  psusi Sep 27 '11 at 17:44

Please give us the result of this (press ctrl + alt + t to open a terminal ) terminal command:

mount 

to copy the result please select te command result text from terminal then copy, then paste here...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.