100

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 system you're using, but are there some standard commands to tell me what version of Unix/Linux I'm on and basic system information (like if it is a 64-bit system or not), and that sort of thing?

Basically, if you just logged into a box and didn't know anything about it, what things would you check out and what commands would you use to do it?

10 Answers 10

97

If I need to know what it is say Linux/Unix , 32/64 bit

uname -a 

This would give me almost all information that I need,

If I further need to know what release it is say (Centos 5.4, or 5.5 or 5.6) on a Linux box I would further check the file /etc/issue to see its release info ( or for Debian / Ubuntu /etc/lsb-release )

Alternative way is to use the lsb_release utility:

lsb_release -a

Or do a rpm -qa | grep centos-release or redhat-release for RHEL derived systems

  • 1
    In 2016 it does not seem like lsb_release works any longer with modern distros. I tested the command on Amazon Linux AMI release 2016.03 and CentOS Linux 7 and it was not found. It seems like ls cat /etc/os-release is the best solution currently with uname -a somewhat usable if a bit opaque (e.g. Amazon Linux AMI release 2016.03 vs. Linux ip-x-x-x-x 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 1 22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux) – runamok Sep 19 '16 at 19:00
  • Well Done (y) :) – Sam Jun 9 '17 at 12:10
31

Use the following commands to get more details:

  1. cat /etc/*release*
  2. uname -a
  • 2
    i like this answer better than the accepted one – the0ther Sep 22 '17 at 17:08
5

You should look into the uname command.

I have to deal with a large parc of heterogenous machines. uname -a is usually my first reflex when I log in.

4

Type in the command line:

uname -a

That'll give you all the information you seek.

Try also:

man uname to restrict the information

3

Use cat /proc/version

Result:

Linux version 3.14.27-100.fc19.x86_64 (mockbuild@bkernel02.phx2.fedoraproject.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC) ) #1 SMP Wed Dec 17 19:36:34 UTC 2014

I believe this works for most distros, and provides a more concise answer than cat /etc/*release* and more complete answer than uname -a. However, use of /proc for things other than processes is now eschewed, so maybe it'll disappear someday.

  • This worked for me – user919426 Apr 1 '18 at 19:50
2

Centos 5 using file in /etc/redhat-release

2

To combine some ideas here:

cat /etc/*_version /etc/*-release && uname -a

Should get you want you need on any distribution.

1

For the Alpine distribution:

cat /etc/alpine-release
3.5.2
1

whatami by Remy Evard at Argonne National Lab. Install and run using these commands:

$ wget https://raw.githubusercontent.com/open-mpi/mtt/master/client/whatami/whatami && chmod a+x whatami
Resolving raw.githubusercontent.com... 151.101.116.133
Connecting to raw.githubusercontent.com|151.101.116.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24434 (24K) [text/plain]
Saving to: 'whatami'

whatami                                           100%[============================================================================================================>]  23.86K  --.-KB/s    in 0.02s   

2018-08-15 18:54:42 (1.49 MB/s) - 'whatami' saved [24434/24434]

$ ./whatami
darwin-macosx_10.11-x86_64
  • 1
    You might want to link to that tool or explain how you installed it, it's not on by default. – slm Aug 14 '18 at 16:12
0

For CentOs

$ cat /etc/centos-release
SHMZ release 6.6 (Final)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.