They're in the $http_proxy
, $https_proxy
and $ftp_proxy
environment variables. Also, $no_proxy
contains a comma-separated list of host patterns for which no proxy is used. For example:
http_proxy=http://proxy.example.com:3128/
no_proxy=localhost,127.0.0.1,*.example.com
Take a look at this related U&L Q&A titled: Where does uname get its information from?. Information such as the hostname persists within a data structure within the Linux kernel, while the system is running. During a system's boot this information can be reattained through a variety of mechanisms that is typically distro specific.
If you look at the man 2 uname
man page there's a data structure mentioned there:
struct utsname {
char sysname[]; /* Operating system name (e.g., "Linux") */
char nodename[]; /* Name within "some implementation-defined
network" */
char release[]; /* Operating system release (e.g., "2.6.28") */
char version[]; /* Operating system version */
char machine[]; /* Hardware identifier */
#ifdef _GNU_SOURCE
char domainname[]; /* NIS or YP domain name */
#endif
};
The 2nd element of that structure, nodename[]
is one place where the hostname is stored within the Linux kernel.
/proc
If you take a look at /proc/sys/kernel/hostname
, the hostname is exposed here as well. This is a virtual location, /proc
, but it does give you an alternative method for accessing the hostname. The system's domainname is here too, /proc/sys/kernel/domainname
.
NOTE: Of interest, these values are UTS namespace specific.
Example
$ sudo hostname
oldhost
$ sudo unshare --uts /bin/bash
$ sudo echo newhost > /proc/sys/kernel/hostname
$ hostname
newhost
$ exit
$ hostname
oldhost
Manipulating the hostname
On system's with Systemd you can use the cli tool hostnamectl
to get/set the hostname. This will change it permanently between reboots.
$ sudo hostnamectl set-hostname --static somehostname
You can also find out it's value through sysctl
:
$ sudo sysctl -a | grep kernel.hostname
kernel.hostname = myhostname
For Fedora releases, this ask.fedoraproject.org Q&A covers the topic pretty thoroughly, titled: Correctly setting the hostname - Fedora 20 on Amazon EC2.
Best Answer
The
route
or theip
utility get their information from a pseudo filesystem calledprocfs
. It is normally mounted under/proc
. There is a file called/proc/net/route
, where you can see the kernel's IP routing table. You can print the routing table withcat
instead, but the route utility formats the output human readable, because the IP adresses are stored in hex.That file is not just a normal file. It is always generated at exactly the moment when opening it with an attempt to read, as all files in the proc filesystem.
I you are interessted how that file is written, then you need to look at the kernel sources: That function outputs the routeing table. You see at line 2510, the header of the routing table is printed. The routing table appears to be mostly in the struct
fib_info
that is defined in the header file ip_fib.h, line 98.