Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a java program first time on Linux.

This is where my program is located:

Desktop> APCS (folder)> Chapter5 (folder) >

I know that to compile I have to type javac and to run "java Test".

Before that, I have to type cd Desktop, cd APCS, cd Chapter5.

Is there any short way to navigate to

share|improve this question
up vote 4 down vote accepted

Two ways to shorten the time it takes to go down multiple directories:

  • You can go down multiple levels at a time, so you can type cd Desktop/APCS/Chapter5
  • Pressing TAB while typing a directory or file name will automatically complete the rest of the filename for you. So if you are in your home folder and need to cd to your desktop, you can type the first two or three letters of Desktop and press tab to automatically complete it

If you need to compile and run your program a lot, make a shell script on your desktop or somewhere else with:

javac ~/Desktop/APCS/Chapter5/
java ~/Desktop/APCS/Chapter5/Test
share|improve this answer

You can just use the full path.

Try using these commands:

javac ~/Desktop/APCS/Chapter5/
java ~/Desktop/APCS/Chapter5/Test

(This assumes the compiled output is in a filename named Test in the same directory)

Ultimately, though, you'll have to retype the path and change it accordingly for when the path changes.

share|improve this answer

Your Answer


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.