LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-01-2014, 03:03 AM   #1
mitter1989
Member
 
Registered: Sep 2013
Posts: 47

Rep: Reputation: Disabled
Question autocomplete of bash is not working for some commands


Hi Folks,

I am using RHEL 5.10 x64_64 OS.


Some commands are not autocompleting, Its working fine while giving complete path to command..

here is one example :


[root@ir ir]# ifconfig
bash: ifconfig: command not found
[root@ir ir]# locate ifconfig
/sbin/ifconfig
/usr/share/man/de/man8/ifconfig.8.gz
/usr/share/man/fr/man8/ifconfig.8.gz
/usr/share/man/man8/ifconfig.8.gz
/usr/share/man/pt/man8/ifconfig.8.gz
[root@ir ir]# which ifconfig
/usr/bin/which: no ifconfig in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin:/opt/dell/srvadmin/bin:/opt/dell/srvadmin/sbin)
[root@ir ir]# ll /sbin/ifconfig
-rwxr-xr-x 1 root root 70312 Oct 4 2013 /sbin/ifconfig


[root@ir ir]# /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr D0:67:E5:EA:CB:E3
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:4168057176 errors:0 dropped:0 overruns:0 frame:0
TX packets:4560163524 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:844821791829 (786.8 GiB) TX bytes:1903045436174 (1.7 TiB)
Interrupt:114 Memory:d6000000-d6012800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:11322214641 errors:0 dropped:0 overruns:0 frame:0
TX packets:11322214641 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:16933406088897 (15.4 TiB) TX bytes:16933406088897 (15.4 TiB)


Please guide me to solve this issue.

Thanks in advance.
 
Old 05-01-2014, 03:47 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
that means the PATH variable for root is corrupted (altered, it does not contain the default paths, or at least /sbin is missing)
 
1 members found this post helpful.
Old 05-01-2014, 04:35 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,243

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
I believe pan64 is correct , but thought I would just raise a point about terminology based on the original question.

You have said:
Quote:
autocomplete of bash is not working for some commands
Now my understanding is that 'autocompletion' is when you type in a portion of the command you wish and then by pressing the tab key twice in quick succession you are either presented
with the exact command or a list of commands if there is more than one.

So on my machine:
Code:
$ if<tab><tab>
if        ifcfg     ifnames   ifrename  ifstat
$ if
However, if you type in the command and press enter, then your PATH is searched to find the command you are looking for and an error returned if not found or the output of the command if it is found.
This second version would be what you were referring to ... I believe
 
1 members found this post helpful.
Old 05-01-2014, 05:44 AM   #4
mitter1989
Member
 
Registered: Sep 2013
Posts: 47

Original Poster
Rep: Reputation: Disabled
Thanks pan64 & grail...

I have added below line into this file /etc/sudoers and now it is working fine...

Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
 
Old 05-01-2014, 05:50 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
glad to help you.
(if you really want to say thanks just press yes)
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash autocomplete bug eeluve Linux - Software 3 12-02-2013 03:24 PM
[SOLVED] bash autocomplete space after match suicidaleggroll Linux - Newbie 2 08-07-2012 05:59 PM
Running bash but common bash commands not working michellepace Linux - Newbie 11 07-17-2010 10:19 AM
working on bash: wante to no what a combinasion of commands(grep, sed) do ? coolloo_djack Programming 4 03-12-2010 04:24 AM
Customizing Bash Autocomplete ramzak3k Linux - Software 2 01-07-2009 08:57 PM


All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration