Is "/etc/issue" common for all Linux distributions?
Solution 1
Yes this is a standard file across distributions. It's standard on most distros, Fedora/CentOS/RHEL/Debian/Ubuntu etc.
You can read more about it with a man issue
or its associated file /etc/issue.net
. You can see the issue.net man page for more details and how to include macros into both files there as well.
You can also read more about it on the Linux From Scratch project, Customizing your Logon with /etc/issue.
Solution 2
In addition to slm's answer, it's worth remembering that anyone (with root access) can edit the content of /etc/issue
. Some organisations may do so to present pre-login warnings or disclaimers, and others may remove all identification of the distribution for security reasons (it doesn't matter how effective either of these measures are).
Therefore, while /etc/issue may exist almost all the time, the content is not necessarily suitable for detecting the OS (as you put it, or more likely, the Linux distribution).
Solution 3
@EightBitTony's answer is correct. Also it does not exist by default on fedora 23.
Do not rely on it for identifying random systems. I'd use /etc/system-release
or /etc/os-release
but not sure how much universal that is.
Reading a bit /etc/os-release
comes with systemd
so I guess won't work with archaic distros (or any that hate systemd
). Could not find authoritative info about /etc/system-release
. I guess one has to check many files if compatibility is important. Or use /etc/os-release
if edge cases are not important.
Related videos on Youtube
Rahul Patil
Just a Simple guy with Linux experience.. I simply like scripting, coding and helping others is a fulfilling way to stay up to date and give something back to the community and the web from which I learned so much. Currently Working as Big Data DevOps Engineer. You reach me at : tr a-z@. n-za-m.@ <<< ybtvaenuhy90.tznvy@pbz Linkedin GitHub
Updated on September 18, 2022Comments
-
Rahul Patil over 1 year
I'm trying to Create OS detect portable function in bash script,
So I just want to know, the file
"/etc/issue"
is common for all Linux Flavors ?-
ninjalj almost 11 yearsIn modern distros, there is usually an
/etc/*-release
file with some info. -
EightBitTony almost 11 years
uname
may offer some information too, not sure how accurate a finger print it is. Don't forget that anyone can modify pretty much anything in a Linux install to obscure the info you want, it'll only find stuff on unmodified installs. -
Rahul Patil almost 11 yearsYes you are right.., I have selected different option, it will check package manager like
yum
orapt-get
then it will install packages based on this. -
Rahul Patil almost 11 yearsstill I'm working on it check link paste.ubuntu.com/5911213
-
-
blackappy over 6 yearsIs there a Windows equivalent to /etc/issue?
-
Admin almost 2 yearsMore information about
/etc/os-release
: freedesktop.org/software/systemd/man/os-release.html