Commands not working.

New to Debian (Or Linux in general)? Ask your questions here!

Commands not working.

Postby hack3rcon » 2020-11-08 17:51

Hello,
When I write a command name then it don't worked and I should write the full command path:
Code: Select all
# mkfs.ext4
bash: mkfs.ext4: command not found

But below command worked:
Code: Select all
# /usr/sbin/mkfs.ext4

Why?

Thank you.
hack3rcon
 
Posts: 468
Joined: 2015-02-16 09:54

Re: Commands not working.

Postby sickpig » 2020-11-08 18:30

try fasting on moonless Sunday nights for a few moons to fix it.

Alternatively, make an effort to learn what PATH is in linux.

I donate blood to help vampires(sometimes on moonless nights), don't judge me :)
User avatar
sickpig
 
Posts: 589
Joined: 2019-01-23 10:34

Re: Commands not working.

Postby mm3100 » 2020-11-08 20:41

Check if that is in your path environmental variable https://wiki.debian.org/EnvironmentVariables.
To see what is in path of current user run
Code: Select all
echo $PATH

If /usr/sbin is not in there, then that is the culprit. Bash can't find command as it is not where it looks, and when you type full path to the file it knows where to look so it runs it.
mm3100
 
Posts: 16
Joined: 2020-10-21 21:39

Re: Commands not working.

Postby sunrat » 2020-11-08 23:11

Do you ever read or search anything before posting here? Read this:
viewtopic.php?f=16&t=142973
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3316
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Commands not working.

Postby NFT5 » 2020-11-09 03:33

Why bother searching when people keep solving the problems.

H.o.a.S. had a better solution.
User avatar
NFT5
 
Posts: 403
Joined: 2014-10-10 11:38
Location: Canberra, Australia

Re: Commands not working.

Postby RU55EL » 2020-11-09 17:31

User avatar
RU55EL
 
Posts: 497
Joined: 2014-04-07 03:42
Location: /home/russel

Re: Commands not working.

Postby KitchM » 2020-11-25 20:21

I agree with the original poster. There is something that does not make sense.

I am using Debian 10, with all latest updates, and Xfce 4.12.

When I type:
Code: Select all
echo $path

there is nothing returned (I get a blank line before new prompt). Trying:
sudo echo $path
does the same thing, and also if I log in as root.

So the question is "Where is the universal path setting kept?" I have looked into /etc/environment (which is empty), /ect/profile (which has:
Code: Select all
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH

), ~/.bash_profile (which is empty), /etc/logins.deg (which has similar to above:
Code: Select all
ENV_SUPATH   PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV_PATH   PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

), ???????? Running out of ideas.

So here's the problem. Normally we need do nothing special to set a path variable. Especially when using a proper .deb install. Therefore, in the very odd situation that one installs something that must have a manual setting added to the path command, there is no clearly defined location one should add it so that everyone has it forever.

Debian does not seem to address this in any definitive way.
KitchM
 
Posts: 109
Joined: 2019-06-11 18:11

Re: Commands not working.

Postby sunrat » 2020-11-25 20:31

Code: Select all
echo $PATH
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3316
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Commands not working.

Postby KitchM » 2020-11-25 21:05

Right, as noted above, it is empty.
KitchM
 
Posts: 109
Joined: 2019-06-11 18:11

Re: Commands not working.

Postby sunrat » 2020-11-25 23:23

KitchM wrote:Right, as noted above, it is empty.

You wrote
Code: Select all
echo $path

Which is wrong so it will be empty.

Code: Select all
echo $PATH

is totally different and should work. If it doesn't, your Debian is screwed.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3316
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Commands not working.

Postby sgosnell » 2020-11-26 01:27

Everything in Linux is case sensitive. At least everything I can think about offhand.
Take my advice, I'm not using it.
sgosnell
 
Posts: 904
Joined: 2011-03-14 01:49

Re: Commands not working.

Postby KitchM » 2020-11-26 02:30

Nope. Sunrat was correct. I missed that.
KitchM
 
Posts: 109
Joined: 2019-06-11 18:11

Re: Commands not working.

Postby KitchM » 2020-11-27 14:52

Of course, the question still remains unanswered. There must be some definitive answer.
KitchM
 
Posts: 109
Joined: 2019-06-11 18:11

Re: Commands not working.

Postby CwF » 2020-11-27 14:59

KitchM wrote:Of course, the question still remains unanswered. There must be some definitive answer.

I think it varies...
/etc/gconf/2/path
CwF
 
Posts: 806
Joined: 2018-06-20 15:16

Re: Commands not working.

Postby KitchM » 2020-11-27 21:46

But that doesn't help me directly. We want to know where to make the settings once and for all. Surely some expert knows.
KitchM
 
Posts: 109
Joined: 2019-06-11 18:11


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable