The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 87,187β€…    Votes:  10β€…
Tag : command-line  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/1037165
Title: How to run a file in a different directory
ID: /2018/05/16/How-to-run-a-file-in-a-different-directory
Created: May 16, 2018    Edited:  May 24, 2018
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


No you don’t need to use:

cd home/directoryA/directoryB/directoryC/DirectoryD
./somefileΒ 

You can simply run the command by prefixing it with its path:

/home/directoryA/directoryB/directoryC/DirectoryD/somefile

Because you are already in the /home/directoryA you can use the current directory shortcut . and run the command like this:

./directoryB/directoryC/DirectoryD/somefile

I noticed OP has expanded scope via comments under other answers. Here is some additional information:

⇧ Nautilus not showing mounted drives in side bar Very high fan speed on Ubuntu 18.04  β‡©