How to detect which program will be run? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
Your system has 2 versions of the same utility installed, both which have the same filename.
How would you find out where the utility you would run by default is located?

If the utility's file name is "foo", type which foo

You'are looking for which command
which - shows the full path of (shell) commands.
Let's say you have perl installed in /usr/bin/perl and /usr/local/bin/perl and if the default path is the second one then
$ which perl
/usr/bin/local/perl

Check the $PATH.
echo $PATH
The first is started default.
or
which

Similar to which , whence gives you whence command from Korn Shell tells how a name would be interpreted by the shell: it detects commands and aliases, and searches your path.
whence {executable-you-are-looking-for}
and also in linux, just typing name & hitting tab will show list of available versions with which you can run.

Related

Bash 'export environment variable [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
New kali linux terminal starts with a bash error:
bash: ‘export: command not found
I think I messed up my bash environment when workin on a jsnode installation and do not know how to fix it.
I think I need to fix my environment variable, but do not know where that is in Kali. Appreciate any help.
There seems to be a typo in a command. It should be export but instead it's ‘export. The errant character is Unicode U+2018, LEFT SINGLE QUOTATION MARK.
The first place to look is your .bashrc, then depending on your OS, .profile or .bash_profile, then any number of other Bash startup scripts that might get called like .bash_functions, or higher up the chain like /etc/bash.bashrc.

Could not understand the output of !! in Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
When I added !! in the end of echo command, it gave some output but I am unable to understand the output of the command. What does !! actually do in Linux?
!! Refer to the previous command. This is a synonym for `!-1'
Assuming your example is something like this:
echo hello!!
The answer depends on what shell you are using. Assuming bash merely because this is what I usually use:
From bash man page:
!! Refer to the previous command. This is a synonym for `!-1'.
This means that the command above will print hello followed by the previous command line from shell command history.

Why does the default shell in OS X 10 look differently than that in Linux (Mint, Lubuntu...)? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
To clarify, when entering the default shell in OS X it appears as:
pcname:~ username$
and changing directories appears as:
pcname:myFolder~ username$
however, in my experience with linux distros, the shell appears as:
username#pcname:~$
what is the purpose for the differences in syntax?
What I do is the following: On the system that has the promt the way I want it, I type:
echo $PS1
I copy the result, say, \u#\h \w\a \$ and then edit the ~/.bashrc on the system that I want to use with the line:
export PS1="\u#\h \w\a \$ "
And then I get the same prompt on that system as well.
If you want to get creative, have a look here

How to add alternative to program that located in /usr/bin [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Is it possible to substitute binary with same name alternative? I have /usr/bin/qtcreator
I want to use alternative version but /usr/bin/qtcreator is binary but not alternative.
What the way I should do this?
You could place your new qtcreator at /usr/local/bin/qtcreator, that location should have preference over /usr/bin.
You can check the possible locations for binaries and the order is which they are searched with echo $PATH and you can check which binary will be called with which qtcreator
In Bash:
$ alias qtcreator="/usr/local/bin/qtcreator"
or make sure the path to desired binary is mentioned before the undesired path in $PATH (... as mentioned by others).

Linux commands, what do they mean? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am just getting started with Linux, could someone please explain these commands? (ls), (ls -l), (whoami), (pwd), (cal 2013) and (man cal). Thanks.
The only command you have to know, is "man". Type "man ls", and you'll get an answer about what "ls" does, and so on.
man is the very first command a Unix/Linux beginner needs to know. It means manual and gives access to the reference manual (or online help) of the command specified on the same line:
man cal
displays the manual of the cal command.
From there, you can type
man intro
to get a list with a short summary of all available commands.
Sometimes, instead of the manual of the command you requested, you'll get the manual of bash, which is the program that interprets all the commands you type. This means that your requested command is not a simple command like cal but a special command directly implemented in the bash itself. In that case, the description of your requested command is buried in the huge manual of bash.

Resources