150 votes
Accepted

Setting PATH variable in /etc/environment vs .profile

Summary: If you want to add a path (e.g. /your/additional/path) to your PATH variable for your current user only and not for all users of your computer, you normally put it at the end of ~/.profile ...
Byte Commander's user avatar
  • 108k
78 votes
Accepted

Where is WSL located on my computer?

If I read your post literally, there may be a few different questions there: Where is your WSL Ubuntu instance installed on your machine? (Presumably based on the first question) How do I access ...
NotTheDr01ds's user avatar
  • 18.1k
56 votes
Accepted

Why isn't tilde recognised as home folder in this case?

Quoting, even with double quotes, suppresses tilde expansion. ~ can be used as a path to your home directory in contexts where tilde expansion is performed. ~ is not like . or ... There aren't ...
Eliah Kagan's user avatar
54 votes

Variable path issue : conda command not found

Try adding below line to your .bashrc file export PATH=~/anaconda3/bin:$PATH then try: conda --version to see version
dgamer's user avatar
  • 641
51 votes

Why doesn’t `mv file /dir` move the file to a subdirectory of the current working directory?

Provided a directory with this name doesn’t exist, you renamed the file to openvpn located in your root directory /. To revert this, run: sudo mv /openvpn /etc/MyFile.conf If the directory did exist ...
dessert's user avatar
  • 40.1k
48 votes

Setting PATH variable in /etc/environment vs .profile

This answer is mainly about the order in which environment variables like PATH are assigned when specified in different configuration files. I do also cover where you should usually set them, but the ...
Eliah Kagan's user avatar
45 votes
Accepted

When writing a bash script, how do I get the absolute path of the location of the current file?

You can get the full path like: realpath "$0" And as pointed out by Serg you can use dirname to strip the filename like this dirname "$(realpath $0)" or even better to prevent awkward quoting and ...
Zanna's user avatar
  • 70.5k
44 votes

How to put executable to /usr/local/bin?

Just copy it to /usr/local/bin. sudo cp /path/to/profit /usr/local/bin
Gunnar Hjalmarsson's user avatar
35 votes

How to put executable to /usr/local/bin?

