Linux Commands - System commands

Reference Linux

Share

Following are some of the important system commands in Linux.

uname

This will display the system information.

In the following example we are getting the name of the system.

$ uname
Linux

uname -o

This will display the OS information.

In the following example we are getting the OS information.

$ uname -o
GNU/Linux

uname -m

This will display the machine hardware information.

In the following example we are getting the machine hardware information.

$ uname -m
x86_64

uname -v

This will display the kernel release information.

In the following example we are getting the OS kernel information.

$ uname -v
#21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018

uname -n

This will display the network node hostname.

In the following example we are getting the network node hostname.

$ uname -n
yusufshakeel-ubuntu

uname -a

This will display all the system related information.

In the following example we are getting all the system information.

$ uname -a
Linux yusufshakeel-ubuntu 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release

This will print the version of OS installed.

I have installed Ubuntu 18.04 LTS so I am getting the related information.

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

uptime

This command tells us how long the system has been running.

In the following example we can see that the system has been running for the past 55 minutes.

$ uptime
08:37:55 up 55 min,  1 user,  load average: 0.00, 0.02, 0.06

reboot

This will reboot the system.

$ reboot

shutdown

This will shutdown the system.

$ shutdown

whoami

This command will print the current user.

In the following example we are getting the current user.

$ whoami
yusufshakeel

hostname

This command will print the current hostname.

In the following example we are getting the current hostname.

$ hostname
yusufshakeel-ubuntu

hostname -i

This command will print the current hostname IP address.

In the following example we are getting the current hostname IP address.

$ hostname -i
127.0.1.1
Share