Linked Questions

7 votes
3 answers
4k views

How can I determine the OS within .bash_profile? [duplicate]

On my main machine, a MacBook Pro, I have a .bash_profile file that I'd like to use unaltered on my Dreamhost linux machine. However, there's a few lines that are only applicable to macOS, such as ...
Chuck's user avatar
  • 497
1 vote
2 answers
160 views

Linux Operating System and Version, Regardless of Distibution [duplicate]

I would like to know a linux command that can tell me the operating system and version regardless of what distribution I am using as it seems different distributions have a different way of doing this....
rjbcollege's user avatar
1 vote
1 answer
137 views

What Linux distro is the following one? [duplicate]

I have to find out which Linux distribution is running on a server. From uname -a I have the following output: $ uname -a Linux lvmfacelifttap2b 3.10.0-514.6.1.el7.x86_64 #1 SMP SUn Dec 11 12:25:18 ...
Francesco Marchioni's user avatar
256 votes
21 answers
361k views

How can I get distribution name and version number in a simple shell script?

I'm working on a simple bash script that should be able to run on Ubuntu and CentOS distributions (support for Debian and Fedora/RHEL would be a plus) and I need to know the name and version of the ...
Alix Axel's user avatar
  • 2,969
138 votes
13 answers
158k views

How can I tell what version of Linux I'm using?

Often times I will ssh into a new client's box to make changes to their website configuration without knowing much about the server configuration. I have seen a few ways to get information about the ...
cwd's user avatar
  • 47k
29 votes
2 answers
13k views

On what Linux distributions can I rely on the presence of /etc/os-release?

I'm trying to find a way to determine Linux distribution name and version that would work on most (or ideally, all) modern distributions. I noticed that /etc/os-release contains the info I need on the ...
w128's user avatar
  • 393
15 votes
4 answers
18k views

How to inspect group permissions of a file

I would like to inspect group permissions of a file from a bash script. Specifically, I need to check whether a file has the group writeable bit on. That's it. Simple as that. However: I also need ...
mislav's user avatar
  • 401
5 votes
2 answers
652 views

porting install scripts : can rpm replace apt?

I have the following install script for ubuntu : #!/bin/bash sudo apt update sudo apt full-upgrade -y sudo apt install jq sudo apt autoclean -y sudo apt autoremove will the following work under ...
tatsu's user avatar
  • 306
1 vote
3 answers
4k views

Shell script testing through terminal simulation

I am developing a generic bash script which could be executed in different distro. I have only a CentOS virtual machine and I would be interested to test my script on a virtual terminal (online or ...
рüффп's user avatar
  • 1,767
1 vote
4 answers
1k views

How to get only one character after match in string (to determine RHEL version from rpm)

I have an open source shell/bash script for setting up and configuring hosting servers, and to install cloudflare I am pulling the version of RHEL using this command: RHEL_VERSION=$(rpm -q --qf "%{...
sMyles's user avatar
  • 2,775
1 vote
0 answers
47 views

How can I get my Linux distribution name and version using the command line ? [duplicate]

I have Linux Mint Version 7.1 Rebecca. What do I need to write in the command line in order to find this information. I tried uname -a , but I got informations about my computer name, Kernel Version ...
Abdul Al Hazred's user avatar