There are various things to consider; just for completeness: First of all, you should make sure that this executable has in fact the required permissions. sudo chmod a+rx /path/to/profit (for ...
GhostCat's user avatar
  • 2,105
27 votes

Show full path to file in terminal

Use readlink with -e flag. Not only it gives you full path to file, it also presents real path of the symlinks $ readlink -e ./out.txt ...
Sergiy Kolodyazhnyy's user avatar
24 votes
Accepted

Is ./ (dot slash) a command?

./ is not a command. The command is ./truecrypt-7.2-setup-x86. Your shell and programs like sudo will treat a command as a pathname when it contains at least one / character. Since . represents ...
Eliah Kagan's user avatar
24 votes
Accepted

Where are gnome extensions preferences stored?

Schema Files The default extension settings are located in an *.xml file in the following directory if you installed the extension globally: /usr/share/gnome-shell/extensions/<extension directory&...
Enterprise's user avatar
  • 12.4k
22 votes
Accepted

After installing youtube-dl on Ubuntu 21.10 with the instructions on github many applications, including default text editor, broke

Here is a theory: Before you ran the first command, /usr/local/bin/youtube-dl already existed and was a symlink to /usr/bin/firejail. Probably from some previous installation. The curl ... -o /usr/...
jpa's user avatar
  • 1,200
21 votes

Is ./ (dot slash) a command?

The ./ part of the command is saying "Look in the current directory, and execute the command 'truecrypt-7.2-setup-x86' from here". You need to run this command from the directory where you unpacked ...
Charles Green's user avatar
21 votes
Accepted

How can I add ~/.local/bin to my PATH?

If you make a ~/bin folder in your home folder, it'll already be in your default path. No need to modify anything, or add folders to a hidden .local folder. Create the ~/bin folder, log out, log back ...
heynnema's user avatar
  • 70.7k
20 votes
Accepted

Windows filepath converted to Linux filepath

There would be a way to do both replacements at once using sed, but it's not necessary. Here's how I would solve this problem: Put filenames in array Iterate over array filenames=( 'C:\Users\abcd\...
wjandrea's user avatar
  • 14.2k
19 votes
Accepted

How to set LD_LIBRARY_PATH permanently?

You just need to add the following line to your ~/.bashrc file: LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/lclab/installed/boost/boost_1_65_0:/home/lclab/installed/rdkit/rdkit-Release_2016_03_1/lib:/...
dessert's user avatar
  • 40.1k
18 votes

How to put executable to /usr/local/bin?

step 1: chmod +x /path/to/profit step 2: sudo cp /path/to/profit /usr/local/bin/ step 3: profit
Isaac Hanson's user avatar
18 votes
Accepted

How to find the path of a specific application (Google Chrome)?

If you have installed the stable version of Google Chrome, run the following commands to find its location whereis google-chrome-stable or which google-chrome-stable
pomsky's user avatar
  • 68.6k
17 votes
Accepted

PATH=$PATH:`pwd` - What happens when this command is executed?

If you execute the command in your question, you should get an error message: $ PATH =$PATH:`pwd` bash: PATH: command not found If the space is a typo, and you actually run this: PATH=$PATH:`pwd` ...
terdon's user avatar
  • 101k
17 votes
Accepted

How to create an alias for a "cat" file usable in a path

You could use a named pipe: mkfifo /path/myfile cat file1 file2 > /path/myfile & Here, either the cat command has to be sent to the background, or you can run tool_x in another terminal, as ...
muru's user avatar
  • 198k
16 votes
Accepted

Pytest is in PATH but not found

To avoid searching your PATH every time an executable command is called, bash saves previously used commands in a lookup table, or hash. If you subsequently move the executable or install another ...
steeldriver's user avatar
16 votes

How to set anaconda as a default python?

I have the same setup as you desire. In my case the anaconda installer added an entry in my ~/.bashrc file. I don't know why yours did not. So to get to do what you want, add this to your ~/.bashrc ...
George Udosen's user avatar
16 votes
Accepted

How to know the path of a particular software?

Find the path of an executable Best way type executable Check out this question to learn more about how type is better. (Thanks, comments!) Other ways whereis executable which executable Those ...
Biggybi's user avatar
  • 585
12 votes

How to find python installation directory on Ubuntu

Here is a simple way, run in terminal: type -a python or type -a python3
Dzmitry Koniukhau's user avatar
12 votes

How can I sanitize or escape absolute paths returned by realpath or readlink?

How to do this correctly First of all, always quote your variables. What you are trying to do works fine if you quote it properly: $ pwd /home/terdon/foo/\e[92mM@r|< +'|'|_e|\|\|0rth [`-_-"] $ ls ...
terdon's user avatar
  • 101k
11 votes

How to find full path of device I've connected?

For serial devices I tend to look in /dev/serial/by-id. For disks I use /dev/disk/by-label. If you use ls -l on those they'll show you where they're linked to.
DaveP's user avatar
  • 111
11 votes

Variable path issue : conda command not found

Lets fix it like this: Move it out of /root/ with: sudo mv /root/anaconda3 /home/$USER Add this to /home/ahmed/.bashrcplease don't use 'sudo' here simple do nano /home/$USER/.bashrc: # Anaconda3 ...
George Udosen's user avatar
10 votes
Accepted

Having a list of paths, how can I filter out subdirectories of previously mentioned paths?

AWK $ awk -F '/' 'oldstr && NR>1{ if($0!~oldstr"/"){print $0;oldstr=$0}};NR == 1{print $0;oldstr=$0}' paths.txt /proc /run /tmp /home/bytecommander/ramdisk /var/zomg /var/zomgkthx /zomg /...
Sergiy Kolodyazhnyy's user avatar
10 votes
Accepted

Show full path to file in terminal

I found it: sudo apt-get install realpath Then: realpath MY_FILE
Karl Morrison's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible