Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

installed "net-tools" but still no "ifconfig"

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
syscon
Posts: 13
Joined: 2020-10-24 18:35

installed "net-tools" but still no "ifconfig"

#1 Post by syscon »

I just installed Debian Stable
I was looking to use "ifconfig" instead of "ip a" and according to instructions from various web-pages all I need to do is to install "net-tools" in order for to use "ifconfig".
So I installed "net-tools" but "ifconfig" is not working: command not found.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: installed "net-tools" but still no "ifconfig"

#2 Post by Head_on_a_Stick »

http://forums.debian.net/viewtopic.php?f=16&t=142973

EDIT: to clarify:

Code: Select all

~$ ifconfig
oksh: ifconfig: not found
127~$ sudo which ifconfig
/usr/sbin/ifconfig
~$ /usr/sbin/ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 11782  bytes 1386305 (1.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11782  bytes 1386305 (1.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.176  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::2279:18ff:fee7:4069  prefixlen 64  scopeid 0x20<link>
        ether 20:79:18:e7:40:69  txqueuelen 1000  (Ethernet)
        RX packets 344694  bytes 456190746 (435.0 MiB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 104238  bytes 16408037 (15.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

~$
So add /usr/sbin & /sbin to your user's $PATH.

For example:

Code: Select all

echo 'export PATH="/sbin:/usr/sbin:$PATH"' >> ~/.xsessionrc
Or just call the full path to the command.
Last edited by Head_on_a_Stick on 2020-10-24 19:05, edited 1 time in total.
Reason: Added clarification.
deadbang

syscon
Posts: 13
Joined: 2020-10-24 18:35

Re: installed "net-tools" but still no "ifconfig"

#3 Post by syscon »

Thank you for quick reply. Yes, it worked.

syscon
Posts: 13
Joined: 2020-10-24 18:35

Re: installed "net-tools" but still no "ifconfig"

#4 Post by syscon »

The command "ifconfig" now works from command line at the terminal but if I login over "ssh", "ifconfig" is not working only "/sbin/ifconfig"

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: installed "net-tools" but still no "ifconfig"

#5 Post by Head_on_a_Stick »

~/.xsessionrc only applies to X sessions (hence the name), for SSH you will need to edit $PATH via ~/.profile

To prevent $PATH being bloated out by multiple entries steal Arch's append_path() function and add this to the end of ~/.profile:

Code: Select all

append_path () {
    case ":$PATH:" in
        *:"$1":*)
            ;;
        *)
            PATH="${PATH:+$PATH:}$1"
    esac
}
append_path /usr/sbin
append_path /sbin
export PATH
EDIT: or just use a simple alias in your shell configuration file (~/.bashrc if you're using bash):

Code: Select all

alias ifconfig=/sbin/ifconfig
deadbang

Post Reply